In a picture, there are many different colors. How can I just want to find the position of one color. In the following picture, if I would like to find the coordinates of the position of blue, how can I achieve that? Thank you very much!
1 Answer
image = Import["http://i.stack.imgur.com/1wEvU.jpg"];
Look for anything within 0.3 of Blue:
pv = PixelValuePositions[image, Blue, .3]
{{1614, 784}}
Just one pixel is that close to pure Blue. To display it:
HighlightImage[image, pv, "HighlightColor" -> White,
Method -> {"DiskMarkers", 20}]
It's over by the Balloon(?).
-
2$\begingroup$ Ooh, I've never come across
HighlightImage
before. +1, but why is it community wiki? $\endgroup$ Oct 31, 2013 at 10:35 -
$\begingroup$ @SimonWoods :) Too long to be yet another comment-as-answer, but didn't want to snatch credit away from commenters... $\endgroup$ Oct 31, 2013 at 10:37
-
$\begingroup$ @cormullion Can PixelValuePositions be used to find some "strange" color? $\endgroup$– KathyLLOct 31, 2013 at 21:35
-
$\begingroup$ @kathyLL any color will work, if you know its RGB values. But strangeness needs defining! :) $\endgroup$ Oct 31, 2013 at 21:51
-
Blue
you meanRGBColor[0,0,1]
? IsPixelValuePositions
ok? $\endgroup$image = Import["1wEvU.jpg"]; PixelValuePositions[image, Blue, 0.4]
gave me{{1605, 810}, {1606, 810}, {1604, 809}, {1605, 809},
... $\endgroup$