Ask Your Question

Revision history [back]

videoCapture::open doesn't see default camera

cv::VideoCapture cap(0);
(!cap.isOpened())
     return -1;

This always returns -1. I've included the results of cv::getBuildInformation(). Please help!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ General configuration for OpenCV 3.0.0 ===================================== Version control: unknown

Platform: Host: Linux 3.10.0-693.2.2.el7.x86_64 x86_64 CMake: 3.6.3 CMake generator: Unix Makefiles CMake build tool: /usr/bin/gmake Configuration: Release

C/C++: Built as dynamic libs?: YES C++ Compiler: /usr/bin/c++ (ver 4.8.5) 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 -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O2 -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 -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -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 -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O2 -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 -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG Linker flags (Release): Linker flags (Debug): Precompiled headers: YES Extra dependencies: Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent /lib64/libjpeg.so /lib64/libpng.so /lib64/libz.so /lib64/libtiff.so avcodec avformat avutil swscale avresample dl m pthread rt 3rdparty dependencies: libwebp libjasper IlmImf ippicv

OpenCV modules: To be built: hal core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d stitching videostab Disabled: world Disabled by dependency: - Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 viz

GUI: QT 5.x: YES (ver 5.8.0) QT OpenGL support: NO OpenGL support: NO VTK support: NO

Media I/O: ZLib: /lib64/libz.so (ver 1.2.7) JPEG: /lib64/libjpeg.so (ver ) WEBP: build (ver 0.3.1) PNG: /lib64/libpng.so (ver 1.5.13) TIFF: /lib64/libtiff.so (ver 42 - 4.0.3) JPEG 2000: build (ver 1.900.1) OpenEXR: build (ver 1.7.1) GDAL: NO

Video I/O: DC1394 1.x: NO DC1394 2.x: NO FFMPEG: YES codec: YES (ver 56.60.100) format: YES (ver 56.40.101) util: YES (ver 54.31.100) swscale: YES (ver 3.1.101) resample: YES (ver 2.1.0) gentoo-style: YES GStreamer: NO OpenNI: NO OpenNI PrimeSensor Modules: NO OpenNI2: NO PvAPI: NO GigEVisionSDK: NO UniCap: NO UniCap ucil: NO V4L/V4L2: NO/YES XIMEA: NO Xine: NO gPhoto2: NO

Other third-party libraries: Use IPP: 8.2.1 [8.2.1] at: /home/USER/OpenCVlibs/opencv-3.0.0/3rdparty/ippicv/unpack/ippicv_lnx Use IPP Async: NO Use Eigen: NO Use TBB: NO Use OpenMP: NO Use GCD NO Use Concurrency NO Use C=: NO Use pthreads for parallel for: YES Use Cuda: NO Use OpenCL: YES

OpenCL: Version: dynamic Include path: /home/USER/OpenCVlibs/opencv-3.0.0/3rdparty/include/opencl/1.2 Use AMDFFT: NO Use AMDBLAS: NO

Python 2: Interpreter: /usr/bin/python2.7 (ver 2.7.5)

Python 3: Interpreter: NO

Python (for build): /usr/bin/python2.7

Java: ant: NO JNI: NO Java wrappers: NO Java tests: NO

Matlab: mex: NO

Documentation: Doxygen: /usr/bin/doxygen (ver 1.8.5) PlantUML: NO

Tests and samples: Tests: YES Performance tests: YES C/C++ Examples: NO

Install path: /home/USER/OpenCVlibs/opencv-3.0.0/release

cvconfig.h is in: /home/USER/OpenCVlibs/opencv-3.0.0/build

click to hide/show revision 2
None

updated 2017-09-27 10:46:14 -0600

berak gravatar image

videoCapture::open doesn't see default camera

cv::VideoCapture cap(0); (!cap.isOpened()) return -1;

-1;

This always returns -1. I've included the results of cv::getBuildInformation(). Please help!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
General configuration for OpenCV 3.0.0 =====================================
  Version control:               unknown

unknown Platform: Host: Linux 3.10.0-693.2.2.el7.x86_64 x86_64 CMake: 3.6.3 CMake generator: Unix Makefiles CMake build tool: /usr/bin/gmake Configuration: Release

Release C/C++: Built as dynamic libs?: YES C++ Compiler: /usr/bin/c++ (ver 4.8.5) 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 -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O2 -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 -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -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 -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O2 -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 -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG Linker flags (Release): Linker flags (Debug): Precompiled headers: YES Extra dependencies: Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent /lib64/libjpeg.so /lib64/libpng.so /lib64/libz.so /lib64/libtiff.so avcodec avformat avutil swscale avresample dl m pthread rt 3rdparty dependencies: libwebp libjasper IlmImf ippicv

ippicv OpenCV modules: To be built: hal core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d stitching videostab Disabled: world Disabled by dependency: - Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 viz

viz GUI: QT 5.x: YES (ver 5.8.0) QT OpenGL support: NO OpenGL support: NO VTK support: NO

NO Media I/O: ZLib: /lib64/libz.so (ver 1.2.7) JPEG: /lib64/libjpeg.so (ver ) WEBP: build (ver 0.3.1) PNG: /lib64/libpng.so (ver 1.5.13) TIFF: /lib64/libtiff.so (ver 42 - 4.0.3) JPEG 2000: build (ver 1.900.1) OpenEXR: build (ver 1.7.1) GDAL: NO

NO Video I/O: DC1394 1.x: NO DC1394 2.x: NO FFMPEG: YES codec: YES (ver 56.60.100) format: YES (ver 56.40.101) util: YES (ver 54.31.100) swscale: YES (ver 3.1.101) resample: YES (ver 2.1.0) gentoo-style: YES GStreamer: NO OpenNI: NO OpenNI PrimeSensor Modules: NO OpenNI2: NO PvAPI: NO GigEVisionSDK: NO UniCap: NO UniCap ucil: NO V4L/V4L2: NO/YES XIMEA: NO Xine: NO gPhoto2: NO

NO Other third-party libraries: Use IPP: 8.2.1 [8.2.1] at: /home/USER/OpenCVlibs/opencv-3.0.0/3rdparty/ippicv/unpack/ippicv_lnx Use IPP Async: NO Use Eigen: NO Use TBB: NO Use OpenMP: NO Use GCD NO Use Concurrency NO Use C=: NO Use pthreads for parallel for: YES Use Cuda: NO Use OpenCL: YES

YES OpenCL: Version: dynamic Include path: /home/USER/OpenCVlibs/opencv-3.0.0/3rdparty/include/opencl/1.2 Use AMDFFT: NO Use AMDBLAS: NO

NO Python 2: Interpreter: /usr/bin/python2.7 (ver 2.7.5)

2.7.5) Python 3: Interpreter: NO

NO Python (for build): /usr/bin/python2.7

/usr/bin/python2.7 Java: ant: NO JNI: NO Java wrappers: NO Java tests: NO

NO Matlab: mex: NO

NO Documentation: Doxygen: /usr/bin/doxygen (ver 1.8.5) PlantUML: NO

NO Tests and samples: Tests: YES Performance tests: YES C/C++ Examples: NO

NO Install path: /home/USER/OpenCVlibs/opencv-3.0.0/release

/home/USER/OpenCVlibs/opencv-3.0.0/release cvconfig.h is in: /home/USER/OpenCVlibs/opencv-3.0.0/build

/home/USER/OpenCVlibs/opencv-3.0.0/build -----------------------------------------------------------------