prizzom
Posts: 5
Joined: Sun Jun 02, 2013 3:42 am

Bizzare defect with my RPi Camera

Sat Mar 21, 2015 4:51 am

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.

User avatar
DougieLawson
Posts: 34156
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Bizzare defect with my RPi Camera

Sat Mar 21, 2015 10:24 am

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.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

ethanol100
Posts: 540
Joined: Wed Oct 02, 2013 12:28 pm

Re: Bizzare defect with my RPi Camera

Sat Mar 21, 2015 12:57 pm

Which camera module have you bought?

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

User avatar
AndyD
Posts: 2327
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Bizzare defect with my RPi Camera

Sat Mar 21, 2015 1:05 pm

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

prizzom
Posts: 5
Joined: Sun Jun 02, 2013 3:42 am

Re: Bizzare defect with my RPi Camera

Sat Mar 21, 2015 5:41 pm

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.

prizzom
Posts: 5
Joined: Sun Jun 02, 2013 3:42 am

Re: Bizzare defect with my RPi Camera

Sat Mar 21, 2015 6:44 pm

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?

User avatar
DougieLawson
Posts: 34156
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Bizzare defect with my RPi Camera

Sat Mar 21, 2015 8:30 pm

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?
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20753
Joined: Sat Jul 30, 2011 7:41 pm

Re: Bizzare defect with my RPi Camera

Sun Mar 22, 2015 2:56 pm

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.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

Mark_T
Posts: 149
Joined: Sat Dec 27, 2014 10:54 am

Re: Bizzare defect with my RPi Camera

Sun Mar 22, 2015 4:22 pm

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.

User avatar
DougieLawson
Posts: 34156
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Bizzare defect with my RPi Camera

Sun Mar 22, 2015 4:51 pm

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.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

prizzom
Posts: 5
Joined: Sun Jun 02, 2013 3:42 am

Re: Bizzare defect with my RPi Camera

Mon Mar 23, 2015 4:13 am

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.

toxibunny
Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: Bizzare defect with my RPi Camera

Mon Mar 23, 2015 5:33 am

I dunno, but that 'pastel candyland' pic is fantastic!
note: I may or may not know what I'm talking about...

User avatar
DougieLawson
Posts: 34156
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Bizzare defect with my RPi Camera

Mon Mar 23, 2015 7:59 am

Is this another blue & black vs white & gold dress problem.

Try using a lower ISO value as the picture is washing out.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

Mark_T
Posts: 149
Joined: Sat Dec 27, 2014 10:54 am

Re: Bizzare defect with my RPi Camera

Wed Mar 25, 2015 2:32 pm

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!

poing
Posts: 1131
Joined: Thu Mar 08, 2012 3:32 pm

Re: Bizzare defect with my RPi Camera

Wed Mar 25, 2015 3:01 pm

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

User avatar
jbeale
Posts: 3367
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Bizzare defect with my RPi Camera

Thu Mar 26, 2015 12:35 am

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.

prizzom
Posts: 5
Joined: Sun Jun 02, 2013 3:42 am

Re: Bizzare defect with my RPi Camera

Sun Mar 29, 2015 4:57 pm

I returned the camera and will pick up a new one tomorrow, thanks for the help everyone.

Return to “Camera board”