I would like to request an addition to the list of -evaluate functions. This is open for discussion and feedback is welcome. Right now I only need this functionality for a script I working on. But this could be done using -function if more arguments are desired.
This would be
-evaluate exp arg
where this would be equivalent to
convert image -fx "$arg<0?exp($arg*u):1-exp(-$arg*u)" result
If arg is positive, one gets a rising exponential. If arg is negative, one gets a decaying exponential.
Note: by squaring the image first, one can get a Gaussian profile.
request enhancement -evaluate exp
Re: request enhancement -evaluate exp
Look for -evaluate exp in ImageMagick 6.6.5-1 Beta by sometime tomorrow. Thanks.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: request enhancement -evaluate exp
OK, I will test it when I see the new beta.
By the way, the rising form of the exponential is just the -negate of the negative form. So I took a look at the other form of a rising exponential. But it appears to be too linear when restricted to the range 0 to 1. So if someone has another way of normalizing it with only one argument that show more variation in the exponential rise, let us know.
Here is what I have:
If more arguments are needed to do a proper job of getting more variation, then this will wait until a -function exp can be created.
By the way, the rising form of the exponential is just the -negate of the negative form. So I took a look at the other form of a rising exponential. But it appears to be too linear when restricted to the range 0 to 1. So if someone has another way of normalizing it with only one argument that show more variation in the exponential rise, let us know.
Here is what I have:
If more arguments are needed to do a proper job of getting more variation, then this will wait until a -function exp can be created.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: request enhancement -evaluate exp
I have tested -evaluate exp value
but it only works for negative values. Looking at the code, it appears that only one part of the suggested code was implemented.
case ExponentialEvaluateOperator:
{
result=(MagickRealType) (QuantumRange*exp((double) (value*QuantumScale*
pixel)));
break;
}
This is OK with me (as the other side of the equations that I suggested is just -negate of the this).
Note that if one puts in positive values, the results will always be greater than quantumrange. So this form is really only an exponential decay function. As I pointed out above, the other exponential increase, exp(a*x)-1, is very linear and probably of little benefit.
Therefore is there are no objections, I will try to document what we have and emphasize it needs negative values (only) to get meaningful results.
but it only works for negative values. Looking at the code, it appears that only one part of the suggested code was implemented.
case ExponentialEvaluateOperator:
{
result=(MagickRealType) (QuantumRange*exp((double) (value*QuantumScale*
pixel)));
break;
}
This is OK with me (as the other side of the equations that I suggested is just -negate of the this).
Note that if one puts in positive values, the results will always be greater than quantumrange. So this form is really only an exponential decay function. As I pointed out above, the other exponential increase, exp(a*x)-1, is very linear and probably of little benefit.
Therefore is there are no objections, I will try to document what we have and emphasize it needs negative values (only) to get meaningful results.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: request enhancement -evaluate exp
I have updated the documents at http://www.imagemagick.org/script/comma ... p#evaluate, but this may take a day to filter over to the public web site.