extracting region of specified color

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
raksha
Posts: 3
Joined: 2012-02-21T02:34:56-07:00
Authentication code: 8675308

extracting region of specified color

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: extracting region of specified color

Post 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.
Post Reply