def image_canvas_test(): obj = Image() obj.img = camera() obj.cn = 0 frame = wx.Frame(None, title='gray test') canvas = ICanvas(frame, autofit=True) canvas.set_img(obj) frame.Show()
def complex_test(): frame = wx.Frame(None, title='fft') canvas = Canvas(frame, autofit=True) canvas.set_img(fftshift(fft2(camera()))) canvas.set_rg((0,31015306)) canvas.set_log(True) frame.Show()
def gray_test(): frame = wx.Frame(None, title='gray test') canvas = Canvas(frame, autofit=True) canvas.set_img(camera()) frame.Show()
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()
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()
import wx class TestTool(Tool): def __init__(self): Tool.__init__(self) 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 = ICanvas(frame, autofit=True) canvas.set_img(camera()) canvas.set_tool(TestTool()) frame.Show() app.MainLoop()