use the camera flash with openCV library

asked 2014-01-18 01:12:43 -0600

I have to turn the flash on using openCV. I have tried:

VideoCapture mCamera;
                mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID);
                mCamera.set(Highgui.CV_CAP_PROP_ANDROID_FLASH_MODE, Highgui.CV_CAP_ANDROID_FLASH_MODE_TORCH);

There are no errors, but the flash does not turn on. Thank you in advance for your help.

edit retag flag offensive close merge delete

Comments

Are you also using this on an android device? I just want to make sure you are not using this on a normal camera

Moster gravatar imageMoster ( 2014-01-18 03:36:38 -0600 )edit

Yes I'm using this on an android device. I try:

 if(mCamera.isOpened()) Context context;        
 context = getApplicationContext();
 Toast.makeText(context, "Przycisk dziaƂa!", Toast.LENGTH_LONG).show();

but do not show toast

mariusz8801 gravatar imagemariusz8801 ( 2014-01-18 03:46:46 -0600 )edit

And when I try if(mCamera != null) show toast

mariusz8801 gravatar imagemariusz8801 ( 2014-01-18 04:25:39 -0600 )edit

Try my java camera class that I created back then: http://answers.opencv.org/question/19796/android-use-autofocus-with-camerabridgeviewbase/ It tells you if a certain function does not work

Moster gravatar imageMoster ( 2014-01-18 05:11:51 -0600 )edit

thanks but i don't now why i'm use this class i my project. I would like to know why mCamera.isOpened() is not

mariusz8801 gravatar imagemariusz8801 ( 2014-01-18 05:33:50 -0600 )edit
2

You shouldnt use this class in your project, just check out if the torch mode actually works and if you can even get the camera to work

Moster gravatar imageMoster ( 2014-01-19 14:19:35 -0600 )edit