mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-02 13:03:48 +08:00
Fix ColorHistogram to work with Open File
This commit is contained in:
@@ -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."""
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user