PixelValue

PixelValue[image,ppos]
gives the pixel value of image at position pos.

PixelValue[image,ppos,"type"]
gives the pixel value converted to the specified type.

Details and OptionsDetails and Options

  • Pixel positions ppos can be in one of the following forms:
  • {x,y}or {x,y,z}single position in 2D or 3D
    {xmin;;xmax,}span of positions
    {ppos1,ppos2,}a list of position specifications
    markerimagea marker image
  • In PixelValue[image,{xp,yp}], the pixel position with assumed to be in the standard image coordinate system, where the values of x range from to width and y from to height.
  • In PixelValue, integer coordinates correspond to the centers of the pixels. In 2D, pixel position represents the center of the bottom-left pixel. In 3D, pixel position corresponds to the center of the bottom-left front pixel.
  • 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 standard image coordinate system.
  • With PixelValue[image,marker], nonzero pixels of the image marker are used as the list of positions.
  • PixelValue[image,ppos] by default returns values between 0 and 1. Using PixelValue[image,ppos,"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,ppos,Automatic] is equivalent to PixelValue[image,ppos,ImageType[image]].
  • PixelValue can take a Padding option that is used when a specified position is beyond an image.
Introduced in 2010
(8.0)
| Updated in 2014
(10.0)