OpenCV Native Camera View on Android 5.0 does not work

I am working on an Android OpenCV based application. I cannot start NativeCameraView on my MotoG after updating 5.0 lollipop. JavaCameraView is still working.

In my program, I need to use VideoCapture ( http://docs.opencv.org/java/2.4.2/index.html?org/opencv/highgui/VideoCapture.html ) in my program. I do not know how to switch to the JavaCameraView source in VideoCapture. [Only NativeCamera works great for my application. Using JavaCameraView is just a temporary solution I'm looking for]

So my question is: is this an OpenCV bug to fix my own camera for 5.0? I did not find anyone who would raise such a problem. When will this be fixed?

02-06 13: 30: 52.794: E / OpenCV :: camera (31745): CameraWrapperConnector :: connectToLib ERROR: cannot dlopen camera wrapper library 02-06 13: 30: 52.794: E / OpenCV :: camera (31745): Native_camera returned an opening error: 4

+4
source share
1 answer

The problem is resolved. Copy the following code into the onCreate () method. The problem will be solved.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
   if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
     requestPermissions(new String[]{Manifest.permission.CAMERA}, 1);
}
-1
source

All Articles