erget / StereoVision

Library and utilities for 3d reconstruction from stereo cameras.
http://erget.github.io/StereoVision
GNU General Public License v3.0
648 stars 268 forks source link

Update stereo_cameras.py #43

Closed Jgil10 closed 3 years ago

Jgil10 commented 3 years ago

I am running Python 3.7 and using a single USB synchronized stereo camera delivering side by side images in single frames. I set devices to 0 0 to indicate both frames come from the same camera.

In stereo_cameras.py the function get_frames_singleimage is supposed to slice the single frame into a left and right frame. It returns the error:

Library code: left_frame = frame[:, :width/2, :] TypeError: slice indices must be integers or None or have an index method.

The code works properly if changed to make width an integer as below. left_frame = frame[:, :int(width / 2), :] right_frame = frame[:, int(width / 2):, :]

erget commented 3 years ago

Excellent, thanks very much @Jgil10 - it's much appreciated!