Page 1 of 1

extracting region of specified color

Posted: 2012-03-14T23:44:42-07:00
by raksha
hello everyone..

i want to extract the region of particular color..i am using FRED'S 'locatecolor' script. i try this script on below image:

Code: Select all

<?php echo shell_exec('sh locatecolors.sh -b "rgb(237,28,36)" -e "rgb(100,50,50)" -m or shape.png cshape.png ');  ?>
Image

ang got this output:

Image
which i got as expected since i am giving beginning color rgb(237,28,36) which is red which i got from original image and end color "rgb(100,50,50)" i tried the end color value like
rgb(237,28,36),rgb(200,20,20),rgb(100,0,0) its works. and giving red region.

same i applied to extract the yellow region as below:

Code: Select all

echo shell_exec('sh locatecolors.sh -b "rgb(255,242,0)" -e "rgb(200,200,120)" -m or shape.png cshape.png ');
output:
Image
which not as per my expectation..
i am giving "rgb(255,242,0)" as yellow color which i got from original image . i am not getting the second i.e end color i tried other values for that end color but not works..
can u please tell me what should be the end color value for getting yellow region..and what is the technique for giving that color

i am getting this result by

Code: Select all

echo exec('convert shape.png  -fill none +opaque "rgb(255,242,0)" cshape.png ');
but i want to use locatecolor script

Re: extracting region of specified color

Posted: 2012-03-15T10:01:13-07:00
by fmw42
Locate colors finds any color between the two specified (begin and end) by channel. -fuzz uses a color distance measure. So the two will be different. To find some color, make sure your begin and end values are not too different. Your values are much too different to work properly. Narrow your range down. Use the colorconverter at http://www.imagemagick.org/script/color.php to visualize the two colors you specify and make sure that they both are close to yellow.