Can';t访问网络摄像头OpenCV 3.3 Python 3
Python2.7上的OpenCV访问我的网络摄像头没有问题。由于某些原因,它不能在Python3中使用。VideoCapture::read始终返回none 我甚至试着从源代码编译 这是我的cmake(我不认为我做错了什么): 是否有任何改变之间的实现,可能表明什么原因导致我的问题 编辑: 应要求:Can';t访问网络摄像头OpenCV 3.3 Python 3,opencv,webcam,python-3.6,opencv3.3,Opencv,Webcam,Python 3.6,Opencv3.3,Python2.7上的OpenCV访问我的网络摄像头没有问题。由于某些原因,它不能在Python3中使用。VideoCapture::read始终返回none 我甚至试着从源代码编译 这是我的cmake(我不认为我做错了什么): 是否有任何改变之间的实现,可能表明什么原因导致我的问题 编辑: 应要求: % python3.6 -c 'import cv2; print(cv2.getBuildInformation())' General configuration for OpenCV 3.
% 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
-----------------------------------------------------------------
%python3.6-c'导入cv2;打印(cv2.getBuildInformation())'
OpenCV 3.3.0的一般配置
=====================================
版本控制:3.3.0
额外模块:
位置(额外):/io/opencv\u配置/模块
版本控制(额外):3.3.0
站台:
时间戳:2017-09-03T11:00:53Z
主机:Linux 4.4.0-83-generic x86_64
CMake:3.9.0
CMake生成器:Unix生成文件
CMake构建工具:/usr/bin/gmake
配置:发布
CPU/HW功能:
基线:SSE2 SSE3
请求:SSE3
调度代码生成:SSE4_1 SSE4_2 FP16 AVX AVX2
请求:SSE4_1 SSE4_2 AVX FP16 AVX2
SSE4_1(2个文件):+SSSE3 SSE4_1
SSE4_2(1个文件):+SSSE3 SSE4_1 POPCNT SSE4_2
FP16(1个文件):+SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX(5个文件):+SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2(7个文件):+SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
C/C++:
构建为动态库?:否
C++编译器:/opt/rh /DeVooToSt2/2/root/Ur/bin/C++(VE4.4.2)
C++标志(发布):-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-wing-Wno-Wno delete-non-virtual dtor-Wno comment-fdiagnostics show选项-Wno long long-pthread-fomit frame pointer-ffunction sections-msse-msse2-msse3-fvisibility=hidden-fvisibility inlines hidden-O3-DNDEBUG-DNDEBUG
C++标志(调试):-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-win-Wno-wro-delete non-virtual dtor-Wno-Wno comment-fdiagnostics show option-Wno long long-pthread-fomit frame pointer-fffunction sections-msse-msse2-msse3-fvisibility=hidden-fvisibility inlines hidden-g-O0-DDEBUG-D_DEBUG
C编译器:/opt/rh/devtoolset-2/root/usr/bin/cc
C标志(发布):-fPIC-fsigned char-W-Wall-Werror=return type-Werror=non-virtual dtor-Werror=address-Werror=sequence point-Wformat-Werror=format-security-Wmissing声明-Wmissing原型-Wstrict原型-Wundef-Winit self-Wpointer arith-Wshadow-Wuninitialized-Winit self-Wno窄化-Wno注释-fdiagnostics show option-Wno long long-pthread-fomit frame pointer-fffunction sections-msse-msse2-msse3-fvisibility=hidden-O3-DNDEBUG-DNDEBUG
C标志(调试):-fPIC-fsigned char-W-Wall-Werror=return type-Werror=non-virtual dtor-Werror=address-Werror=sequence point-Wformat-Werror=format-security-Wmissing声明-Wmissing原型-Wstrict原型-Wundef-Winit self-Wpointer arith-Wshadow-Wuninitialized-Winit self-Wno窄化-Wno注释-fdiagnostics show option-Wno long long-pthread-fomit frame pointer-fffunction sections-msse-msse2-msse3-fvisibility=hidden-g-O0-DDEBUG-D_DEBUG
链接器标志(发布):
链接器标志(调试):
卡切:没有
预编译头:是
额外依赖项:/opt/Qt4.8.7/lib/libQtGui.so/opt/Qt4.8.7/lib/libqtest.so/opt/Qt4.8.7/lib/libQtCore.so/lib64/libz.so stdc++dl m pthread rt
第三方依赖项:ittnotify libprotobuf libjpeg libwebp libpng libtiff libjasper IlmImf
OpenCV模块:
待构建:核心法兰imgproc ml objdetect相位解包裹照片打印reg曲面匹配视频xphoto bgsegm dnn人脸模糊img哈希img码形状视频IO xobjdetect highgui超级生物灵感dpm功能2D线条描述符显著性文本校准ccalib数据集rgbd立体结构光跟踪视频稳定X功能2Dximgproc aruco optflow缝合蟒蛇3
残疾人:世界贡献者世界
由依赖项禁用:-
不可用:cudaarithm cudabgsegm cudacodec CUDAFACTURES2D cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 ts即cnn\u 3dobj cvv dnn\u现代自由式hdf matlab sfm
图形用户界面:
Qt4.x:是(版本4.8.7=开源)
QT OpenGL支持:否
OpenGL支持:否
VTK支持:否
媒体输入/输出:
ZLib:/lib64/libz.so(1.2.3版)
JPEG:libjpeg(90版)
WEBP:生成(版本编码器:0x020e)
PNG:build(版本1.6.24)
TIFF:构建(版本42-4.0.2)
JPEG 2000:内部版本(1.900.1版)
OpenEXR:build(版本1.7.1)
格达尔:没有
GDCM:没有
视频输入/输出:
DC1394 1.x:否
DC1394 2.x:否
FFMPEG:没有
编解码器:没有
格式:否
avutil:没有
swscale:没有
avresample:没有
GStreamer:没有
OpenNI:
% 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
-----------------------------------------------------------------