Ask Your Question

Android Native Camera Focus Mode With 2.4.3 & Samsung Galaxy S2

asked 2012-11-02 07:15:08 -0600

omarko gravatar image

updated 2012-11-06 15:28:09 -0600

Hi, I'm starting to use the native camera through ndk (c++) with the android, and whatever I set the focus mode to doesn't seem to work...

I can see the parameters patch has been added to cap_android.cpp (line 299+) but I cannot see any difference in the focus after applying the property. The code I am using is:

cv::VideoCapture capture(CV_CAP_ANDROID + 0);


Which must be working, as I have the flash light coming on.

Btw, I'm using a Samsung S2 and android 4.0.3.

Any pointers to how I can get this to work? Am I doing something wrong?

Also, whenever I set the properties, it resets the camera capture, is this normal?

Thanks in advance.


edit retag flag offensive close merge delete


Do you have a sample for accessing mobile Camera from NDK using opencv ? thank you

Mohamed Gad-Elrab gravatar imageMohamed Gad-Elrab ( 2012-12-27 12:04:05 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-11-09 02:33:27 -0600

  1. FOCUS_MODE_AUTO mode is designed to focus on demand on call of autoFocus() method of internal native camera class and the same method in Java. This feature is not yet implemented in Native camera. The only solution is to use Java camera class from standard Android framework.
  2. Yes, camera capture reset on parameters changing is normal.
edit flag offensive delete link more

Question Tools


Asked: 2012-11-02 07:15:08 -0600

Seen: 1,313 times

Last updated: Nov 09 '12