atduskgreg / opencv-processing

OpenCV for Processing. A creative coding computer vision library based on the official OpenCV Java API
Other
1.32k stars 464 forks source link

Error in opening movie files #104

Closed juanfadev closed 5 months ago

juanfadev commented 6 years ago

Error when trying to open a movie. Just tried with the example 'OpticalFlow' and it is imposible.

Failing in row: opencv.loadImage(video);

Width (0) and height (0) cannot be <=0

f41ardu commented 6 years ago

This may solve your issue.

 while (video.height == 0 )  delay(10); // <-- add  
 opencv.loadImage(video);

or

 if (video.width > 0 && video.height > 0) {//check if the cam instance has loaded pixels
    opencv.loadImage(video);
  } 

I have no idea why this is necessary. Solved it for my using Processing 3.3.6.

sean369see commented 6 years ago

This above two modifications also work for Processing 3.3.7.