def test_plot_plugin(): viewer = ImageViewer(data.moon()) plugin = PlotPlugin(image_filter=lambda x: x) viewer += plugin assert_equal(viewer.image, data.moon()) plugin._update_original_image(data.coins()) assert_equal(viewer.image, data.coins()) viewer.close()
def test_canny(): image = data.camera() viewer = ImageViewer(image) c = CannyPlugin() viewer += c canny_edges = viewer.show(False) viewer.close() edges = canny_edges[0][0] assert edges.sum() == 2852
def test_viewer(): astro = data.astronaut() coins = data.coins() view = ImageViewer(astro) import tempfile _, filename = tempfile.mkstemp(suffix='.png') view.show(False) view.close() view.save_to_file(filename) view.open_file(filename) assert_equal(view.image, astro) view.image = coins assert_equal(view.image, coins), view.save_to_file(filename), view.open_file(filename), view.reset_image(), assert_equal(view.image, coins)