How to fix the issue about cvCreateCameraCapture
I have built opencv(with ffmpeg) for android arm64-v8a successfully, however, cvCreateCameraCapture return null. cvCreateFileCapture work well. I found we need to set the following item for support camera. -DWITH_V4L=1 -DHAVE_CAMV4L2=ON
Now, v4l have been built in opencv, however, the following interface in cap_libv4l.cpp can not open device successfully.
static void icvInitCapture_V4L() {
...
deviceHandle = open(deviceName, O_RDONLY);
...
}
That open function failed because of permission denied.
I think my android app don't have related permission. However, i add the following setting in AndroidManifest.xml.
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
And opencv functions are called in a thread in my app. My app is a service for android.
How to fix the permission issue for my app?
Any idea?
Change my app to system app?
Update 2018/12/27.
I found that deviceName is /dev/video*. So I checked the permission of those video in path /dev as below,
1|gts4lltechn:/dev $ ls -l | grep video
ls: ./event-log-tags: Permission denied
crw-rw---- 1 system camera 81, 0 2017-04-01 08:37 video0
crw-rw---- 1 system camera 81, 1 2017-04-01 08:37 video1
crw-rw---- 1 system camera 81, 2 2017-04-01 08:37 video2
crw-rw---- 1 system camera 81, 3 2017-04-01 08:37 video3
crw-rw---- 1 system camera 81, 32 2017-04-01 08:37 video32
crw-rw---- 1 system camera 81, 33 2017-04-01 08:37 video33
crw-rw---- 1 system camera 81, 4 2017-04-01 08:37 video4
crw-rw---- 1 system camera 81, 5 2017-04-01 08:37 video5
crw-rw---- 1 system camera 81, 6 2018-12-20 21:28 video6
And my app's permission is as below,
u0_a191 20375 995 4406488 82904 0 0 S xxx.xxx.xxx+
I don't have su permission, how to fix the issue?
those c-api functions are no more supported / maintained. please try again using
cv::VideoCapture
for bothcv::VideoCapture is implented by those c-api functions, so those c-api functions still work. I do not want to modify source code for processing image, so i would like to use those c-api functions.
Thanks for your reply.
I would like to add all necessary dependency to my project. So what dependency is lost?so that videoio.h is not found.
Update latest status
btw:
not true.
Ohh, if i use cv::VideoCapture, the same issue may occur.
target platform have no su, and no root.