Can't access webcam OpenCV 3.3 Python 3 - opencv

OpenCV on Python 2.7 has no problem accessing my webcam. For some reason it can't in Python 3. VideoCapture::read always returns none...
I even tried compiling from source.
This is my cmake (I don't think I did anything wrong):
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D WITH_V4L=ON \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D PYTHON_EXECUTABLE3=/usr/bin/python3.6
-D PYTHON_EXECUTABLE2=/usr/bin/python2.7
-D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib64/python3.6/site-packages/numpy/core/include \
-D BUILD_EXAMPLES=ON ..
Has anything changed betwen implementations that could indicate whats causing my problems?
Edit:
As requested:
% python3.6 -c 'import cv2; print(cv2.getBuildInformation())'
General configuration for OpenCV 3.3.0
=====================================
Version control: 3.3.0
Extra modules:
Location (extra): /io/opencv_contrib/modules
Version control (extra): 3.3.0
Platform:
Timestamp: 2017-09-03T11:00:53Z
Host: Linux 4.4.0-83-generic x86_64
CMake: 3.9.0
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/gmake
Configuration: Release
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2
requested: SSE4_1 SSE4_2 AVX FP16 AVX2
SSE4_1 (2 files): + SSSE3 SSE4_1
SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (7 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
C/C++:
Built as dynamic libs?: NO
C++ Compiler: /opt/rh/devtoolset-2/root/usr/bin/c++ (ver 4.8.2)
C++ flags (Release): -fPIC -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fPIC -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /opt/rh/devtoolset-2/root/usr/bin/cc
C flags (Release): -fPIC -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 -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fPIC -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 -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
ccache: NO
Precompiled headers: YES
Extra dependencies: /opt/Qt4.8.7/lib/libQtGui.so /opt/Qt4.8.7/lib/libQtTest.so /opt/Qt4.8.7/lib/libQtCore.so /lib64/libz.so stdc++ dl m pthread rt
3rdparty dependencies: ittnotify libprotobuf libjpeg libwebp libpng libtiff libjasper IlmImf
OpenCV modules:
To be built: core flann imgproc ml objdetect phase_unwrapping photo plot reg surface_matching video xphoto bgsegm dnn face fuzzy img_hash imgcodecs shape videoio xobjdetect highgui superres bioinspired dpm features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching python3
Disabled: world contrib_world
Disabled by dependency: -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 ts viz cnn_3dobj cvv dnn_modern freetype hdf matlab sfm
GUI:
QT 4.x: YES (ver 4.8.7 EDITION = OpenSource)
QT OpenGL support: NO
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: /lib64/libz.so (ver 1.2.3)
JPEG: libjpeg (ver 90)
WEBP: build (ver encoder: 0x020e)
PNG: build (ver 1.6.24)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
GDAL: NO
GDCM: NO
Video I/O:
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: NO
avcodec: NO
avformat: NO
avutil: NO
swscale: NO
avresample: NO
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
OpenNI2: NO
PvAPI: NO
GigEVisionSDK: NO
Aravis SDK: NO
UniCap: NO
UniCap ucil: NO
V4L/V4L2: NO/NO
XIMEA: NO
Xine: NO
Intel Media SDK: NO
gPhoto2: NO
Parallel framework: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries:
Use Intel IPP: NO
Use Intel IPP IW: NO
Use Intel IPP Async: NO
Use VA: NO
Use Intel VA-API/OpenCL: NO
Use Lapack: NO
Use Eigen: NO
Use Cuda: NO
Use OpenCL: YES
Use OpenVX: NO
Use custom HAL: NO
OpenCL: <Dynamic loading of OpenCL library>
Include path: /io/opencv/3rdparty/include/opencl/1.2
Use AMDFFT: NO
Use AMDBLAS: NO
Python 2:
Interpreter: NO
Python 3:
Interpreter: python (ver 3.6.0)
Libraries:
numpy: /opt/python/cp36-cp36m/lib/python3.6/site-packages/numpy/core/include (ver 1.11.3)
packages path: /opt/python/cp36-cp36m/lib/python3.6/site-packages
Python (for build): python
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: Matlab not found or implicitly disabled
Tests and samples:
Tests: NO
Performance tests: NO
C/C++ Examples: NO
Install path: /usr/local
cvconfig.h is in: /io/opencv/build
-----------------------------------------------------------------

Followed this guide: https://www.scivision.co/anaconda-python-opencv3/
Removed all failed attempts with pip before installing.
Make sure that the commands you execute in the guide above use the version of python you are targeting. Either alias python to python36 or replace it in the commands.

Related

Problems on inference using GPU with OpenCV dnn and ONNX model

I am trying to inference on a Jetson Xavier with OpenCV dnn. I have converted a YOLOv5m model to .onnx format . Afterwards I attempt to run inference with the model using the following codes with optimizations for GPU using CUDA AND cuDNN:
net = cv2.dnn.readNetFromONNX(yolov5m.onnx)
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)
However in inference on Jetson Xavier with MAXN power mode, on a 1280 X 720 resolution video, my detections are very slow (approximately 109ms per frame). Using Jetson Power GUI I see that the usage of GPU is very low (on most frames less than 20% of GPU).
Also running the code without (cv2.dnn.DNN_BACKEND_CUDA)and setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA), which means defaulting to use of CPU, shows that CPU usage is very high on every frame of video. GPU usage then becomes minimal.
I have also compiled OpenCV for running with CUDA and cuDNN, using this Git.
OpenCV build information is as follows:
General configuration for OpenCV 4.6.0 =====================================
Version control: eb1afab-dirty
Extra modules:
Location (extra): /home/jetsonjane/master/JEP/script/workspace/opencv_contrib-4.6.0/modules
Version control (extra): eb1afab-dirty
Platform:
Timestamp: 2022-09-18T13:43:39Z
Host: Linux 5.10.65-tegra aarch64
CMake: 3.16.3
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: RELEASE
CPU/HW features:
Baseline: NEON FP16
C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: /usr/bin/c++ (ver 9.4.0)
C++ flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
C flags (Release): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
Linker flags (Debug): -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
ccache: NO
Precompiled headers: NO
Extra dependencies: m pthread cudart_static dl rt nppc nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda-11.4/lib64 -L/usr/lib/aarch64-linux-gnu
3rdparty dependencies:
OpenCV modules:
To be built: aruco barcode bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
Disabled: world
Disabled by dependency: -
Unavailable: alphamat cvv java julia matlab ovis sfm ts viz
Applications: apps
Documentation: NO
Non-free algorithms: NO
GUI: GTK2
GTK+: YES (ver 2.24.32)
GThread : YES (ver 2.64.6)
GtkGlExt: NO
VTK support: NO
Media I/O:
ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
WEBP: build (ver encoder: 0x020f)
PNG: /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.37)
TIFF: /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.1.0)
JPEG 2000: build (ver 2.4.0)
OpenEXR: /usr/lib/aarch64-linux-gnu/libImath.so /usr/lib/aarch64-linux-gnu/libIlmImf.so /usr/lib/aarch64-linux-gnu/libIex.so /usr/lib/aarch64-linux-gnu/libHalf.so /usr/lib/aarch64-linux-gnu/libIlmThread.so (ver 2_3)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: YES (2.2.5)
FFMPEG: YES
avcodec: YES (58.54.100)
avformat: YES (58.29.100)
avutil: YES (56.31.100)
swscale: YES (5.5.100)
avresample: YES (4.0.0)
GStreamer: YES (1.16.3)
v4l/v4l2: YES (linux/videodev2.h)
Parallel framework: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries:
Lapack: NO
Eigen: NO
Custom HAL: YES (carotene (ver 0.0.1))
Protobuf: build (3.19.1)
NVIDIA CUDA: YES (ver 11.4, CUFFT CUBLAS)
NVIDIA GPU arch: 72 87
NVIDIA PTX archs:
cuDNN: YES (ver 8.3.2)
OpenCL: YES (no extra features)
Include path: /home/jetsonjane/master/JEP/script/workspace/opencv-4.6.0/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.18)
Libraries: /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.18)
numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.16.5)
install path: lib/python2.7/dist-packages/cv2/python-2.7
Python 3:
Interpreter: /usr/bin/python3 (ver 3.8.10)
Libraries: /usr/lib/aarch64-linux-gnu/libpython3.8.so (ver 3.8.10)
numpy: /home/jetsonjane/.local/lib/python3.8/site-packages/numpy/core/include (ver 1.19.4)
install path: lib/python3.8/site-packages/cv2/python-3.8
Python (for build): /usr/bin/python2.7
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Install to: /usr/local
-----------------------------------------------------------------
Also during inference with the code I can see that 1 cuda device is recognized by the system:
count = cv2.cuda.getCudaEnabledDeviceCount()
print(count)
1
Are there any steps in configuration of CUDA,cuDNN,OpenCV that I am missing?
I would be thankful for any insights or solutions.

OpenCV VideoCapture failed to open a file, how to determine reason?

Using C++ OpenCV I was just trying to open a video file in Cygwin environment. For some reason file is not getting opened i.e. isOpened() is always false.
I checked for "ffmpeg -codecs" output within cygwin and it displays all available video codecs.
Video exists in the directory and I verified physically
Still unable to open the video file. To debug this issue can I see the error number that get set when videocapture fails to open the file.
#include <opencv2/opencv.hpp>
#include <iostream>
int main( int argc, char* argv[] ) {
//Tried with both namedWindow and without namedWindow command
//cv::namedWindow( "Video", cv::WINDOW_AUTOSIZE );
cv::VideoCapture capture( argv[1], cv::CAP_FFMPEG );
if (!capture.isOpened())
{
std::cout << "Unable to open the file " << argv[1] << std::endl;
**std::cout << "Reason for catpure fails is " << ???????**
exit(0);
}
std::cout << "Opened " << argv[1] << std::endl;
capture.release();
}
Note : I have not installed ffmpeg in cygwin environment. Instead I have ffmpeg in my Windows 10 and I had included the same in my Windows PATH environment. Within cygwin I am able to execute ffmpeg command
General configuration for OpenCV 3.4.1 =====================================
Version control: unknown
Platform:
Timestamp: 2021-01-19T11:33:15Z
Host: CYGWIN 3.1.7(0.340/5/3) x86_64
CMake: 3.17.3
CMake generator: Ninja
CMake build tool: /usr/bin/ninja.exe
Configuration: RelWithDebInfo
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_1 (3 files): + SSSE3 SSE4_1
SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_SKX
C/C++:
Built as dynamic libs?: YES
C++11: YES
C++ Compiler: /usr/bin/g++.exe (ver 10.2.0)
C++ flags (Release): -fpermissive -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 -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fpermissive -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 -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/gcc.exe
C flags (Release): -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/pub/devel/opencv/v3.4/opencv-3.4.1-3.x86_64/build=/usr/src/debug/opencv-3.4.1-3 -fdebug-prefix-map=/pub/devel/opencv/v3.4/opencv-3.4.1-3.x86_64/src/opencv-3.4.1=/usr/src/debug/opencv-3.4.1-3 -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 -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/pub/devel/opencv/v3.4/opencv-3.4.1-3.x86_64/build=/usr/src/debug/opencv-3.4.1-3 -fdebug-prefix-map=/pub/devel/opencv/v3.4/opencv-3.4.1-3.x86_64/src/opencv-3.4.1=/usr/src/debug/opencv-3.4.1-3 -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 -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
ccache: NO
Precompiled headers: NO
Extra dependencies: dl m pthread rt
3rdparty dependencies:
OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dpm face features2d flann freetype fuzzy hdf hfs highgui img_hash imgcodecs imgproc java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching tracking ts video videoio videostab ximgproc xobjdetect xphoto
Disabled: dnn js world
Disabled by dependency: dnn_objdetect text
Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv dnn_modern java matlab ovis sfm viz
Applications: tests apps
Documentation: NO
Non-free algorithms: NO
GUI:
GTK+: YES (ver 3.22.28)
GThread : YES (ver 2.54.3)
GtkGlExt: NO
VTK support: NO
Media I/O:
ZLib: /lib/libz.dll.a (ver 1.2.11)
JPEG: /lib/libjpeg.dll.a (ver )
WEBP: /lib/libwebp.dll.a (ver encoder: 0x020e)
PNG: /lib/libpng.dll.a (ver 1.6.37)
TIFF: /lib/libtiff.dll.a (ver 42 / 4.2.0)
JPEG 2000: /lib/libjasper.dll.a (ver 2.0.14)
OpenEXR: build (ver 1.7.1)
Video I/O:
GStreamer:
base: YES (ver 1.12.5)
video: YES (ver 1.12.5)
app: YES (ver 1.12.5)
riff: YES (ver 1.12.5)
pbutils: YES (ver 1.12.5)
gPhoto2: NO
Parallel framework: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries:
Lapack: NO
Eigen: YES (ver 3.3.9)
Custom HAL: NO
Protobuf: build (3.5.1)
NVIDIA CUDA: NO
OpenCL: YES (no extra features)
Include path: /usr/include/CL
Link libraries: Dynamic load
Python 2:
Interpreter: /usr/bin/python2.7.exe (ver 2.7.18)
Libraries: /lib/libpython2.7.dll.a (ver 2.7.18)
numpy: /usr/lib/python2.7/site-packages/numpy/core/include (ver 1.16.2)
packages path: lib/python2.7/site-packages
Python 3:
Interpreter: /usr/bin/python3 (ver 3.8.7)
Libraries: /lib/libpython3.8.dll.a (ver 3.8.7)
numpy: /usr/lib/python3.8/site-packages/numpy/core/include (ver 1.19.4)
packages path: lib/python3.8/site-packages
Python (for build): /usr/bin/python2.7.exe
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: NO
Install to: /usr
-----------------------------------------------------------------

CMake Error ...: DNN: CUDA backend requires CUDA Toolkit. Please resolve dependency or disable OPENCV_DNN_CUDA=OFF

Here is the error I am getting when I am compiling OpenCV on ubuntu 20.04 with cuda 10.1.
-- Detected processor: x86_64
CMake Warning at cmake/OpenCVUtils.cmake:721 (message):
Unexpected option: WITH_CUBLAS (=ON)
Condition: IF (WITH_CUDA)
Call Stack (most recent call first):
CMakeLists.txt:249 (OCV_OPTION)
CMake Warning at cmake/OpenCVUtils.cmake:721 (message):
Unexpected option: WITH_CUDNN (=ON)
Condition: IF (WITH_CUDA)
Call Stack (most recent call first):
CMakeLists.txt:252 (OCV_OPTION)
-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
-- Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1)
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
-- found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
-- at: /home/murat/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
-- found Intel IPP Integration Wrappers sources: 2020.0.0
-- at: /home/murat/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
-- A library with LAPACK API found.
-- OpenCV Python: during development append to PYTHONPATH: /home/murat/opencv/build/python_loader
-- Caffe: NO
-- Protobuf: NO
-- Glog: YES
-- freetype2: YES (ver 23.1.17)
-- harfbuzz: YES (ver 2.6.4)
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Julia not found. Not compiling Julia Bindings.
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.2
-- Checking SFM deps... TRUE
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
-- Checking for module 'tesseract'
-- No package 'tesseract' found
-- Tesseract: NO
-- Allocator metrics storage type: 'long long'
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
CMake Error at modules/dnn/CMakeLists.txt:35 (message):
DNN: CUDA backend requires CUDA Toolkit. Please resolve dependency or
disable OPENCV_DNN_CUDA=OFF
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /home/murat/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out cuda4dnn source code
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.2
-- Checking SFM deps... TRUE
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
--
-- General configuration for OpenCV 4.4.0 =====================================
-- Version control: unknown
--
-- Extra modules:
-- Location (extra): /home/murat/opencv_contrib/modules
-- Version control (extra): unknown
--
-- Platform:
-- Timestamp: 2021-02-18T12:05:50Z
-- Host: Linux 5.8.0-43-generic x86_64
-- CMake: 3.16.3
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
--
-- CPU/HW features:
-- Baseline: SSE SSE2 SSE3
-- requested: SSE3
-- Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
-- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
-- SSE4_1 (15 files): + SSSE3 SSE4_1
-- SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
-- FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
-- AVX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
-- AVX2 (29 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- AVX512_SKX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ standard: 11
-- C++ Compiler: /usr/bin/c++ (ver 9.3.0)
-- C++ flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed
-- Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: dl m pthread rt
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv java js julia matlab ovis python2 viz
-- Applications: perf_tests apps
-- Documentation: NO
-- Non-free algorithms: YES
--
-- GUI:
-- GTK+: YES (ver 3.24.20)
-- GThread : YES (ver 2.64.6)
-- GtkGlExt: NO
-- OpenGL support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: build (ver encoder: 0x020f)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
-- TIFF: build (ver 42 - 4.0.10)
-- JPEG 2000: build Jasper (ver 1.900.1)
-- OpenEXR: /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2_3)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: YES (2.2.5)
-- FFMPEG: YES
-- avcodec: YES (58.54.100)
-- avformat: YES (58.29.100)
-- avutil: YES (56.31.100)
-- swscale: YES (5.5.100)
-- avresample: YES (4.0.0)
-- GStreamer: YES (1.16.2)
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: TBB (ver 2020.2 interface 11102)
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Intel IPP: 2020.0.0 Gold [2020.0.0]
-- at: /home/murat/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
-- Intel IPP IW: sources (2020.0.0)
-- at: /home/murat/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
-- Lapack: NO
-- Eigen: YES (ver 3.3.7)
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
--
-- cuDNN: NO
--
-- OpenCL: YES (no extra features)
-- Include path: /home/murat/opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 3:
-- Interpreter: /usr/bin/python3 (ver 3.8.5)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython3.8.so (ver 3.8.5)
-- numpy: /home/murat/.local/lib/python3.8/site-packages/numpy/core/include (ver 1.18.5)
-- install path: lib/python3.8/dist-packages/cv2/python-3.8
--
-- Python (for build): /usr/bin/python3
--
-- Java:
-- ant: NO
-- JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include/linux /usr/lib/jvm/default-java/include
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring incomplete, errors occurred!
See also "/home/murat/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/home/murat/opencv/build/CMakeFiles/CMakeError.log".
Here are my cmake flags:
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules
-D BUILD_TIFF=ON
-D WITH_FFMPEG=ON
-D WITH_GSTREAMER=ON
-D WITH_TBB=ON
-D BUILD_TBB=ON
-D WITH_EIGEN=ON
-D WITH_V4L=ON
-D WITH_LIBV4L=ON
-D WITH_VTK=OFF
-D WITH_QT=OFF
-D WITH_OPENGL=ON
-D OPENCV_ENABLE_NONFREE=ON
-D INSTALL_C_EXAMPLES=OFF
-D INSTALL_PYTHON_EXAMPLES=OFF
-D BUILD_NEW_PYTHON_SUPPORT=ON
-D OPENCV_GENERATE_PKGCONFIG=ON
-D BUILD_TESTS=OFF
-D OPENCV_DNN_CUDA=ON
-D ENABLE_FAST_MATH=ON
-D CUDA_FAST_MATH=ON
-D CUDA_ARCH_BIN=7.0
-D WITH_CUBLAS=ON
-D WITH_CUDNN=ON
-D CUDNN_LIBRARY=/usr/lib/cuda/lib64/libcudnn.so.7.6.5
-D CUDNN_INCLUDE_DIR=/usr/lib/cuda/include
-D BUILD_EXAMPLES=OFF
-D PYTHON_DEFAULT_EXECUTABLE=$(which python3) ..
It works perfectly with the option -D OPENCV_DNN_CUDA=OFF. But I need CUDA libraries. My CUDA and CUDNN paths are correct, so I have no idea what is wrong with the cmake compilation. Did anyone face with a similar problem when installing opencv?
Note: I am following this link to finally install caffe.
$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
(Version OpenCV 4.5.3.) The OpenCV "DNN" module's cmake file opencv/modules/dnn/CMakeLists.txt is checking variable HAVE_CUDA, but this variable appears to never be set by a Performing Test by the time the DNN module is examined. Worse, at the beginning there's also a
CMake Warning at cmake/OpenCVUtils.cmake:758 (message):
Unexpected option: WITH_CUDNN (=ON)
message. CUDNN_FOUND appears to be set, but not finding HAVE_CUDA. Perhaps a name got changed.
The twelfth-hour night-before-demo workaround is to remove the dnn folder from the opencv/modules directory. This wipes out usage of downstream modules: barcode; dnn_objdetect; dnn_superres; mcc; text; and wechat_qrcode, but the system cmakes.
Specifying -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.4 may help but did not fix it. Note the system adds on /bin or also /bin64 to this internally, in order to verify the toolkit location based on nvcc or nvcc.exe at some point.
libcudnn.so is at the specified place, and does not seem to be the problem.
While things could be going wrong in a couple different directions, I believe there could be a flaw with the .deb archive file. It doesn't prepare a libcudnn.so where the OpenCV installation checks.
Because of this, I think it's necessary to use the generic Linux tarball installation. (https://developer.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.2_20191118/cudnn-10.2-linux-x64-v7.6.5.32.tgz)

Compiling OpenCV creates cuda error - recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o' failed

I'm trying to compile openCV but it doesn't seem to work somehow.
Is this a problem with cuda?
I am running this in a docker-container (nvidia-docker)
Hardware is a Jetson Nano with newest JetPack - Version
What could that problem be?
[ 32%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o
In file included from /opencv/modules/core/src/opengl.cpp:48:0:
/usr/local/cuda/include/cuda_gl_interop.h:63:2: error: #error Please include the appropriate gl headers before including cuda_gl_interop.h
#error Please include the appropriate gl headers before including cuda_gl_interop.h
^~~~~
[ 32%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/out.cpp.o
In file included from /opencv/modules/core/include/opencv2/core/private.cuda.hpp:73:0,
from /opencv/modules/core/src/precomp.hpp:56,
from /opencv/modules/core/src/opengl.cpp:43:
/opencv/modules/core/src/opengl.cpp: In function ‘void cv::cuda::setGlDevice(int)’:
/opencv/modules/core/src/opengl.cpp:118:47: warning: ‘cudaError_t cudaGLSetGLDevice(int)’ is deprecated [-Wdeprecated-declarations]
cudaSafeCall( cudaGLSetGLDevice(device) );
^
/opencv/modules/core/include/opencv2/core/cuda/common.hpp:74:58: note: in definition of macro ‘cudaSafeCall’
#define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, __FILE__, __LINE__, CV_Func)
^~~~
In file included from /opencv/modules/core/src/opengl.cpp:48:0:
/usr/local/cuda/include/cuda_gl_interop.h:305:57: note: declared here
extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLSetGLDevice(int device);
^~~~~~~~~~~~~~~~~
modules/core/CMakeFiles/opencv_core.dir/build.make:1368: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o' failed
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:2763: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
Some info:
General configuration for OpenCV 4.1.1 =====================================
-- Version control: unknown
--
-- Extra modules:
-- Location (extra): /opencv_contrib/modules
-- Version control (extra): unknown
--
-- Platform:
-- Timestamp: 2020-01-06T00:19:08Z
-- Host: Linux 4.9.140-tegra aarch64
-- CMake: 3.10.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
--
-- CPU/HW features:
-- Baseline: NEON FP16
-- required: NEON
-- disabled: VFPV3
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/bin/c++ (ver 7.4.0)
-- C++ flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -ffast-math -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 -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -ffast-math -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 -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--gc-sections
-- Linker flags (Debug): -Wl,--gc-sections
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: m pthread /usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so cudart_static -lpthread dl rt /usr/local/cuda/lib64/stubs/libcuda.so nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda/lib64 -L/usr/lib/aarch64-linux-gnu
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv datasets dnn dnn_objdetect dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: cnn_3dobj hdf java js matlab ovis python2 sfm ts viz
-- Applications: apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI:
-- QT: YES (ver 5.9.5)
-- QT OpenGL support: YES (Qt5::OpenGL 5.9.5)
-- GTK+: NO
-- OpenGL support: YES (/usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so)
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: build (ver encoder: 0x020e)
-- PNG: /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
-- TIFF: /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: build (ver 2.3.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: YES (2.2.5)
-- FFMPEG: YES
-- avcodec: YES (57.107.100)
-- avformat: YES (57.83.100)
-- avutil: YES (55.78.100)
-- swscale: YES (4.8.100)
-- avresample: NO
-- GStreamer: YES (1.14.5)
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: TBB (ver 2017.0 interface 9107)
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Lapack: NO
-- Eigen: YES (ver 3.3.4)
-- Custom HAL: YES (carotene (ver 0.0.1))
-- Protobuf: build (3.5.1)
--
-- NVIDIA CUDA: YES (ver 10.0, CUFFT CUBLAS FAST_MATH)
-- NVIDIA GPU arch: 53
-- NVIDIA PTX archs:
--
-- cuDNN: NO
--
-- OpenCL: YES (no extra features)
-- Include path: /opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 3:
-- Interpreter: /usr/bin/python3.6 (ver 3.6.9)
-- Libraries: /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
-- numpy: /usr/local/lib/python3.6/dist-packages/numpy/core/include (ver 1.18.0)
-- install path: lib/python3.6/dist-packages/cv2/python-3.6
--
-- Python (for build): /usr/bin/python3.6
--
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
I'd really appreciate some help, i couldn't find anything on the web sadly
Big thanks!
The solution was to use the nvidia-libraries.
So i took the lib-files from the JetPack download-folder
and used them
-worked!

Raspberry pi 3B OpenCV 3.4.1 Empty screen/frame

I am new to StackOverflow in that this is my first post. I am hoping that I am abiding by the rules as such and that I am not frustrating anyone with me double-posting an issue.
My problem is the following. I was able to compile and install OpenCV 3.4.1. on my Raspberry Pi 3B. The only problem I was not able to solve is that when I test the camera (by viewing the cam-feed through OpenCV) I get an empty frame. Rarely it does flicker, and show the actual camera feed.
I have a screenshot to show what I mean:
What you can also see is that when I make a image, by using the video.py script and pressing "enter", it does produce the correct image. When I move the frame around (with the cursor) it seems to be flickering more (revealing the actual camera feed more often) than usual. I have tried reinstalling NOOBS, recompiling and reinstalling more times than I can recall. What could the problem be? If I missed sharing relevant information, please let me know!
Thank you soooo much for your time!
Kind regards, Pieter
Edit: Here is the print-out when running opencv_version -v in the terminal
opencv_version -v
General configuration for OpenCV 3.4.1 =====================================
Version control: unknown
Platform:
Timestamp: 2018-09-29T19:02:09Z
Host: Linux 4.14.71-v7+ armv7l
CMake: 3.7.2
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: RELEASE
CPU/HW features:
Baseline:
requested: DETECT
disabled: VFPV3 NEON
C/C++:
Built as dynamic libs?: YES
C++11: YES
C++ Compiler: /usr/bin/c++ (ver 6.3.0)
C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/cc
C flags (Release): -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 -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -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 -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
ccache: NO
Precompiled headers: YES
Extra dependencies: dl m pthread rt
3rdparty dependencies:
OpenCV modules:
To be built: calib3d core dnn features2d flann highgui imgcodecs imgproc java_bindings_generator ml objdetect photo python3 python_bindings_generator shape stitching superres video videoio videostab
Disabled: js python2 world
Disabled by dependency: -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java ts viz
Applications: examples apps
Documentation: NO
Non-free algorithms: NO
GUI:
GTK+: YES (ver 2.24.31)
GThread : YES (ver 2.50.3)
GtkGlExt: NO
VTK support: NO
Media I/O:
ZLib: /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver )
WEBP: build (ver encoder: 0x020e)
PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.28)
TIFF: /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 / 4.0.8)
JPEG 2000: /usr/lib/arm-linux-gnueabihf/libjasper.so (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
Video I/O:
DC1394: NO
FFMPEG: YES
avcodec: YES (ver 57.64.101)
avformat: YES (ver 57.56.101)
avutil: YES (ver 55.34.101)
swscale: YES (ver 4.2.100)
avresample: NO
GStreamer: NO
libv4l/libv4l2: NO
v4l/v4l2: linux/videodev2.h
gPhoto2: NO
Parallel framework: pthreads
Trace: YES (built-in)
Other third-party libraries:
Lapack: NO
Eigen: NO
Custom HAL: YES (carotene (ver 0.0.1))
Protobuf: build (3.5.1)
OpenCL: YES (no extra features)
Include path: /home/pi/opencv-3.4.1/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python 3:
Interpreter: /usr/bin/python3 (ver 3.5.3)
Libraries: /usr/lib/arm-linux-gnueabihf/libpython3.5m.so (ver 3.5.3)
numpy: /home/pi/.local/lib/python3.5/site-packages/numpy/core/include (ver 1.15.2)
packages path: lib/python3.5/dist-packages
Python (for build): /usr/bin/python3
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: NO
Install to: /usr/local
-----------------------------------------------------------------

Resources