Ask Your Question
0

How to use camera flash in NativeCameraView android

asked 2013-08-13 04:37:06 -0500

ajevajev gravatar image

updated 2013-08-13 05:33:34 -0500

I have to turn on camera flash using openCV. I need to use NativeCameraView but it doesn't work.

What can I do?

I tried :

VideoCapture mCamera;
mCamera.set(Highgui.CV_CAP_PROP_ANDROID_FLASH_MODE, Highgui.CV_CAP_ANDROID_FLASH_MODE_ON);
edit retag flag offensive close merge delete

Comments

Please, in the future, try to focus on using tags without the hashtags. These hashtags create tons of double tags, which is not interesting if you want to apply filtering on topics. I have removed them and formatted your code a bit more correctly.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-13 04:46:54 -0500 )edit
1

thank you

ajevajev gravatar imageajevajev ( 2013-08-13 04:47:59 -0500 )edit

Maybe try

 mCamera.set(Highgui.CV_CAP_PROP_ANDROID_FLASH_MODE,
 Highhui.CV_CAP_ANDROID_FLASH_MODE_ON);

I dont know if its just a typo, but you try to set the focus, not flash mode

Moster gravatar imageMoster ( 2013-08-13 04:54:17 -0500 )edit

i tried flash_mote too

ajevajev gravatar imageajevajev ( 2013-08-13 05:04:37 -0500 )edit

What are you actually trying to do? Do you want to use it like a flashlight or as a real flash?

Moster gravatar imageMoster ( 2013-08-13 06:03:39 -0500 )edit

as a real flash

ajevajev gravatar imageajevajev ( 2013-08-13 06:05:23 -0500 )edit
2

I think the problem is that VideoCapture actually has no real photo functionality. Its just a camera/video stream and you have the possibility to retrieve a frame from it, but you actually dont take a real picture. So the flash wont work. At least this is how I imagine it.

Moster gravatar imageMoster ( 2013-08-13 06:18:53 -0500 )edit
1

In my app I do videos. I have to keep the flash on during the recording of the video.

ajevajev gravatar imageajevajev ( 2013-08-13 06:24:40 -0500 )edit
3

mCamera.set(Highgui.CV_CAP_PROP_ANDROID_FLASH_MODE, Highhui.CV_CAP_ANDROID_FLASH_MODE_TORCH);

this worked for me

Moster gravatar imageMoster ( 2013-08-13 06:36:04 -0500 )edit
1

it works. thank you

ajevajev gravatar imageajevajev ( 2013-08-13 06:50:13 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-08-13 07:21:37 -0500

Moster gravatar image

updated 2013-08-13 07:42:52 -0500

The solution is to use FLASH_MODE_TORCH and not FLASH_MODE_ON

mCamera.set(Highgui.CV_CAP_PROP_ANDROID_FLASH_MODE, Highhui.CV_CAP_ANDROID_FLASH_MODE_TORCH);

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-08-13 04:37:06 -0500

Seen: 1,603 times

Last updated: Aug 13 '13