Image Processing Toolbox User's Guide Previous page   Next Page

Getting Information About Image Pixels

The toolbox includes two functions that provide information about the values of 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:

  1. Display an image.
  2. Call impixel to select points.
  1. Click several points in the image to select pixels. When you are finished selecting points, press Return.

    The impixel function returns the pixel values in vals.

Previous page  Getting Information about Pixel Values and Statistics Getting the Intensity Profile of an Image Next page

© 1994-2005 The MathWorks, Inc.