I found an easier solution ! I can read .avi files but am not able to use cv2.imshow() so I used matplotlib instead to show the image. https://github.com/ContinuumIO/anacon...
conda install -c anaconda opencv
The code below now works
import numpy as np
import cv2
import matplotlib.pyplot as plt
# read video
cap = cv2.VideoCapture('/home/ast/datasets/ewap/seq_eth/seq_eth.avi')
ret, frame = cap.read()
plt.figure()
plt.imshow(frame)
Using cv2.imshow however does not work with the following error
error Traceback (most recent call last)
<ipython-input-11-fc947d934e1a> in <module>()
20 #plt.figure()
21 #plt.imshow(frame)
---> 22 cv2.imshow('Frame', frame)
error: OpenCV(3.4.1) /opt/conda/conda-bld/opencv-suite_1527005194613/work/modules/highgui/src/window.cpp:636: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage
how did you install cv2 ? (the PIP version can't read any video files)
i used this command
conda install -c menpo opencv3
conda - bad idea. and the same problem. try a
cv2.getBuildInformation()
, there is a VideoIO section there.you'll see it's lacking all backends like gstreamer & ffmpeg
ah ok ty. so how should I install it then ? also, how can i get rid of the current install of opencv ?
build from src
jeez. there is no easier solution...?
no, there isnt.