To determine the values of one or more pixels in an image and return the values in a
variable, use the
impixel function. You can specify the
pixels by passing their coordinates as input arguments or you can select the pixels
interactively using a mouse.
impixel returns the value of specified
pixels in a variable in the MATLAB® workspace.
You can also get pixel value information interactively using the Image Tool -- see Get Pixel Information in Image Viewer App.
This example shows how to use
impixel interactively to get
Display an image.
impixel. When called with no input arguments,
impixel associates itself with the image in the
pixel_values = impixel
Select the points you want to examine in the image by clicking the mouse.
impixel places a star at each point you
When you are finished selecting points, press
the pixel values in an n-by-3 array, where
n is the number of points you selected.
impixel removes the stars used to indicate selected
0.1294 0.1294 0.1294 0.5176 0 0 0.7765 0.6118 0.4196