Page 1 of 1

Bizzare defect with my RPi Camera

Posted: Sat Mar 21, 2015 4:51 am
by prizzom
Hi there,

I just bought the Raspberry Pi 2 and a new camera module. Excited to get started on a project. Unfortunately after seating and setting up the module for the first time I got really bizarre results from the camera. Looks like an error in color conversion of some sort.

Photos here: http://imgur.com/a/OiArm

I've tested the module on both a Raspberry Pi 1 & 2 with fresh installs of the latest Raspbian distribution with the same results. So I know it's not connection or configuration related. I was quite careful about static electricity so I'm confident I didn't zap it.

In any case, wanted to show you the difference between a photo taken from my iPhone camera and the Raspberry Pi in case it's helpful to track down any sort of manufacturing issue. I'm not sure if I'm going to RMA it because the effect is actually pretty neat. I'd also be very happy is someone can point out that I've made an obvious goof.

Re: Bizzare defect with my RPi Camera

Posted: Sat Mar 21, 2015 10:24 am
by DougieLawson
Point it out of a window and take a photo with daylight. Your interior lighting is the wrong colour for the default automatic white balance setting.

Later on tonight try this funky command: for i in off auto sun cloud shade tungsten fluorescent incandescent flash horizon; do raspistill -awb $i -o $i.jpg; done
I think I've got all the valid values for the -awb parameter in that list.

Compare those ten images with another one taken from your iPhone.

Re: Bizzare defect with my RPi Camera

Posted: Sat Mar 21, 2015 12:57 pm
by ethanol100
Which camera module have you bought?

It looks like it is a "NOIR" camera module. And then it looks as expected.

Re: Bizzare defect with my RPi Camera

Posted: Sat Mar 21, 2015 1:05 pm
by AndyD
ethanol100 wrote:Which camera module have you bought?

It looks like it is a "NOIR" camera module. And then it looks as expected.
If you are unsure.

The regular camera module
Image


The Pi NoIR
Image

Re: Bizzare defect with my RPi Camera

Posted: Sat Mar 21, 2015 5:41 pm
by prizzom
Hi guys,

To those asking if it was a Noir or a regular camera module, it's a regular camera module. I thought the same thing though when I saw it.

Re: Bizzare defect with my RPi Camera

Posted: Sat Mar 21, 2015 6:44 pm
by prizzom
DougieLawson wrote:Point it out of a window and take a photo with daylight. Your interior lighting is the wrong colour for the default automatic white balance setting.

Later on tonight try this funky command: for i in off auto sun cloud shade tungsten fluorescent incandescent flash horizon; do raspistill -awb $i -o $i.jpg; done
I think I've got all the valid values for the -awb parameter in that list.

Compare those ten images with another one taken from your iPhone.
The window worked much better: http://imgur.com/a/HVLBD.

EDIT: As do photos taken in my living room during daylight with full sunlight: http://imgur.com/a/U2Lp0

But last night I did manually cycle through many of the filters with the same ultra washed out / pastel images. This seems to imply that the camera will never work properly when my apartment is only lit by halogen lights.

I'm curious about where the deficiency lies with the camera. Is the auto white balancing performed in hardware by the camera module itself or is this implemented in the driver and/or image capture software (and therefore correctable)?

What is it about the camera used in modern cellphones and webcams that causes them not to have this issue?

Re: Bizzare defect with my RPi Camera

Posted: Sat Mar 21, 2015 8:30 pm
by DougieLawson
There's a lot of strange coloured light in your room. The iPhone may be using a different sampling method to determine the average white balance.

It looks like the camera is OK and you just need to tweak awb and the multitude of other settings.

What parms are you passing to raspistill? How long are you running the sensor for before you capture a shot?

Re: Bizzare defect with my RPi Camera

Posted: Sun Mar 22, 2015 2:56 pm
by jamesh
Certainly an AWB problem. I'm guessing the algorithm is getting its 'guess' at the lighting conditions wrong. Did you try manually setting WB rather than using automatic.

WB is a very difficult problem to solve for all cases.

Re: Bizzare defect with my RPi Camera

Posted: Sun Mar 22, 2015 4:22 pm
by Mark_T
Your device _definitely_ lacks an IR filter - so its a PiNOIr sensor on a regular board,
a manufacturing error at a guess.

No amount of white-balance error could make a black settee white! Most black fabric is
very pale in near IR.

Re: Bizzare defect with my RPi Camera

Posted: Sun Mar 22, 2015 4:51 pm
by DougieLawson
Mark_T wrote:Your device _definitely_ lacks an IR filter - so its a PiNOIr sensor on a regular board,
a manufacturing error at a guess.

No amount of white-balance error could make a black settee white! Most black fabric is
very pale in near IR.
That doesn't make sense when you look at the OP's daylight photos, there's nothing wrong with the colours in those. There's lots wrong with the exposure time because it's not in bright sunlight.

Re: Bizzare defect with my RPi Camera

Posted: Mon Mar 23, 2015 4:13 am
by prizzom
Hi Dougie, James,

First, thanks for taking the time to help me out on this.

I just ran a bash script to iterate through all exposures and all auto white balance settings. Each command takes the form of:

raspistill -awb $awb -ex $ex -o awb_${awb}_ex_${ex}.jpg
for example: raspistill -awb off -ex auto -o awb_off_ex_auto.jpg

I've posted the resulting 120 images along with a photo from my iPhone here: http://imgur.com/a/AC7DX

The resulting photos are almost all identical, if the auto white balance is set to anything other than 'off' I get a blue couch, otherwise an all black image.

Videos taken for 5 and 10 seconds produce the exact same image.

If there are any other settings I should be adjusting to try to rectify the problem, please let me know.

Re: Bizzare defect with my RPi Camera

Posted: Mon Mar 23, 2015 5:33 am
by toxibunny
I dunno, but that 'pastel candyland' pic is fantastic!

Re: Bizzare defect with my RPi Camera

Posted: Mon Mar 23, 2015 7:59 am
by DougieLawson
Is this another blue & black vs white & gold dress problem.

Try using a lower ISO value as the picture is washing out.

Re: Bizzare defect with my RPi Camera

Posted: Wed Mar 25, 2015 2:32 pm
by Mark_T
Let me repeat, this is definitely a lack of IR filter, nothing to do with white balance.

Somehow a regular Pi Camera module has been made without the IR filter.

Note the original images the black socks become white. White balance doesn't
affect black objects!

Re: Bizzare defect with my RPi Camera

Posted: Wed Mar 25, 2015 3:01 pm
by poing
Mark_T wrote:Let me repeat, this is definitely a lack of IR filter, nothing to do with white balance.

Somehow a regular Pi Camera module has been made without the IR filter.

Note the original images the black socks become white. White balance doesn't
affect black objects!
+1

Re: Bizzare defect with my RPi Camera

Posted: Thu Mar 26, 2015 12:35 am
by jbeale
Mark_T wrote:Let me repeat, this is definitely a lack of IR filter, nothing to do with white balance.
Somehow a regular Pi Camera module has been made without the IR filter.
Note the original images the black socks become white. White balance doesn't affect black objects!
Yes, exactly so. I get very similar images where "black" fabrics look light or pastel (because the fabric dyes absorb mostly just visible light), using an old Sony D8 camera with the IR filter moved out of optical path in "Nightshot" mode. The problem was more obvious under incandescent light because those have a large amount of IR, vs daylight. You should be able to "fix" it, if you want to, with an external IR-block filter. If you didn't want a Pi No-IR model, I'd say you should probably return it.

Re: Bizzare defect with my RPi Camera

Posted: Sun Mar 29, 2015 4:57 pm
by prizzom
I returned the camera and will pick up a new one tomorrow, thanks for the help everyone.