Image Processing Toolbox User's Guide |
Getting Information About Image Pixels
The toolbox includes two functions that provide information about the values of pixels in an image.
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.
Note You can also get pixel value information interactively using the Image Tool -- see Getting Information about the Pixels in an Image. |
Getting Pixel Information with pixval
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 the image and hold down the mouse button while you move the cursor, pixval
also displays the Euclidean distance between the point you clicked 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.
Getting Pixel Information with impixel
impixel
provides pixel information in a variable in the MATLAB workspace.
If you call impixel
with no input arguments, the function associates itself with the image in the current axes. The cursor changes to crosshairs when it is over the image. You can then click 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.
This example illustrates how to use impixel
:
Getting Information about Pixel Values and Statistics | Getting the Intensity Profile of an Image |
© 1994-2005 The MathWorks, Inc.