While i’ve been using OpenCV to get images from my android device’s camera and doing some processing with them for a research, I couldn’t get it to turn on the flash for an important task.
I am currently using for the camera:
mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.opencv_surface_view);
mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
mOpenCvCameraView.setCvCameraViewListener(cvCameraViewListener);
And the only way I got the flash to actually turn on is using Camera manager, outside of OpenCV, however it turns off as soon as OpenCV starts to use the camera:
private void turnFlashlightOn() {
CameraManager cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
try {
String cameraId = cameraManager.getCameraIdList()[0];
if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) {
cameraManager.setTorchMode(cameraId, true);
}
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
So I’d like some advice on how to get the flash to turn on via OpenCV that actually works, or if I should move the entire part of getting the frames to another library?