ImageValuePositions

ImageValuePositions[image,val]

returns a list of pixel positions in image that exactly match the value val.

ImageValuePositions[image,val,d]

returns all pixel positions that have values within a distance d from val.

Details

  • ImageValuePositions finds and returns pixels of specific values in 2D and 3D images and is typically used for locating features or removing artifacts.
  • ImageValuePositions assumes the standard image coordinate system.
  • ImageValuePositions always returns coordinates representing the centers of the pixels. Position represents the center of the pixel at the bottom-left corner.
  • The pixel value val can be in one of the following forms:
  • sa scalar
    colora color
    {s1,s2,}a list of channel values
    "Max"pixels with maximum intensity
    "Min"pixels with minimum intensity
  • Use PixelValuePositions to get integer indices for the pixel positions. ImageValuePositions[image,val] is equivalent to PixelValuePositions[image,val]-0.5.

Examples

open allclose all

Basic Examples  (2)

Extract positions of the white pixels:

Extract positions of pixels with values within the specified distance from white:

Scope  (9)

Data  (3)

Position of a value in a grayscale image:

Position of a value in a color image:

Position of a value in a grayscale 3D image:

Value  (6)

Position of a pixel with value equal to 0:

Position of the white pixel:

Position of the red pixel:

Positions of the pixels with maximum intensity:

Positions of the pixels with minimum intensity:

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

Properties & Relations  (2)

ImageValuePositions[image,val] is equivalent to ImageValuePositions[image,val,0].

ImageValuePositions[image,val] is equivalent to PixelValuePositions[image,val] minus :

Wolfram Research (2012), ImageValuePositions, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageValuePositions.html.

Text

Wolfram Research (2012), ImageValuePositions, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageValuePositions.html.

CMS

Wolfram Language. 2012. "ImageValuePositions." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ImageValuePositions.html.

APA

Wolfram Language. (2012). ImageValuePositions. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageValuePositions.html

BibTeX

@misc{reference.wolfram_2022_imagevaluepositions, author="Wolfram Research", title="{ImageValuePositions}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/ImageValuePositions.html}", note=[Accessed: 02-December-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_imagevaluepositions, organization={Wolfram Research}, title={ImageValuePositions}, year={2012}, url={https://reference.wolfram.com/language/ref/ImageValuePositions.html}, note=[Accessed: 02-December-2022 ]}