Image Processing Toolbox | ![]() ![]() |
Pixel Selection
The toolbox includes two functions that provide information about the color data values of image pixels you specify:
pixval
function interactively displays the data values for pixels as you move the cursor over the image. pixval
can also display the Euclidean distance between two pixels.
impixel
function returns the data values for a selected pixel or set of pixels. You can supply the coordinates of the pixels as input arguments, or you can select pixels using a mouse.
To use pixval
, you first display an image and then enter the pixval
command. pixval
installs a black bar at the bottom of the figure, which displays the (x,y) coordinates for whatever pixel the cursor is currently over, and the color data for that pixel.
If you click on the image and hold down the mouse button while you move the cursor, pixval
also displays the Euclidean distance between the point you clicked on and the current cursor location. pixval
draws a line between these points to indicate the distance being measured. When you release the mouse button, the line and the distance display disappear.
pixval
gives you more immediate results than impixel
, but impixel
has the advantage of returning its results in a variable, and it can be called either interactively or noninteractively. If you call impixel
with no input arguments, the cursor changes to a crosshair when it is over the image. You can then click on the pixels of interest; impixel
displays a small star over each pixel you select. When you are done selecting pixels, press Return. impixel
returns the color values for the selected pixels, and the stars disappear.
In this example, you call impixel
and click on three points in the displayed image, and then press Return.
Notice that the second pixel, which is part of the canoe, is pure red; its green and blue values are both 0.
For indexed images, pixval
and impixel
both show the RGB values stored in the colormap, not the index values.
![]() | Pixel Values and Statistics | Intensity Profile | ![]() |