IM really needs this feature
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: IM really needs this feature
See http://www.imagemagick.org/script/color.php . But you can just use "rgb(58.194%%,30.5%%,31%%)".
snibgo's IM pages: im.snibgo.com
Re: IM really needs this feature
Thanks now it works. So the only thing what could be improved in the -fuzz is to
have possibility to specify more colors
e.g
It would also solve the missing of wrapping in HSL model.
have possibility to specify more colors
e.g
Code: Select all
convert test.png -colorspace HSL -fuzz 15%% -fill Black +opaque "rgb(%avgH1%%%,%avgS1%%%,%avgL1%%%),rgb(%avgH2%%%,%avgS2%%%,%avgL2%%%)" -colorspace sRGB result_mask.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: IM really needs this feature
Code: Select all
convert test.png -colorspace HSL -fuzz 15%% -fill Black +opaque "rgb(%avgH1%%%,%avgS1%%%,%avgL1%%%),rgb(%avgH2%%%,%avgS2%%%,%avgL2%%%)" -colorspace sRGB result_mask.png
Re: IM really needs this feature
Maybe it could be better written like so:
I think this would either need new function
instead of IsColorSimilar to use AreColorsSimilar which could recieve more colors in argument. Or just edit the IsColorSimilar function. The algorithm should find out if the color is in range of one of the colors. If both colors are out of range so it would be like they are not in the fuzz tolerance. The idea is simple, but harder to explain because colorspaces are my weakness - I am not good on mathematics. But I know it must work. It's basicly that you process every pixel and test it for multiple conditions.
Code: Select all
convert test.png -colorspace HSL -fuzz 15%% -fill Black +opaque "rgb(%avgH1%%%,%avgS1%%%,%avgL1%%%)||rgb(%avgH2%%%,%avgS2%%%,%avgL2%%%)" -colorspace sRGB result_mask.png
instead of IsColorSimilar to use AreColorsSimilar which could recieve more colors in argument. Or just edit the IsColorSimilar function. The algorithm should find out if the color is in range of one of the colors. If both colors are out of range so it would be like they are not in the fuzz tolerance. The idea is simple, but harder to explain because colorspaces are my weakness - I am not good on mathematics. But I know it must work. It's basicly that you process every pixel and test it for multiple conditions.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: IM really needs this feature
VanGog wrote:Maybe it could be better written like so:I think this would either need new functionCode: Select all
convert test.png -colorspace HSL -fuzz 15%% -fill Black +opaque "rgb(%avgH1%%%,%avgS1%%%,%avgL1%%%)||rgb(%avgH2%%%,%avgS2%%%,%avgL2%%%)" -colorspace sRGB result_mask.png
instead of IsColorSimilar to use AreColorsSimilar which could recieve more colors in argument. Or just edit the IsColorSimilar function. The algorithm should find out if the color is in range of one of the colors. If both colors are out of range so it would be like they are not in the fuzz tolerance. The idea is simple, but harder to explain because colorspaces are my weakness - I am not good on mathematics. But I know it must work. It's basicly that you process every pixel and test it for multiple conditions.
That is why I keep suggesting my 1D color lut using -fx to create the lut. You can build any combination of colors and comparisons.
Re: IM really needs this feature
I'd like to create my own little program, which could do similar thing as I described here. Based on specialized HSB definitions I could generate masks.
I would like to ask ImageMagick programmers where can I find the blur and level function in IM source? Possibly also function which joins images e.g. you have a grid of 3x3 image same size and want to join them. Because I would like to include these features in my program.
I would like to ask ImageMagick programmers where can I find the blur and level function in IM source? Possibly also function which joins images e.g. you have a grid of 3x3 image same size and want to join them. Because I would like to include these features in my program.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: IM really needs this feature
I'm not a programmer, but:
effect.c has BlurImage(...).
enhance.c has LevelImage(...).
effect.c has BlurImage(...).
enhance.c has LevelImage(...).
snibgo's IM pages: im.snibgo.com
Re: IM really needs this feature
The blur functions look very hard for me to understand (* but I found interesting explanation at least for gausian filter here http://stackoverflow.com/questions/1696 ... -functions ). The LevelImage seems more simple. I am checking it to understand how it works.
For the case that somebody with the knowledge would read this - my question to the function is what are meanings of these entities: rho, sigma - I see that black_point is rho but why? Does it mean black is expressed in angle? Which colorspace model/diagram should I check?
As far as I understand it so the main job is done by the method LevelPixel image. So IM first calculates scale (every time for every pixel?)
And then you change the color value saved in the pixel variable.
For the case that somebody with the knowledge would read this - my question to the function is what are meanings of these entities: rho, sigma - I see that black_point is rho but why? Does it mean black is expressed in angle? Which colorspace model/diagram should I check?
As far as I understand it so the main job is done by the method LevelPixel image. So IM first calculates scale (every time for every pixel?)
Code: Select all
scale=(white_point != black_point) ? 1.0/(white_point-black_point) : 1.0;
Code: Select all
level_pixel=QuantumRange*gamma_pow(scale*((double) pixel-black_point),1.0/
gamma);