Fix ColorHistogram to work with Open File

This commit is contained in:
Tony S Yu
2013-10-28 22:55:07 -05:00
parent d5776656a8
commit 5aec00731a
3 changed files with 13 additions and 1 deletions
+5
View File
@@ -182,8 +182,13 @@ class Plugin(QtGui.QDialog):
This method is called by the viewer when the original image is updated.
"""
self.arguments[0] = image
self._on_new_image(image)
self.filter_image()
def _on_new_image(self, image):
"""Override this method to update your plugin for new images."""
pass
@property
def filtered_image(self):
"""Return filtered image."""
+4 -1
View File
@@ -20,7 +20,10 @@ class ColorHistogram(PlotPlugin):
super(ColorHistogram, self).attach(image_viewer)
self.rect_tool = RectangleTool(self.ax, on_release=self.ab_selected)
self.lab_image = color.rgb2lab(image_viewer.image)
self._on_new_image(image_viewer.image)
def _on_new_image(self, image):
self.lab_image = color.rgb2lab(image)
# Calculate color histogram in the Lab colorspace:
L, a, b = self.lab_image.T
+4
View File
@@ -47,3 +47,7 @@ class PlotPlugin(Plugin):
bgcolor = str(bgcolor / 255.)
self.fig.patch.set_facecolor(bgcolor)
self.layout.addWidget(self.canvas, self.row, 0)
def _update_original_image(self, image):
super(PlotPlugin, self)._update_original_image(image)
self.redraw()