impixel() - Image Processing
impixel(I) returns the value of pixels
in the specified image I, where I can
be a grayscale, binary, or RGB image. impixel displays the image specified
and waits for you to select the pixels in the image using the mouse.
If you omit the input arguments, impixel operates
on the image in the current axes. Use normal button clicks to select pixels. Press Backspace or Delete to
remove the previously selected pixel. To finish selecting pixels,
adding a final pixel, press shift-click, right-click, or double-click.
To finish selecting pixels without adding a final pixel, press Return. When you finish selecting pixels, impixel returns
an m-by-3 matrix of RGB values in the supplied
output argument. If you do not supply an output argument, impixel returns
the matrix in ans. impixel always
returns pixel values as RGB triplets, regardless of the image type:For an RGB image, impixel returns
the actual data for the pixel. The values are either uint8 integers
or double floating-point numbers, depending on
the class of the image array.For an indexed image, impixel returns
the RGB triplet stored in the row of the colormap that the pixel value
points to. The values are double floating-point
numbers.For grayscale images, impixel returns
the intensity value as an RGB triplet, where R=G=B. The values are
either uint8 integers or double floating-point
numbers, depending on the class of the image array.For binary images, impixel returns
the intensity value as an RGB triplet, where R=G=B. The values are double floating-point
numbers. P = impixel(I,c,r) returns the values of
pixels specified by the row and column vectors r and c. r and c must
be equal-length vectors. The kth row of P contains
the RGB values for the pixel (r(k),c(k)).P = impixel(X,map) returns the value of
pixels in the specified indexed image I with corresponding
colormap, map.P = impixel(X,map,c,r) returns the value
of pixels specified by the row and column vectors r and c.[c,r,P] = impixel(___) returns
the coordinates of the selected pixels.P = impixel(x,y,I,xi,yi) returns the values
of pixels in the specified image, I, wherex and y are
two-element vectors specifying the image XData and YData. xi and yi are
equal-length vectors specifying the spatial coordinates of the pixels
whose values are returned in P[xi,yi,P] = impixel(x,y,I,xi,yi) returns
the coordinates of the selected pixels.
Syntax
impixel(I)P = impixel(I,c,r)P = impixel(X,map)P = impixel(X,map,c,r)[c,r,P] = impixel(___)P = impixel(x,y,I,xi,yi)[xi,yi,P] = impixel(x,y,I,xi,yi)
Example
RGB = imread('peppers.png');
c = [12 146 410];
r = [104 156 129];
pixels = impixel(RGB,c,r)
pixels =
62 34 63
166 54 60
59 28 47
Output / Return Value
Limitations
Alternatives / See Also
Reference