mark invalid pixels in image

Hello,

let’s say I have given an image of distance
values, which I display with the jet colormap. Now if there are invalid
pixels within the image they have the value -1 or -2. Is there a way to
display just the “valid” image with the jet colorbar and the
-1 pixels as white pixels and the -2 pixels as black pixels?

Till now I scale the image with vmin,
vmax:

vmin = img[(img != -1)
& (img != -2)].min()

vmax = img[(img != -1)
& (img != -2)].max()

imshow(img, vmin=vmin,
vmax=vmax, interpolation = ‘nearest’)

But how can I now paint the black and
white pixels?

Regards,

Markus

Hello,

let's say I have given an image of distance values, which I display with the jet colormap. Now if there are invalid pixels within the image they have the value -1 or -2. Is there a way to display just the "valid" image with the jet colorbar and the -1 pixels as white pixels and the -2 pixels as black pixels?

See http://matplotlib.sourceforge.net/examples/pylab_examples/image_masked.html.

You might need to use a masked array and mask the -2 values.

Eric

···

markus.proeller@...2861... wrote:

Till now I scale the image with vmin, vmax:

>>> vmin = img[(img != -1) & (img != -2)].min()
>>> vmax = img[(img != -1) & (img != -2)].max()
>>> imshow(img, vmin=vmin, vmax=vmax, interpolation = 'nearest')

But how can I now paint the black and white pixels?

Regards,

Markus

------------------------------------------------------------------------

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options