AccumulateWeighted generate brighter and brighter image
Newbie, using OpenCVSharp, seems to work ok. Trying to generate an average of images but result is just brighter each iteration and ends up totally white. Some hints?
What weight are you using?
0.5 But I tried with many numbers, trend is same whatever number,
Probably I misunderstand the function, I thought using this function creates an "average" of the images. My images are more-or-less static (except noise) and I thought I would end up with an image which looks (visually) similar to the source images.
make sure, the sum of your weights is exactly 1.0As I said, I am a newbie, what do you mean by (plural) weights? and thereby sum? I can only see the alpha argument.
apologies, strike that, i confused it with addWeighted()
(which, btw, might be the alternative you're looking for (since it keeps the "energy" constant) ;)
let me try to rephrase it:
accumulateWeighted() makes most sense for a finite number of accumulation steps, and alpha should be 1/N in this case, then you end up with the "correct" result.
if you do this infinitely, your image will be darker for n < 1/alpha and brighter for n > 1/alpha, this is unavoidable.
accumulateWeighted is for a running average sort of thing. If you just use 1/N as your alpha, you don't actually get an average. For example if N is 10, then the first image would end up being 1/3rd of your output. The equation for accumulateWeighted is dst = (1-alpha)dst + (alpha)src. So the total shouldn't get any brighter than the brightest pixel in either of the images.
ugg, wrong again, then ;(
thanks for the clarification !
I have (at the moment) a finite set of images (jpegs), approx. 66 files, more or less static (only static background, but of course some noise). After the first accumulation the result is already almost white (plus just a few mesh-like lines, even if weight is only 0.01
Try just adding them together and dividing by the number of images. And remember that since you're doing this as a CV_32F, when you do imshow it displays the range between 0 and 1, not 0 and 255.