Ask Your Question
1

OpenCV and Android NDK - setting camera Exposure

asked 2013-03-01 02:35:03 -0500

Drag0 gravatar image

Hi, I'm having problems setting camera propertie EXPOSURE..

This is my code:

vt1->capture = cvCaptureFromCAM( CV_CAP_ANDROID + vt1->cam_device); cvSetCaptureProperty(vt1->capture, CV_CAP_PROP_EXPOSURE, -2);

but if I print out camera EXPOSURE like this:

LOGI("EXPOSURE = %d", cvGetCaptureProperty(vt1->capture, CV_CAP_PROP_EXPOSURE));

it doesn't give me "-2", it gives me "0". Is it possible that camera manufacturer made it impossible to change exposure settings? It is possible to change exposure from built-in camera application, but I can't do it through OpenCV. Device is HTC ONE X

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-03-01 04:01:15 -0500

Android uses its own camera access stack and its own camera capabilities that depends from device. VideoCapture class supports some of them (listed bellow), but its support is contributed by 3rd party developed and is sill on experimental state.

Constants for Android camera properties from opencv2/highgui/highgui_c.h file:

// Properties for Android cameras
CV_CAP_PROP_ANDROID_FLASH_MODE = 8001,
CV_CAP_PROP_ANDROID_FOCUS_MODE = 8002,
CV_CAP_PROP_ANDROID_WHITE_BALANCE = 8003,
CV_CAP_PROP_ANDROID_ANTIBANDING = 8004,
CV_CAP_PROP_ANDROID_FOCAL_LENGTH = 8005,
CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR = 8006,
CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_OPTIMAL = 8007,
CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR = 8008,

You can add exposure correction to VideoCapture class and contribute it to OpenCV via Gtihub pull request or alternatively use Java Camera. See Tutorial3-Camera Control sample, as an example of direct camera control.

edit flag offensive delete link more
1

answered 2013-03-01 03:45:07 -0500

rics gravatar image

I assume that the Java wrapper has the same functionality as the native code.

Given that and according to Java API documentation you can only set the width and height properties of the capture. Description of get states that

When querying a property that is not supported by the backend used by the "VideoCapture" class, value 0 is returned.

The same sentence can be found at the C++ documentation of get.

From the above I think that you cannot set the exposure.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-03-01 02:35:03 -0500

Seen: 2,545 times

Last updated: Mar 01 '13