Anaconda ends video capture in OpenCV

On Anaconda 1.9 for Linux only, the following is done:

import cv2
import sys
cap = cv2.VideoCapture(sys.argv[1])

ret, frame = cap.read()
if not ret:
    print "capture failed"

Tested with Anaconda-1.9.2-Linux-x86_64 on Ubuntu 12.04LTS, Debian Wheezy. The same code using the same input file works in Anaconda on Windows 7, as well as using the python-opencv 2.3.1-7 package on Ubuntu. The input file is an H.264 video in an MP4 container. Anaconda is installed on the system under / opt / anaconda, and / opt / anaconda / bin is in the path.

By the way, I don't have an Anaconda example cv2.VideoCaptureworking on any input file on Linux. After I discovered this, I checked several other files, the same result. Also unable to write files.

Is there any trick for Anaconda cv2 to work fully on Linux?

The UPDATE . This still does not work in recent versions of Anaconda, for example Anaconda-2.2.0-Linux-x86_64 on Ubuntu 14.04LTS.

+4
source share
1 answer

Install OpenCV from this Conda Forge:
conda install -c loopbio ffmpeg-feature gtk2-feature opencv

0
source

Source: https://habr.com/ru/post/1541994/


All Articles