Ask Your Question
0

Why previous version OpenCV sample freezes with a black screen after update form 3.4.3 to 4.1.1?

asked 2019-09-11 18:50:21 -0600

AndreaF gravatar image

I have updated OpenCV module dependencies from 3.4.3 to 4.1.1 and blob color detection sample that works correctly with previous version now freezes with a black screen. I know, I can just use the newer sample code, but I want to understand why a very simple code sample that compiles correctly and works without any problem with the previous version now has this weird problem.

Watching the log isn't clear the cause of the issue seems that native libs loads correctly and then crashes.

The OpenCV log is:

2019-09-12 00:49:16.633 2080-5773/? I/ActivityTaskManager: START u0 {cmp=com.mysite.myapp/.OpenCVTestActivity} from uid 10188
I/MainActivity: Instantiated new class com.mysite.myapp.OpenCVTestActivity
D/OpenCV/StaticHelper: Trying to get library list
E/OpenCV/StaticHelper: OpenCV error: Cannot load info library for OpenCV
D/OpenCV/StaticHelper: Library list: ""
D/OpenCV/StaticHelper: First attempt to load libs
D/OpenCV/StaticHelper: Trying to init OpenCV libs
D/OpenCV/StaticHelper: Trying to load library opencv_java4
D/OpenCV/StaticHelper: Library opencv_java4 loaded
D/OpenCV/StaticHelper: First attempt to load libs is OK
I/OpenCV/StaticHelper: General configuration for OpenCV 4.1.1 =====================================
I/OpenCV/StaticHelper:   Version control:               4.1.1
I/OpenCV/StaticHelper:   Platform:
I/OpenCV/StaticHelper:     Timestamp:                   2019-07-26T03:58:21Z
I/OpenCV/StaticHelper:     Host:                        Linux 4.15.0-54-generic x86_64
I/OpenCV/StaticHelper:     Target:                      Android 1 x86_64
I/OpenCV/StaticHelper:     CMake:                       3.6.0-rc2
I/OpenCV/StaticHelper:     CMake generator:             Ninja
I/OpenCV/StaticHelper:     CMake build tool:            /opt/android/android-sdk.gradle/cmake/3.6.4111459/bin/ninja
I/OpenCV/StaticHelper:     Configuration:               Release
I/OpenCV/StaticHelper:   CPU/HW features:
I/OpenCV/StaticHelper:     Baseline:                    SSE SSE2 SSE3
I/OpenCV/StaticHelper:       requested:                 SSE3
I/OpenCV/StaticHelper:     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
I/OpenCV/StaticHelper:       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
I/OpenCV/StaticHelper:       SSE4_1 (12 files):         + SSSE3 SSE4_1
I/OpenCV/StaticHelper:       SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
I/OpenCV/StaticHelper:       FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
I/OpenCV/StaticHelper:       AVX (4 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
I/OpenCV/StaticHelper:       AVX2 (26 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
I/OpenCV/StaticHelper:       AVX512_SKX (2 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
I/OpenCV/StaticHelper:   C/C++:
I/OpenCV/StaticHelper:     Built as dynamic libs?:      NO
I/OpenCV/StaticHelper:     C++ Compiler:                /opt/android/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  (ver 7.0)
I/OpenCV/StaticHelper:     C++ flags (Release):         -isystem /opt/android/android-ndk-r18b/sysroot/usr/include/x86_64-linux-android -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden  -O2 -DNDEBUG   -DNDEBUG
I/OpenCV/StaticHelper:     C++ flags (Debug):           -isystem /opt/android/android-ndk-r18b/sysroot/usr/include/x86_64-linux-android -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11    -fsigned-char ...
(more)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-10-22 17:41:14 -0600

MauroNRa gravatar image

I experienced this upgrading from 4.1.0 to 4.1+ the problem was in our project we were not using the CameraActivity.java class provided but an implementation of CameraBridgeViewBase

Before and in 4.1.0 CameraBridgeViewBase asks in method checkCurrentState() for 3 conditions which must be true in order to give preview.

For latter versions 4.1+ it asks for an additional flag mCameraPermissionGranted to be also be true.

If you check the samples you will find all Activities extend CameraActivity that sets this flag true with cameraBridgeViewBase.setCameraPermissionGranted()

So afer putting that line in our code the preview started showing again.

Hope it can help, if it's not too late.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-09-11 18:50:21 -0600

Seen: 696 times

Last updated: Sep 11 '19