machinevisiontoolbox.Image.showpixels
- Image.showpixels(textcolors=['yellow', 'blue'], fmt=None, ax=None, windowsize=0, **kwargs)
Display image with pixel values
- Parameters:
textcolors (list, optional) – text color, defaults to [‘yellow’, ‘blue’]
fmt (str, optional) – format string for displaying pixel values, defaults to None
ax (axes, optional) – Matplotlb axes to draw into, defaults to None
windowsize (int, optional) – half side length of superimposed moving window, defaults to 0
- Returns:
a moving window
- Return type:
Window
instance
Display a monochrome image with the pixel values overlaid. This is suitable for small images, of order 10x10, used for pedagogical purposes. For example it can be used to animate the operation of sliding window operations like convolution or morphology.
The first color in
textcolors
is used for pixels below 50% intensity and the second color for those above 50%.If
windowsize
is given then a translucent colored window is superimposed and aWindow
instance returned. This allows the window position, color and opacity to be changed.Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Random(10) >>> window = img.showpixels(windowsize=1) # with 3x3 window >>> window.move(2,3) # position window at (2,3) >>> window.move(4,5, color='blue', alpha=0.7)
(
Source code
,png
,hires.png
,pdf
)(
Source code
,png
,hires.png
,pdf
)- Seealso: