Test frame manipulator """ __license__= "Cecill-C" __revision__ = " $Id: __init__.py 2245 2010-02-08 17:11:34Z cokelaer $ " from openalea.vpltk.qt import QtGui from openalea.image.all import imread, to_pix from numpy import zeros,uint32 qapp = QtGui.QApplication.instance() if qapp: try: img = imread("4_ocean_currents.png") except: img = imread("test/4_ocean_currents.png") #img = zeros( (100,50,3),uint32) #img[10:20,10:30,1] = 255 pix = to_pix(img) w = QtGui.QLabel() w.setPixmap(pix) w.show()
#saturate sat = saturate(img) #high_level mask = high_level(img,100) pal = bw() hg = pal[mask * 1] hgimg = apply_mask(img,mask) #color_select mask = color_select(img,(0,255,0),10) sel = pal[mask * 1] selimg = apply_mask(img,mask) w_list = [] y = 0 for im,name in [(img,"img"), (sat,"sat"), (hgimg,"hgimg"),(hg,"hg"), (selimg,"selimg"),(sel,"sel")] : w = QtGui.QLabel() w.setWindowTitle(name) w.setPixmap(to_pix(im) ) w.show() w.move(0,y) y += w.frameRect().height() w_list.append(w)
__license__ = "Cecill-C" __revision__ = " $Id: __init__.py 2245 2010-02-08 17:11:34Z cokelaer $ " from openalea.vpltk.qt import QtGui from openalea.image.all import rainbow, grayscale, to_pix from numpy import array, apply_along_axis qapp = QtGui.QApplication.instance() if qapp: data = array(range(10000)).reshape((100, 100)) pal = rainbow(10000) img = pal[data] def func(pix): if pix[0] > 100: return (0, 0, 0) else: return (255, 255, 255) img = apply_along_axis(func, -1, img) pix = to_pix(img) w = QtGui.QLabel() w.setPixmap(pix) w.show()
img = pal[data] img[:, :150, :] = img[:, :150, :] / 10 #saturate sat = saturate(img) #high_level mask = high_level(img, 100) pal = bw() hg = pal[mask * 1] hgimg = apply_mask(img, mask) #color_select mask = color_select(img, (0, 255, 0), 10) sel = pal[mask * 1] selimg = apply_mask(img, mask) w_list = [] y = 0 for im, name in [(img, "img"), (sat, "sat"), (hgimg, "hgimg"), (hg, "hg"), (selimg, "selimg"), (sel, "sel")]: w = QtGui.QLabel() w.setWindowTitle(name) w.setPixmap(to_pix(im)) w.show() w.move(0, y) y += w.frameRect().height() w_list.append(w)