enhancement request to -average

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

enhancement request to -average

Post by fmw42 »

I am working to speed up a script that uses a complex fx expression. I think I could speed it up dramatically, if IM had a weighted average of multiple images. The problem I have is in using -compose plus or minus, I get clipping at 0 or 1 between pairs of images.

I was wondering if this might be relatively easy?

Basically either change -average to have a list of weights for arguments, like -convolve's list of kernel values, in this case one positive or negative floating point weight (no normalization) for each image or make a new function -weighted-average that does the same.

Let me know if this is a big deal or not.

I am trying to develop a work around in the mean time.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: enhancement request to -average

Post by magick »

We would need a -weighted-average option. We'll add it to our enhancement list. We expect to get to it sometime in late June.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: enhancement request to -average

Post by fmw42 »

magick wrote:We would need a -weighted-average option. We'll add it to our enhancement list. We expect to get to it sometime in late June.

OK. I know you are busy. No problem. Perhaps it should be called -weighted-sum as it is doing no normalization.

Thanks for putting it on the list.

Fred
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: enhancement request to -average

Post by fmw42 »

One other thought about this to consider. Rather than using a -convolve type argument list (that is currently restricted to odd number of values), one could use a -set option:...:args list of values

convert image1 image2 ... imageN -set option:...:args "wt1, wt2,... wtN" -weighted-sum result

Not urgent. Just wanted to add some further thoughts that might make it easier.

Fred
Post Reply