I apologise in advance for the subject matter of my photos. I've not tidied the table for a few days. I needed indoor artificial lighting for the long duration of this experiment. Both images are reduced from original size.

The first image is a single frame from a web cam. This is similar to the way I perceive the view of the room under those lighting conditions.

single frame

The second image is the summation of 10,000 frames from the same web cam. I performed the summation myself using a custom bit of code. Each pixel's R, G and B value was summed into R, G and B 32 bit integers, and the totals divided by 10,000. An average image was then created from this averaged array.

10,000 averaged frames

You can see that the code worked in that the noise level has dropped dramatically. I believe by 99% (square root of 10,000). Some parts of the image are smooth and have even lost texture.

But why has the image shifted toward blue?

  • \$\begingroup\$ And some blue areas turned orange. Perhaps best to look at your code again... \$\endgroup\$ Aug 15, 2015 at 1:31

2 Answers 2


Based on the color swapping in the result, I would guess the blue values are being summed into the red result and vice versa. I've made sillier mistakes...

  • \$\begingroup\$ Really? You think it's a bug? Could be. I thought that since the image has smoothed and not geometrically distorted it was working. I thought that the colour cast was due to something like bias in the pixel values that then accumulated. So you would not expect any colour shift at all? I'll revisit my code... \$\endgroup\$
    – Paul Uszak
    Aug 16, 2015 at 3:40
  • \$\begingroup\$ Really. Something like a function that expects (R,G,B) being fed (B,G,R)... it happens. \$\endgroup\$ Aug 17, 2015 at 7:32
  • 2
    \$\begingroup\$ Fixed! Your (R,G,B) function was the answer. It's obvious really (not)! It wasn't my code per se, but my understanding. RGB web cam jpegs open as BGR pixel arrays in Java. Who knew! \$\endgroup\$
    – Paul Uszak
    Aug 19, 2015 at 23:18

If you fix the problem, you should get this result:

Problem fixed


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.