Ask Your Question
-1

Error with opencv cap.read()

asked 2018-02-15 02:46:37 -0600

PigiBouxx gravatar image

updated 2018-02-15 03:42:56 -0600

When I start my python's programm, i got this error

select timeout
select timeout
ret, frame = cap.read()
cv2.error: OpenCV(3.4.0-dev) /home/damien/opencv/opencv/module/core/include/opencv2/core/mat.inl.hpp:500:error: (-215) total() == 0 || data != __null in function Mat

The code is bassic, and got no error (Its just read the webcam). when i search on google, I fond one message saying 'it's the OpenCv compilation the probleme'

I don't found my error, I used this command to compile opencv

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=~/oc/opencv_contrib-3.1.1/modules \
-D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \
-D BUILD_EXAMPLES=ON ..

one things, I'm runing Ubuntu on Vmware, and the version for opencv is the 3.4.0 (the lastest)

here is the cmake https://pastebin.com/X6eN4q4m

edit retag flag offensive close merge delete

Comments

can you add the cmake output to your question, please ?

berak gravatar imageberak ( 2018-02-15 02:51:33 -0600 )edit

Yes I edit it, here is the link https://pastebin.com/X6eN4q4m

PigiBouxx gravatar imagePigiBouxx ( 2018-02-15 03:03:12 -0600 )edit
1

"ModuleNotFoundError: No module named 'numpy'" -- so,

it never build any python bindings (see line 400) , so i wonder , what you're using above

(like the pip installed version does not have any video file support builtin, well known flaw)

berak gravatar imageberak ( 2018-02-15 03:51:30 -0600 )edit

Yes I know its don't working, But I don't what is the problem, I Follow all this tuto https://www.pyimagesearch.com/2016/10... But use the version 3.3.1

PigiBouxx gravatar imagePigiBouxx ( 2018-02-15 03:53:15 -0600 )edit
1

try to install numpy for the python you want to use.

no use to run make, until cmake says it will build it.

berak gravatar imageberak ( 2018-02-15 03:55:56 -0600 )edit

I already install numpy

PigiBouxx gravatar imagePigiBouxx ( 2018-02-15 04:23:24 -0600 )edit

try to use cmake-gui, type PYTHON into the search box, and try to explicitly specify, which of your (various ?) pythons you want to use. and this one needs a valid numpy

berak gravatar imageberak ( 2018-02-15 04:28:36 -0600 )edit

I tried one things, its sudo pip3 install python-opencv, but i got the same error, is it possible the probleme, is the vmware?

PigiBouxx gravatar imagePigiBouxx ( 2018-02-15 04:35:25 -0600 )edit
2

the pip version cannot read video files, like said before.

your problem is more like: too many python versions, and multiple cv2 instances.

and using virtual env things make it worse , even.

berak gravatar imageberak ( 2018-02-15 04:36:39 -0600 )edit

Can i contact you with vocal please? I don't understand the handling

PigiBouxx gravatar imagePigiBouxx ( 2018-02-15 04:39:29 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
-2

answered 2018-02-15 21:30:19 -0600

supra56 gravatar image
pip3 install opencv-python
edit flag offensive delete link more

Comments

Sorry I can't answer because i'am a "New" ^^ ITs Wmare the problem so i create another partition and work fine for me, "pip3 install opencv-python" is a bad things

Thx for helping

PigiBouxx gravatar imagePigiBouxx ( 2018-02-16 05:18:50 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-02-15 02:46:37 -0600

Seen: 2,234 times

Last updated: Feb 15 '18