more clarification on hue angle in modulate command
Posted: 2012-03-25T23:27:25-07:00
hi all,
thanks in advance
i am working on identifying region of image and change the color of that region. i am able to identify region of image by "magicwand script". and applied modulate command . i tried this for different images. and each time i got different outputs. for more understanding see below eg:
original image:
and got the below img with hue angle 30 getting pink shade.


//-modulate 127,255,60 i am getting yellow as per hue wheel(yellow shade :60 degree)

//-modulate 100,100,120 i am getting green (green shade:120 degree)

but same i applied for other image i got different results:

//-modulate 100,100,30 i am getting blue shade which i got differs from the result i got for earlier image.

//-modulate 100,100,120 orange shade earlier was green for 120 degree

-modulate 100,100,166 then i got green for hue 166

i gone through http://www.imagemagick.org/Usage/color_mods/#color_mods and not able to understand the 3rd parameter i.e hue in modulate command .
as per i know hue it is angle between the 0 to 360 degree. and modulate command rotates the color ..i am not undestanding the lines..As you can see a value of '33.3' produces a negative, or counter-clockwise rotation of all the colors by approximately 60 degrees, effectively mapping the red to blue, blue to green, and green to red. Using values of '0' or '200' produces a complete 180 degree negation of the colors, without negating the brightness of the image. A value of '300' will produce 360 degrees in color rotation resulting in no change to the image.
can anyone help me to undestand this... so that i got constant result for hue angle. or any other way?
thanks,
ashwini
thanks in advance
i am working on identifying region of image and change the color of that region. i am able to identify region of image by "magicwand script". and applied modulate command . i tried this for different images. and each time i got different outputs. for more understanding see below eg:
original image:

Code: Select all
echo shell_exec('sh magicwand.sh 120,129 -t 26 -f mask -r outside -m binary veg.png mveg.png');
echo exec("convert veg.png -mask mveg.png -modulate 100,100,30 +mask cveg.png");


//-modulate 127,255,60 i am getting yellow as per hue wheel(yellow shade :60 degree)

//-modulate 100,100,120 i am getting green (green shade:120 degree)

but same i applied for other image i got different results:
Code: Select all
echo shell_exec('sh magicwand.sh 185,37 -t 50 -f mask -r outside -m binary flower.png mflower.png');
echo exec("convert flower.png -mask mflower.png -modulate 100,100,30 +mask cflower.png");

//-modulate 100,100,30 i am getting blue shade which i got differs from the result i got for earlier image.

//-modulate 100,100,120 orange shade earlier was green for 120 degree

-modulate 100,100,166 then i got green for hue 166

i gone through http://www.imagemagick.org/Usage/color_mods/#color_mods and not able to understand the 3rd parameter i.e hue in modulate command .
as per i know hue it is angle between the 0 to 360 degree. and modulate command rotates the color ..i am not undestanding the lines..As you can see a value of '33.3' produces a negative, or counter-clockwise rotation of all the colors by approximately 60 degrees, effectively mapping the red to blue, blue to green, and green to red. Using values of '0' or '200' produces a complete 180 degree negation of the colors, without negating the brightness of the image. A value of '300' will produce 360 degrees in color rotation resulting in no change to the image.
can anyone help me to undestand this... so that i got constant result for hue angle. or any other way?
thanks,
ashwini