PixelValuePositions

PixelValuePositions[image,val]
returns a list of pixel positions in image that match the value val.

PixelValuePositions[image,val,d]
returns all pixel positions that have values within a distance d from val.

DetailsDetails

  • PixelValuePositions returns a list of integer positions where , with assumed to be in the standard image coordinate system where the values of x range from to width, and the values of y range from to height. Pixel position represents the center of the pixel at the bottom-left corner.
  • In 3D, PixelValuePositions[image,val] returns the positions , such that pixel position corresponds to the center of the bottom-left front pixel.
  • The pixel value val can be a scalar, a list of channel values, or a color.
  • PixelValuePositions[image,val] is equivalent to PixelValuePositions[image,val,0].
  • PixelValuePositions[image,"Min"] and PixelValuePositions[image,"Max"] can be used to return pixel positions with minimum and maximum intensity values, respectively.
  • ImageValuePositions[image,val] is equivalent to PixelValuePositions[image,val]-0.5.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Extract positions of the white pixels:

In[2]:=
Click for copyable input
Out[2]=

Positions of the pixels with values within the specified distance from white:

In[1]:=
Click for copyable input
Out[1]=

Positions of white pixels in a 3D image:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2012
(9.0)