Hello Everyone !
I am trying to change the MT9P031 camera parameters using opencv. I take the frame by using cvQuery function. I can get frames but the brightness of pictures is very dark. I can change camera parameters when i use mplayer by writing gain valueto /sys/devices/platform/i2c_omap.2/i2c-2/2-0048/gain_val. But I cant do the same with opencv. I have tried using cvSetCaptureProperty() but it did not work. I also tried to write values to /sys/devices/platform/i2c_omap.2/i2c-2/2-0048/gain_val and /sys/devices/platform/i2c_omap.2/i2c-2/2-0048/exposure_val but nothing happens. I can get camera parameters using cvGetCatureProperty() function.I dont want to use mplayer because I doubt its realtime behaviour.I will appreciate any help. Thanks
University of Engineering and Technology,Lahore
I will assume you are using the Aptina driver available for Angstrom on Github. I’m not sure whether writing to /sys/devices/* will have the intended effect, however if you look at the driver for the MT9P031, you can see that the exposure and analog gain ranges and nominal values are #defined in the source code here:
Tweaking these values and recompiling, could have the desired effect that you are looking for. Furthermore it appears that these controls are exported to the V4L2 interface, so perhaps you just need to find a utility that can read/write values to a V4L2 device… Anyway, the best advice I have is to read the driver source code, and see what is / isn’t implemented. It is really not that confusing and write well commented.
Best of luck!
Also check out the opencv file highgui/cvcap_libv4l.cpp, this defines functions that add/scan V4L2 controls. you should be able to control the two parameters exposure and analogue gain from there.
I was doing already looking into the driver code and opencv code. But surprisingly now I take pictures from opencv and write gain_val
to /sys/devices/platform/i2c_omap.2/i2c-2/2-0048/gain_val and it changes. Thanks
If you have any more trouble, I might be able to help.
Out of interest - what are you using OpenCV for?
Thanks for your offer. Actually I am working on ’ Multi view imaging based obstacle avoidance robot ’ using beagleboard. The main thing is this that I will not use any sonar or IR sensor.Its my final year project. I m doing electrical Engineering. Well the problem I am facing is this that I am using MT9P031 camera . I am not able to use opencv to change camera paramters using cvSetCaptureProperty() function like gain,brightness, image size etc. And I am in dire need of them. I am looking at driver code changed things a bit but uptill now I had not much success.Again thanks a lot for the offer.
If you send me an email I can probably help out with that.
Thanks again. My email address is email@example.com.