Setting camera flash mode causes a segfault (Bug #1989)


Added by Harshad RJ almost 13 years ago. Updated almost 13 years ago.


Status:Done Start date:2012-05-26
Priority:Normal Due date:
Assignee:Alexander Smorkalov % Done:

0%

Category:android
Target version:2.4.1
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

In OpenCV for Android 2.4, there is an option to set the flash mode for the native camera.

I tried to do this with the following code:

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

However, this causes a segfault on my Asus Transformer TF101 running ICS:
Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)

At the beginning one of the log messages says:
[OpenCV_NativeCamera] Supported Flash Modes: null

I would suggest the following:
  1. Have a way to query flash modes programmatically.
  2. Address the SIGSEGV case in native code when no flash mode is supported.
  3. Detect flash modes correctly on Asus TF101.

In this patch:
http://code.opencv.org/attachments/663/android-native-cam-properties.patch

I can see that there is already a check whether a flash mode is supported in line 644, but it doesn't handle the case when supported_modes is null.


Associated revisions

Revision 6903e8f0
Added by Alexander Smorkalov almost 13 years ago

Bug #1989 fixed. NULL pointer check added.

Revision 8c50f3e8
Added by Alexander Smorkalov almost 13 years ago

Native camera libs rebuilt for bug #1989 fix.

History

Updated by Andrey Pavlenko almost 13 years ago

  • Target version set to 2.4.1
  • Assignee changed from Andrey Pavlenko to Alexander Smorkalov

Updated by Alexander Smorkalov almost 13 years ago

Problem was not reproduced on available devices. Fixed at revision #8499. NULL pointers check added.
OpenCV native camera uses video capture mode on Android. It means, that you cannot use flash for single image.

Updated by Alexander Smorkalov almost 13 years ago

  • Status changed from Open to Done

Also available in: Atom PDF