Applied fix mentioned in bugreport 3370. Seems to solve the issue.

Small bug in the nextImg() function leading to a endless loop once a negative image is supplied, smaller than the actual window size. More info at: code.opencv.org/issues/3370