opencv: In Galaxy S21 and Android Version 12, VideoCapture::bool cv::VideoCapture::retrieve(Mat& image, int flag = 0) Crash erupt!
System information (version)
- OpenCV => ❔ 4.5.4
- Operating System / Platform => ❔ Android 12
- Compiler => ❔ mobile,
Detailed description
In Android version 12, I use
public boolean retrieve(Mat image, int flag) {
return retrieve_0(nativeObj, image.nativeObj, flag);
}
but it’s not working some video and don’t report about crash not any, just some, but I couldn’t find anything in common about video.
If anyone know about this situation, plz help me.
- add error log
A/libc: Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7618b94000 in tid 12291 (DefaultDispatch), pid 11392 (android package name)
E/DEBUG: failed to readlink /proc/12291/fd/150: No such file or directory
A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
A/DEBUG: Build fingerprint: 'samsung/o1sksx/o1s:12/SP1A.210812.016/G991NKSU3BUK9:user/release-keys'
A/DEBUG: Revision: '22'
A/DEBUG: ABI: 'arm64'
A/DEBUG: Timestamp: 2021-11-29 15:29:16.928785554+0900
A/DEBUG: Process uptime: 718s
A/DEBUG: Cmdline: kr.co.moais.golffix
A/DEBUG: pid: 11392, tid: 12291, name: DefaultDispatch >>> android package name <<<
A/DEBUG: uid: 10312
A/DEBUG: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7618b94000
A/DEBUG: x0 00000076522bb010 x1 0000000000000000 x2 0000000000000000 x3 0000007615281818
A/DEBUG: x4 0000000000129fbe x5 0000007615281790 x6 0000007613a75cb0 x7 0000007615281750
A/DEBUG: x8 0000000000000010 x9 0000000000000780 x10 0000000000000020 x11 b400007618a84210
A/DEBUG: x12 b400007618857ea0 x13 00000000000003b0 x14 b400007618a84970 x15 0000000000000410
A/DEBUG: x16 0000000000000412 x17 00000079fa638b4c x18 0000007613ba0000 x19 0000007615281710
A/DEBUG: x20 b400007618857ea0 x21 b400007618856820 x22 00000076522baf40 x23 00000076152817e0
A/DEBUG: x24 b400007618b93ff0 x25 00000076522bb010 x26 0000007615281970 x27 b400007618b147f0
A/DEBUG: x28 b400007618a841f0 x29 00000076152818c0
A/DEBUG: lr 0000007682d97d58 sp 00000076152816a0 pc 0000007682e92c88 pst 0000000080001000
Steps to reproduce
val videoCapture = VideoCapture(videoPath)
try {
while (videoCapture.isOpened){
val mat = Mat()
videoCapture.grab()
val isRetrieved = videoCapture.retrieve(mat)
if(isRetrieved){
val src = Bitmap.createBitmap(mat.cols(), mat.rows(), Bitmap.Config.ARGB_8888)
Utils.matToBitmap(mat, src)
//use src Bitmap
}
}
}catch (e:Exception){
//catch exception
Log.d("TAG_ERROR", "exception! : $e")
}finally {
videoCapture.release()
}
or
val videoCapture = VideoCapture(videoPath)
try {
while (videoCapture.isOpened){
val mat = Mat()
if(videoCapture.read(mat)){
val src = Bitmap.createBitmap(mat.cols(), mat.rows(), Bitmap.Config.ARGB_8888)
Utils.matToBitmap(mat, src)
//use src Bitmap
}
}
}catch (e:Exception){
//catch exception
Log.d("TAG_ERROR", "exception! : $e")
}finally {
videoCapture.release()
}
but both code not working same. Couldn’t catch exception .
Issue submission checklist
- I report the issue, it’s not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found solution
- I updated to latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (14 by maintainers)
Hill Climb Racing MOD APK 1.50.0 (Unlimited Money) for Android https://hillclimbracingmodapk.info/ Download Hill Climb MOD APK free and hack unlimited vehicles, fuel, and money. Show your driving and racing skills to the competitors.
Please try to add this patch on your side. Code above is just a proposal (may be inaccurate). (we can’t validate this case on our side because we don’t have such H/W or S/W environment configuration)
If it works for you, the feel free to prepare PR to 4.x branch.
Thank you for your comment!
but I apply patch version already, Opencv Version 4.5.4
and I don’t use camera, just use VideoCapture, so I can’t check line calls cvtColor in
.retrieveFrame()
Sorry