PixelValue

PixelValue[image, {x, y}]
gives the pixel value of image at position .

PixelValue[image, {xmin;;xmax, ymin;;ymax}]
gives the values of pixels whose coordinates range from to .

PixelValue[image, {x, y}, "type"]
gives the pixel value converted to the specified type.

Details and OptionsDetails and Options

  • In PixelValue[image, {x, y}], the values of x range from to w+0.5, and the values of y range from to h+0.5 for an image of width w and height h.
  • Integer coordinates correspond to the centers of the pixels. Position represents the center of the pixel at the bottom-left corner.
  • In 3D, pixel position corresponds to the center of the bottom-left front pixel.
  • In PixelValue[image, {xp, yp}], the position corresponds to the point , with assumed to be in the standard image coordinate system, where the values of x range from 0 to width and y from 0 to height. Pixel position represents the center of the pixel at the bottom-left corner.
  • PixelValue gives the value of the pixel nearest to .
  • PixelValue gives the value of the pixel nearest to , except that when the position lies on a boundary between pixels, the average of the pixels surrounding is returned.
  • Use ImageValue to extract interpolated values at in the image coordinate where x runs from 0 to width and y runs from 0 to height. Position corresponds to the bottom-left corner of the image.
  • PixelValue[image, {{x1, y1}, ...}] can be used to get pixel values for multiple positions.
  • PixelValue[image, {x, y}] by default returns values between 0 and 1. Using PixelValue[image, {x, y}, "type"], pixel value is returned in the range specified by . See the reference page for Image for a list of all possible data types.
  • PixelValue[image, {x, y}, Automatic] is equivalent to PixelValue[image, {x, y}, ImageType[image]].
  • PixelValue can take a Padding option that is used when a specified position is beyond an image.
New in 8 | Last modified in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »