Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I found the 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/anaconda-issues/issues/121

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

I found the 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/anaconda-issues/issues/121

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