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.
![Image](https://lh5.googleusercontent.com/-4mlAJW66HS8/T2_5xVWwoXI/AAAAAAAAADM/v5ohO3LYNSQ/s128/mveg.png)
![Image](https://lh3.googleusercontent.com/-4-tUv9akr2s/T2_5nmTB51I/AAAAAAAAADA/26bA0ONPh0A/s128/cveg.png)
//-modulate 127,255,60 i am getting yellow as per hue wheel(yellow shade :60 degree)
![Image](https://lh3.googleusercontent.com/-TDOLS1uGy5c/T2_7rNCDk8I/AAAAAAAAADk/p3o_7jUoAAM/s128/cveg.png)
//-modulate 100,100,120 i am getting green (green shade:120 degree)
![Image](https://lh6.googleusercontent.com/-D06445FjXoc/T3ADWrl_4GI/AAAAAAAAAD8/GtcpjCcvjbQ/s128/cveg.png)
but same i applied for other image i got different results:
![Image](https://lh4.googleusercontent.com/-9Q8ak71tNJA/T2_8Fwx1BxI/AAAAAAAAADw/hf0dqUQomDA/s128/flower.png)
//-modulate 100,100,30 i am getting blue shade which i got differs from the result i got for earlier image.
![Image](https://lh6.googleusercontent.com/-_o4dPFwHkZk/T3AHTKLNxiI/AAAAAAAAAEg/mukzESfSr7k/s128/cflower.png)
//-modulate 100,100,120 orange shade earlier was green for 120 degree
![Image](https://lh6.googleusercontent.com/-_xh5Perz_9Y/T3AITH6yQ7E/AAAAAAAAAEs/L0FOY94YSF8/s144-c/March26201210.jpg)
-modulate 100,100,166 then i got green for hue 166
![Image](https://lh4.googleusercontent.com/-X91frTivmZU/T3AI1QpGBwI/AAAAAAAAAE4/rKFT84xLhq0/s128/cflower.png)
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:
![Image](https://lh4.googleusercontent.com/-_1fuVlhNsZY/T3ADdvTlJRI/AAAAAAAAAEI/woMcW1GPMd8/s128/veg.png)
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");
![Image](https://lh5.googleusercontent.com/-4mlAJW66HS8/T2_5xVWwoXI/AAAAAAAAADM/v5ohO3LYNSQ/s128/mveg.png)
![Image](https://lh3.googleusercontent.com/-4-tUv9akr2s/T2_5nmTB51I/AAAAAAAAADA/26bA0ONPh0A/s128/cveg.png)
//-modulate 127,255,60 i am getting yellow as per hue wheel(yellow shade :60 degree)
![Image](https://lh3.googleusercontent.com/-TDOLS1uGy5c/T2_7rNCDk8I/AAAAAAAAADk/p3o_7jUoAAM/s128/cveg.png)
//-modulate 100,100,120 i am getting green (green shade:120 degree)
![Image](https://lh6.googleusercontent.com/-D06445FjXoc/T3ADWrl_4GI/AAAAAAAAAD8/GtcpjCcvjbQ/s128/cveg.png)
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");
![Image](https://lh4.googleusercontent.com/-9Q8ak71tNJA/T2_8Fwx1BxI/AAAAAAAAADw/hf0dqUQomDA/s128/flower.png)
//-modulate 100,100,30 i am getting blue shade which i got differs from the result i got for earlier image.
![Image](https://lh6.googleusercontent.com/-_o4dPFwHkZk/T3AHTKLNxiI/AAAAAAAAAEg/mukzESfSr7k/s128/cflower.png)
//-modulate 100,100,120 orange shade earlier was green for 120 degree
![Image](https://lh6.googleusercontent.com/-_xh5Perz_9Y/T3AITH6yQ7E/AAAAAAAAAEs/L0FOY94YSF8/s144-c/March26201210.jpg)
-modulate 100,100,166 then i got green for hue 166
![Image](https://lh4.googleusercontent.com/-X91frTivmZU/T3AI1QpGBwI/AAAAAAAAAE4/rKFT84xLhq0/s128/cflower.png)
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