kkjkearney
Posts: 14
Joined: Wed Dec 23, 2015 3:16 pm

PiCamera - Variation between preview and capture

Wed Dec 23, 2015 3:39 pm

I've created a microscope application using a Raspberry Pi 2 and a Raspberry Pi camera board. I'm programming in Python using PyGame, cv2 and picamera 1.10.
Works great, with one exception.
Previewing to the screen looks great, with a very responsive image, good colors and excellent reaction to changing light conditions. However when I capture, the image takes on strange hues and the white balance appears to be performing poorly. Capture seems unable to adjust to various lighting conditions, at least compared to preview. If I could, I'd capture exactly what I'm seeing in preview mode and manipulate that image in pygame.
I've tried querying all preview settings such as awb_gains and forcing that upon the capture, but the results look worse. I've queried and observed that the digital_gain is different when previewing and capturing, but I have no control over that. I've tried capturing from the video port, but similar results.
Remember, this is a microscope application so the lighting is unique and the FOV might be cut off. Could the camera be making white balance decisions based upon the whole FOV, instead of just the center where I'm later cropping?
Any suggestions?

kkjkearney
Posts: 14
Joined: Wed Dec 23, 2015 3:16 pm

Re: PiCamera - Variation between preview and capture

Wed Dec 23, 2015 7:46 pm

Mystery solved... The image went into my array as BGR, and I used it as if it were RGB. The subject under the microscope was not strikingly different colors, so it wasn't obvious that it was simply a color swap.

Return to “Camera board”