motocoder
Posts: 29
Joined: Fri Sep 06, 2013 4:13 pm

Underexposed images from camera

Fri Sep 06, 2013 4:24 pm

I created a control box for a pet food feeder to create a remotely controllable cat treat feeder (videos below). The device uses a Raspberry Pi Camera board to allow the remote user to see the cat as he comes to get his treats. This works great, and gives my family peace of mind regarding the welfare of our cat when we are on short trips.

Really, we only have one problem with this system, and that is that the camera board is consistently underexposing pictures unless there is very significant (i.e. sunlight) coming in the window and lighting the room. THEre is a big multi-bulb incandescent light ficture right over the area where the machine resides, but even with this on the camera will show an almost dark frame about 9 out of 10 pictures, It does occasionally show a correctly exposed image, so I know it is possible.

I've tried literally every setting for raspistill, but nothing seems to work consistently. Any suggestions?

Info on the project for those who are interested:
Device physical interface:
http://youtu.be/KexCIS8uCzU

Device web site:
http://youtu.be/Ua2BANU7uzA

Enhancement to the device to count cat treats that hit the bowl (first video shows circuit, second video shows it working in the device):
https://www.facebook.com/photo.php?v=10 ... 1752912327
https://www.facebook.com/photo.php?v=10 ... 7763378792

motocoder
Posts: 29
Joined: Fri Sep 06, 2013 4:13 pm

Re: Underexposed images from camera

Sat Sep 07, 2013 9:00 pm

Are others experiencing this, or is it an issue with my camera?

technoducky
Posts: 62
Joined: Sat Jan 26, 2013 7:29 pm
Contact: Website

Re: Underexposed images from camera

Wed Sep 11, 2013 10:29 am

I have similar problems with bad exposure control, not necessarily dark frames, but generally having issues setting exposure parameters.

moonpi
Posts: 1
Joined: Fri Sep 13, 2013 6:49 am

Re: Underexposed images from camera

Fri Sep 13, 2013 6:56 am

I'm having the same problem. Just got a new rpi board, and brand new camera. I can take pictures just fine but every one is very under exposed. I tried setting -ex night, -ex verylong, -ISO 800, -ev +10 but nothing really helped. I looked at the exif data and it says: Model RP_OV5647, f/2.9, Exposure time 1/6173 sec. The interesting part is the exposure time, it seems stuck at 1/6173!
I also ran apt-get update then rpi-update, didnt help.
I took some pictures last month with a different camera and different rpi but the exact same SD card and they came out fine last month, now they are all dark.
Is there any way to manually set the exposure time?
Any suggestions?

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

Re: Underexposed images from camera

Fri Sep 13, 2013 7:53 am

moonpi wrote:I'm having the same problem. Just got a new rpi board, and brand new camera. I can take pictures just fine but every one is very under exposed. I tried setting -ex night, -ex verylong, -ISO 800, -ev +10 but nothing really helped. I looked at the exif data and it says: Model RP_OV5647, f/2.9, Exposure time 1/6173 sec. The interesting part is the exposure time, it seems stuck at 1/6173!
I also ran apt-get update then rpi-update, didnt help.
I took some pictures last month with a different camera and different rpi but the exact same SD card and they came out fine last month, now they are all dark.
Is there any way to manually set the exposure time?
Any suggestions?
Hmm. That's a bit odd. I would expect out of the box to be absolutely fine. Can you try that other camera on your board to see if that works OK?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

compiler
Posts: 9
Joined: Mon Sep 09, 2013 10:09 pm

Re: Underexposed images from camera

Fri Sep 13, 2013 10:05 pm

Im having the very same problem.

Camera bought in Sep 2013, rev 1.3, latest version of raspian OS and the utilities.

:arrow: Some raspistill flags dont work

:arrow: Pictures underexposed consistently (very dark/black)

The thing is if I move my hand in front of the camera it somehow recalculates
the iso/exposition and will produce a much better picture, only to back to fully black the next shot.

What can we do?

Who develops the "raspistill/raspivid" utilities?

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

Re: Underexposed images from camera

Sat Sep 14, 2013 12:56 am

JamesH did raspistill and raspivid. However the source is available and anyone can roll their own:
https://github.com/raspberrypi/userland ... s/raspicam

You can fix the gain setting of the camera, for example the options -ISO 100 or -ISO 800 did work, when I tried it before. Unfortunately there is no direct control over shutter speed, that is set by an AGC process within the GPU under control of the GPU firmware, which is not open source. So if there is a problem there, we will need to wait for JamesH to fix it.

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

Re: Underexposed images from camera

Sat Sep 14, 2013 7:58 am

compiler wrote:Im having the very same problem.

Camera bought in Sep 2013, rev 1.3, latest version of raspian OS and the utilities.

:arrow: Some raspistill flags dont work

:arrow: Pictures underexposed consistently (very dark/black)

The thing is if I move my hand in front of the camera it somehow recalculates
the iso/exposition and will produce a much better picture, only to back to fully black the next shot.

What can we do?

Who develops the "raspistill/raspivid" utilities?
Yes, some flags don't work - that's because when I wrote the code I included everything that might be possible using the MMAL interface, and didn't get rid of the options that turned out not to work for the particular camera.

Not sure about the exposure thing, having trouble finding time to look at it. Very busy at work.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

gordon77
Posts: 5119
Joined: Sun Aug 05, 2012 3:12 pm

Re: Underexposed images from camera

Mon Sep 16, 2013 2:06 pm

Does -ISO work in raspistill ? and if so what are the range of values ?

Thanks

Gordon77

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

Re: Underexposed images from camera

Mon Sep 16, 2013 2:16 pm

gordon77 wrote:Does -ISO work in raspistill ? and if so what are the range of values ?
Yes, it works.

From page 6 of the documentation, http://www.raspberrypi.org/wp-content/u ... tation.pdf

Code: Select all

--ISO, -ISO   Set capture ISO
Sets the ISO to be used for captures. Range is 100 to 800.

gordon77
Posts: 5119
Joined: Sun Aug 05, 2012 3:12 pm

Re: Underexposed images from camera

Mon Sep 16, 2013 3:10 pm

jbeale wrote:
gordon77 wrote:Does -ISO work in raspistill ? and if so what are the range of values ?
Yes, it works.

From page 6 of the documentation, http://www.raspberrypi.org/wp-content/u ... tation.pdf

Code: Select all

--ISO, -ISO   Set capture ISO
Sets the ISO to be used for captures. Range is 100 to 800.
Thanks. I haven't managed to see any difference yet, but good to know it works :D

gordon77
Posts: 5119
Joined: Sun Aug 05, 2012 3:12 pm

Re: Underexposed images from camera

Mon Sep 16, 2013 3:51 pm

gordon77 wrote:
jbeale wrote:
gordon77 wrote:Does -ISO work in raspistill ? and if so what are the range of values ?
Yes, it works.

From page 6 of the documentation, http://www.raspberrypi.org/wp-content/u ... tation.pdf

Code: Select all

--ISO, -ISO   Set capture ISO
Sets the ISO to be used for captures. Range is 100 to 800.
Thanks. I haven't managed to see any difference yet, but good to know it works :D
I tried setting the ISO but can't see any difference. See attached shots (top left corner for images and right hand side for luminance graphs) which show very similar noise levels at 100 and 800.
Attachments
screen2.jpg
800ISO
screen2.jpg (50.56 KiB) Viewed 4787 times
screen1.jpg
100ISO
screen1.jpg (50.68 KiB) Viewed 4787 times

compiler
Posts: 9
Joined: Mon Sep 09, 2013 10:09 pm

Re: Underexposed images from camera

Mon Sep 16, 2013 4:48 pm

Thank you all for your replies.

jamesh thank you very much for your great work :!: BTW In no way Im complaining about those little things, you have saved me a lot of coding!!

It turned out my firmware was not fully updated and that is why some options didnt work (sorry! :oops: )

Most options seem to work fine, just "-ex" for exposure is the one that doesnt seem to make a difference (or at least an obvious one that I can tell)

-iso definitely works!!!

jamesh, can you tell us if the flags -t and -n (for preview time and previes on/off) make any difference in the quality of the image?
I mean, giving it a -n -t 3 will your code use those 3 seconds to calculate something and take a better still?

Thank you very much to everyone in the thread

gordon77
Posts: 5119
Joined: Sun Aug 05, 2012 3:12 pm

Re: Underexposed images from camera

Mon Sep 16, 2013 4:59 pm

compiler wrote:Thank you all for your replies.

jamesh thank you very much for your great work :!: BTW In no way Im complaining about those little things, you have saved me a lot of coding!!

It turned out my firmware was not fully updated and that is why some options didnt work (sorry! :oops: )

Most options seem to work fine, just "-ex" for exposure is the one that doesnt seem to make a difference (or at least an obvious one that I can tell)

-iso definitely works!!!

jamesh, can you tell us if the flags -t and -n (for preview time and previes on/off) make any difference in the quality of the image?
I mean, giving it a -n -t 3 will your code use those 3 seconds to calculate something and take a better still?

Thank you very much to everyone in the thread
I got -ex to work fine, if you switch it off and then set br and co, and then switch it on again it will adjust exposure

gordon77
Posts: 5119
Joined: Sun Aug 05, 2012 3:12 pm

Re: Underexposed images from camera

Mon Sep 16, 2013 5:30 pm

ednl wrote:
compiler wrote:I mean, giving it a -n -t 3 will your code use those 3 seconds to calculate something and take a better still?
Note: time values are in milliseconds so if you want 3 seconds, it's -t 3000.
gordon77 wrote:I got -ex to work fine, if you switch it off and then set br and co, and then switch it on again it will adjust exposure
How do you mean, are those three separate runs of raspistill?
Yes 3 runs, maybe not definitive but the only way l could think to try it.

motocoder
Posts: 29
Joined: Fri Sep 06, 2013 4:13 pm

Re: Underexposed images from camera

Mon Sep 16, 2013 8:08 pm

I tried every single option in raspistill, and it doesn't fix the issue. I can see that the ISO setting does actually change the ISO (based on the increased noise in the image at higher ISO), but the camera is still underexposing. I had zero luck with the manual exposure settings.

When my post here went for a week with no responses, I gave up and switched to a USB camera. I am very happy with that solution now, but would like to get the raspicam working for another project I am starting.

Here's a post on why I switched to the USB camera:
http://www.raspberrypi.org/phpBB3/viewt ... 43&t=55798

gordon77
Posts: 5119
Joined: Sun Aug 05, 2012 3:12 pm

Re: Underexposed images from camera

Mon Sep 16, 2013 8:12 pm

What raspistill command line are you using?

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

Re: Underexposed images from camera

Tue Sep 17, 2013 7:13 am

motocoder wrote:I tried every single option in raspistill, and it doesn't fix the issue. I can see that the ISO setting does actually change the ISO (based on the increased noise in the image at higher ISO), but the camera is still underexposing. I had zero luck with the manual exposure settings.

When my post here went for a week with no responses, I gave up and switched to a USB camera. I am very happy with that solution now, but would like to get the raspicam working for another project I am starting.

Here's a post on why I switched to the USB camera:
http://www.raspberrypi.org/phpBB3/viewt ... 43&t=55798
You waited a WHOLE WEEK?

Even if I had the time to look at this issue, it would be some time before I found the problem, fixed it, tested it, pushed it to github, and got it released. A month probably.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

motocoder
Posts: 29
Joined: Fri Sep 06, 2013 4:13 pm

Re: Underexposed images from camera

Tue Sep 17, 2013 8:07 am

I waited a week, expecting to hear whether the problem was something others were experiencing. I think a week with no replies usually means a thread dies, but in this case I did eventually get some replies.

Anyway, seems the hardware is good. Maybe you'll fix the code some day, or open source the relevant bits so someone else can.

mikerr
Posts: 2826
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Underexposed images from camera

Tue Sep 17, 2013 8:51 am

There was a issue with dark frames when using the -n (nopreview switch) a while back.

The fix/workaround was to omit the nopreview switch achieve the same effect by positioning the preview offscreen:

Code: Select all

-p '-20,-20,21,21'
I did think it had been fixed in recent versions though (apt-get update / rpi-update)
Last edited by mikerr on Sun Sep 22, 2013 3:51 pm, edited 1 time in total.

motocoder
Posts: 29
Joined: Fri Sep 06, 2013 4:13 pm

Re: Underexposed images from camera

Tue Sep 17, 2013 5:59 pm

Thanks, Mike. I did try it with and without preview enabled, but this weekend I will triple check it, and also check to make sure there isn't some update that has not been installed.

Return to “Camera board”