Ask Your Question

estimate the value of the luminance (the amount of light) from the camera with openCV

asked 2012-12-28 11:26:02 -0500

4arbouch gravatar image

I'am actually building an application on android using Samsung galaxy tab 10.1. I want to get the value of the luminance using the back Camera of the device.

The problem is that there is not a light sensor in the back of the device to just get the value that the light sensor gives to us . So I have to do it manually, in fact, I have to take frames in real time and for each frame I calculate the mean of the grayscale image, there is still a problem with that: With this method you will have false values because of the auto-correction of the camera and white balancing.

For instance, if you point the camera in front of a very bright source, the camera will focus on the bright area and all the area that surronds the bright point will became very dark so that the mean of the grayscale image gives us a false value ( it will not be very high in this case because there is dark area). I searched about method in the android API that disable such corrections but I do not found something interesting.

So, the question is: Is there a method in openCV than can help me having a nice estimation about the amount of light that enter to the back camera or some method that can help me accessing the parameters of the camera so that I manipulate them to , maybe , help me in the estimation of the luminance ?

Let me know if something is unclear ;) Thank you :D

edit retag flag offensive close merge delete


How did you use the back camera?

walter88 gravatar imagewalter88 ( 2013-01-17 04:03:35 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2012-12-29 01:49:24 -0500

OpenCV native camera (VideoCapture) on Android uses the same back-end as standard java camera. So the facilities are the same. As I know, there is no Standard Android API for precise camera control. The only thing you can do is to estimate relative changes in luminance. You need to lock white balance correction and exposure correction with setAutoWhiteBalanceLock and setAutoExposureLock.

There is project FCam. It is developing library for precise camera control. It was designed for Maemo OS, but there are ports for other platforms. I do not found Android port, but this page may be interesting.

edit flag offensive delete link more


Thanks for your reponse :) I'll look if I can find something interesting .

4arbouch gravatar image4arbouch ( 2012-12-29 05:32:24 -0500 )edit

answered 2013-01-17 08:57:10 -0500

walter88 gravatar image

How did you use the back camera?

edit flag offensive delete link more


this is not an answer.

Jean-François Côté gravatar imageJean-François Côté ( 2013-01-17 12:00:48 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2012-12-28 11:26:02 -0500

Seen: 1,908 times

Last updated: Jan 17 '13