brycedrennan/eulerian-magnification

Getting 'tuple index out of range' error in OS X

teddyknox opened this issue · 3 comments

Installed opencv by tapping hombrew/science and doing brew install opencv, then did pip install matplotlib scipy numpy.

After opening up the file by going

python -i eulerian_magnify.py

I entered

eulerian_magnification('movie.mov', image_processing='gaussian', freq_min=50.0 / 60.0, freq_max=1.0, amplification=50)

and got

Loading will.mov
WARNING: Couldn't read movie file will.mov
Applying bandpass between 0.833333333333 and 1.0 Hz
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "eulerian_magnify.py", line 19, in eulerian_magnification
    vid_data = temporal_bandpass_filter(vid_data, fps, freq_min=freq_min, freq_max=freq_max)
  File "eulerian_magnify.py", line 61, in temporal_bandpass_filter
    fft = scipy.fftpack.fft(data, axis=axis)
  File "/usr/local/lib/python2.7/site-packages/scipy/fftpack/basic.py", line 230, in fft
    n = tmp.shape[axis]
IndexError: tuple index out of range

It seems like opencv's binaries are already in the path.

I also get the same error under linux 3.9-1-686-pae (debian unstable), no matter what video I try. Library versions:
python 2.7
python-opencv 2.3.1-11
python-numpy 1:1.6.2-1.2
python-scipy 0.10.1+dfsg2-1
python-matplotlib 1.1.1~rc2-1

This happens because cv2.VideoCapture is reading a blank file. The file path "video_filename" must be absolute.

Here's a fix: 16dce6a