ZELLMECHANIK-DRESDEN / ShapeOut

Shape-Out has been superseded by Shape-Out 2.
https://shapeout.readthedocs.io
GNU General Public License v2.0
5 stars 5 forks source link

Can't read Video (Mac OS, but should also affect other platforms with recent opencv versions) #45

Closed phidahl closed 8 years ago

phidahl commented 8 years ago

Installed all necessary libs on OS X with macports (wxpython-3.0)

ShapeOut works fine, but video files are not read.

Can be fixed by changing: shapeout/gui/plot.py, line 290..292:

" totframes = video.get(cv2.CAP_PROP_FRAME_COUNT)

video.set(cv2.CAP_PROP_POS_FRAMES, actual_sel-1) " The names of the constants changed from cv2.cv.CV_XXX to cv2.XXX in OpenCV 3.

By the way, to get ShapeOut running on OX X the following commands might help. Compilation takes some hours, but the libraries from macports run faster than those from anaconda. The problems with chaco and wx seem to be solved with the current version.

sudo port install python27 py27-ipython py27-scipy py27-matplotlib sudo port install opencv +python27 sudo port install py27-wxpython-3.0 py27-statsmodels py27-kiwisolver py27-chaco py27-pip py27-simplejson py27-sip py27-macholib sudo pip-2.7 install nptdms sudo pip-2.7 install pyper

Then select python27 (macports) as standard python interpreter:

sudo port select --set python python27 sudo port select --set pip pip27

Write into ~/.bash_profile (Put in YOUR path to dclab)

!/bin/bash

export PYTHONPATH="${PYTHONPATH}:/Users/phi/git/dclab"

start ShapeOut with

pyhon shapeout/ShapeOut.py

This can be put into a .command file placed on the Desktop.

paulmueller commented 8 years ago

Very nice!

It would probably easiest to solve this issue by checking the OpenCV version first.

from distutils.version import LooseVersion
if LooseVersion(cv2.__version__) < 3.0.0:
    cv_const = cv2.cv
else:
    cv_const = cv2

totframes = video.get(cv_const.CAP_PROP_FRAME_COUNT)
video.set(cv_const.CAP_PROP_POS_FRAMES, actual_sel-1)