({{, (RefLink[PixelValue, paclet:ref/PixelValue])[image,ppos] 
gives the pixel value of image at position pos.}, {, (RefLink[PixelValue, paclet:ref/PixelValue])[image,ppos,"type"]
gives the pixel value converted to the specified type.}})

OpenersNotesSection(Spacer1)Details and Options

Pixel positions ppos can be in one of the following forms:

In (RefLink[PixelValue, paclet:ref/PixelValue])[image,{xp,yp}], the pixel position {xp,yp}={x+1/2,y+1/2}, with {x,y} 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.

In (RefLink[PixelValue, paclet:ref/PixelValue]), integer coordinates correspond to the centers of the pixels. In 2D, pixel position {1,1} represents the center of the bottom-left pixel. In 3D, pixel position {1,1,1} corresponds to the center of the bottom-left front pixel.

(RefLink[PixelValue, paclet:ref/PixelValue]) gives the value of the pixel nearest to {xp,yp}, except that when the position {xp,yp} lies on a boundary between pixels, the average of the pixels surrounding {xp,yp} is returned.

Use (RefLink[ImageValue, paclet:ref/ImageValue]) to extract interpolated values at {x,y} in the standard image coordinate system.

With (RefLink[PixelValue, paclet:ref/PixelValue])[image,marker], nonzero pixels of the image marker are used as the list of positions.

(RefLink[PixelValue, paclet:ref/PixelValue])[image,ppos] by default returns values between 0 and 1. Using (RefLink[PixelValue, paclet:ref/PixelValue])[image,ppos,"type"], pixel value is returned in the range specified by "type". See the reference page for (RefLink[Image, paclet:ref/Image]) for a list of all possible data types.

(RefLink[PixelValue, paclet:ref/PixelValue])[image,ppos,(RefLink[Automatic, paclet:ref/Automatic])] is equivalent to (RefLink[PixelValue, paclet:ref/PixelValue])[image,ppos,(RefLink[ImageType, paclet:ref/ImageType])[image]].

(RefLink[PixelValue, paclet:ref/PixelValue]) can take a (RefLink[Padding, paclet:ref/Padding]) option that is used when a specified position is beyond an image.

OpenersPrimaryExamplesSection(Spacer1)Examples  (17)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Value of the bottom-left corner pixel:

PixelValue[,{1,1}]

Pixel value in "Byte" type:

PixelValue[,{1,1},"Byte"]

Value of a bottom-left front corner pixel in a 3D volume:

PixelValue[, {1,1,1}]

OpenersExampleSection1(Spacer1)Scope  (7)

A single pixel value of a color image:

PixelValue[,{10,10}]

Multiple pixel values of a color image:

PixelValue[,{{10,10},{20,20},{30,30}}]

A single pixel value of a grayscale image:

PixelValue[,{10,10}]

Multiple pixel values:

PixelValue[,{{10,10},{20,20},{30,30}}]

Pixel values at a range of positions:

PixelValue[,{10;;20,1;;2}]

Use (RefLink[All, paclet:ref/All]) to extract all pixels in one dimension:

PixelValue[,{10,All}]

Pixel values at positions specified by a marker image:

PixelValue[,]

By default, pixel values are returned in "Real" type:

PixelValue[,{10,10}]

Specify a different type:

PixelValue[,{10,10},"Byte"]

Use (RefLink[Automatic, paclet:ref/Automatic]) to return values in the original image data type:

PixelValue[,{10,10},Automatic]

OpenersExampleSection2(Spacer1)Applications  (2)

Compute mean pixel value of a region of interest:

PixelValue[,]//Mean

Pixel values on a path defined in a marker image:

PixelValue[,]

OpenersExampleSection3(Spacer1)Properties & Relations  (2)

Use (RefLink[ImageData, paclet:ref/ImageData]) to extract pixel values. Value of the bottom-left pixel:

PixelValue[,{1,1}]

ImageData[,DataReversed->True][[1,1]]

Bottom row of the image:

PixelValue[,{All,1}]

ImageData[,DataReversed->True][[1]]

Extract pixel values using (RefLink[ImageValue, paclet:ref/ImageValue]) and special settings of (RefLink[Resampling, paclet:ref/Resampling]) and (RefLink[DataRange, paclet:ref/DataRange]):

PixelValue[,Table[{i,i},{i,3}]]

ImageValue[,Table[{i,i},{i,.75,3,1}],Resampling->"Nearest",DataRange->{{.5,3.5},{.5,3.5}}]

OpenersExampleSection4(Spacer1)Possible Issues  (2)

When coordinates lie on a boundary between pixels, the average of surrounding pixel values is returned:

PixelValue[,{1.5,1.5}]

When converting to "Bit" type, pixel values will get rounded:

PixelValue[,{2,2}]

PixelValue[,{2,2},"Bit"]

OpenersExampleSection5(Spacer1)Interactive Examples  (1)

Profile of a single image row:

With[{img=},Manipulate[ListLinePlot[PixelValue[img,{All,row}],PlotRange->{0,1}],{row,1,150,1}]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ImageValue, paclet:ref/ImageValue])  ▪  (RefLink[ReplacePixelValue, paclet:ref/ReplacePixelValue])  ▪  (RefLink[PixelValuePositions, paclet:ref/PixelValuePositions])  ▪  (RefLink[ImageData, paclet:ref/ImageData])  ▪  (RefLink[Image, paclet:ref/Image])  ▪  (RefLink[Image3D, paclet:ref/Image3D])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Basic Image Manipulation, paclet:guide/BasicImageManipulation])}, {▪(RefLinkPlain[Color Processing, paclet:guide/ColorProcessing])}, {▪(RefLinkPlain[Image Representation, paclet:guide/ImageRepresentation])}})}})