Exemplo n.º 1
0
def image_canvas_test():
    obj = Image()
    obj.img = camera()
    obj.cn = 0

    frame = wx.Frame(None, title='gray test')
    canvas = Canvas(frame, autofit=True)
    canvas.set_img(obj)
    frame.Show()
Exemplo n.º 2
0
def complex_test():
    frame = wx.Frame(None, title='blend')
    canvas = Canvas(frame, autofit=True)
    canvas.set_img(fftshift(fft2(camera())))
    canvas.set_rg((0, 31015306))
    canvas.set_log(True)
    frame.Show()
Exemplo n.º 3
0
def rgb_gray_blend():
    frame = wx.Frame(None, title='blend')
    canvas = Canvas(frame, autofit=True)
    canvas.set_img(astronaut())
    canvas.set_cn((0,1,2))
    canvas.set_img(camera(), True)
    canvas.set_cn(0, True)
    canvas.set_mode(0.5)
    frame.Show()
Exemplo n.º 4
0
def gray_test():
    frame = wx.Frame(None, title='gray test')
    canvas = Canvas(frame, autofit=False)
    canvas.set_img(camera())
    frame.Show()
Exemplo n.º 5
0
def rgb_test():
    frame = wx.Frame(None, title='gray test')
    canvas = Canvas(frame, autofit=True)
    canvas.set_img(astronaut())
    canvas.set_cn((0, 1, 2))
    frame.Show()
Exemplo n.º 6
0
def complex_test():
    frame = wx.Frame(None, title='blend')
    canvas = Canvas(frame, autofit=True)
    canvas.set_img(fftshift(fft2(camera())))
    canvas.set_rg((0, 31015306))
    canvas.set_log(True)
    frame.Show()


if __name__ == '__main__':
    app = wx.App()
    #gray_test()
    #rgb_test()
    #rgb_gray_blend()
    #complex_test()
    frame = wx.Frame(None, title='blend')
    canvas = Canvas(frame, autofit=True)
    image = Image()
    image.img = camera()
    image.pos = (0, 0)
    canvas.images.append(image)

    image = Image()
    image.img = astronaut()
    image.pos = (100, 200)
    image.cn = (0, 1, 2)
    canvas.images.append(image)
    frame.Show()
    app.MainLoop()
Exemplo n.º 7
0
def mark_test(mark):
    frame = wx.Frame(None, title='gray test')
    canvas = Canvas(frame, autofit=False, up=True)
    canvas.set_shp(mark2shp(mark))
    frame.Show()
Exemplo n.º 8
0
sys.path.append('../../')
from skimage.data import astronaut, camera
from sciwx.canvas import Canvas, Tool
import wx


class TestTool:
    def mouse_down(self, image, x, y, btn, **key):
        print('x:%d y:%d btn:%d ctrl:%s alt:%s shift:%s' %
              (x, y, btn, key['ctrl'], key['alt'], key['shift']))

    def mouse_up(self, image, x, y, btn, **key):
        pass

    def mouse_move(self, image, x, y, btn, **key):
        pass

    def mouse_wheel(self, image, x, y, d, **key):
        image.img[:] = image.img + d
        key['canvas'].update()


if __name__ == '__main__':
    app = wx.App()
    frame = wx.Frame(None)
    canvas = Canvas(frame, autofit=True)
    canvas.set_img(camera())
    canvas.set_tool(TestTool())
    frame.Show()
    app.MainLoop()