python title 和capitiliaze_python - cap.isOpened():针对Python 3和OpenCV 3.1.0在CentOS中返回false - 堆栈内存溢出...

因此,opencv 3中的cap在CentOS中不起作用。 我在最初尝试的OSX或Windows 7中没有问题。 这是示例代码:

import cv2

cap = cv2.VideoCapture('/home/grad3/jalal/PycharmProjects/hw4_cs58‌​5/Concession_LAN_8‌​‌​00‌​k.mp4',cv2.CAP_FFMPEG)

if not cap.isOpened():

print('not opened')

while True:

ret,frame = cap.read()

if ret == False:

print('frame empty')

break

cv2.imshow('frame', frame)

if cv2.waitKey(1) == ord('q'):

break

我得到:

/usr/local/anaconda3/bin/python /home/grad3/jalal/PycharmProjects/hw4_cs585/test.py

not opened

frame empty

Process finished with exit code 0

我有opencv 3.1.0,这是一些系统信息。

$ uname -a

Linux goku.bu.edu 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a

LSB Version: :core-4.1-amd64:core-4.1-noarch

Distributor ID: CentOS

Description: CentOS Linux release 7.4.1708 (Core)

Release: 7.4.1708

Codename: Core

cv2. getBuildInformation()

General configuration for OpenCV 3.1.0 =====================================

Version control: unknown

Platform:

Host: Linux 4.8.0-46-generic 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: /opt/rh/devtoolset-2/root/usr/bin/c++ (ver 4.8.2)

C++ flags (Release): -I/cs/software/anaconda3/include -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 -fopenmp -O3 -DNDEBUG -DNDEBUG

C++ flags (Debug): -I/cs/software/anaconda3/include -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 -fopenmp -g -O0 -DDEBUG -D_DEBUG

C Compiler: /opt/rh/devtoolset-2/root/usr/bin/cc

C flags (Release): -I/cs/software/anaconda3/include -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 -fopenmp -O3 -DNDEBUG -DNDEBUG

C flags (Debug): -I/cs/software/anaconda3/include -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 -fopenmp -g -O0 -DDEBUG -D_DEBUG

Linker flags (Release):

Linker flags (Debug):

Precompiled headers: YES

Extra dependencies: /cs/software/anaconda3/lib/libjpeg.so /cs/software/anaconda3/lib/libpng.so /cs/software/anaconda3/lib/libtiff.so /cs/software/anaconda3/lib/libhdf5.so /usr/lib64/librt.so /usr/lib64/libpthread.so /cs/software/anaconda3/lib/libz.so /usr/lib64/libdl.so /usr/lib64/libm.so dl m pthread rt

3rdparty dependencies: libwebp libjasper IlmImf libprotobuf

OpenCV modules:

To be built: core flann hdf imgproc ml photo reg surface_matching video dnn fuzzy imgcodecs shape videoio highgui objdetect plot superres xobjdetect xphoto bgsegm bioinspired dpm face 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 cvv matlab sfm

GUI:

QT: NO

GTK+: NO

GThread : NO

GtkGlExt: NO

OpenGL support: NO

VTK support: NO

Media I/O:

ZLib: /cs/software/anaconda3/lib/libz.so (ver 1.2.8)

JPEG: /cs/software/anaconda3/lib/libjpeg.so (ver 80)

WEBP: build (ver 0.3.1)

PNG: /cs/software/anaconda3/lib/libpng.so (ver 1.6.27)

TIFF: /cs/software/anaconda3/lib/libtiff.so (ver 42 - 4.0.6)

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: NO

codec: NO

format: NO

util: NO

swscale: NO

resample: NO

gentoo-style: NO

GStreamer: NO

OpenNI: NO

OpenNI PrimeSensor Modules: NO

OpenNI2: NO

PvAPI: NO

GigEVisionSDK: NO

UniCap: NO

UniCap ucil: NO

V4L/V4L2: YES/YES

XIMEA: NO

Xine: NO

gPhoto2: NO

Parallel framework: OpenMP

Other third-party libraries:

Use IPP: 9.0.1 [9.0.1]

at: /opt/conda/conda-bld/opencv_1491943704081/work/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx

Use IPP Async: NO

Use VA: NO

Use Intel VA-API/OpenCL: NO

Use Eigen: YES (ver 3.2.8)

Use Cuda: NO

Use OpenCL: NO

Use custom HAL: NO

Python 2:

Interpreter: (ver 3.5.3)

Python 3:

Interpreter: /cs/software/anaconda3/bin/python (ver 3.5.3)

Libraries: /cs/software/anaconda3/lib/libpython3.5m.so (ver 3.5.3)

numpy: /cs/software/anaconda3/lib/python3.5/site-packages/numpy/core/include (ver 1.12.1)

packages path: /cs/software/anaconda3/lib/python3.5/site-packages

Python (for build):

Java:

ant: NO

JNI: NO

Java wrappers: NO

Java tests: NO

Matlab: NO

Tests and samples:

Tests: NO

Performance tests: NO

C/C++ Examples: NO

Install path: /cs/software/anaconda3

cvconfig.h is in: /opt/conda/conda-bld/opencv_1491943704081/work/opencv-3.1.0/build

-----------------------------------------------------------------

更新:尝试过.avi和.flv格式,并且存在相同的问题!

你可能感兴趣的:(python,title,和capitiliaze)