pytorch_YOLO_OpenVINO_demo icon indicating copy to clipboard operation
pytorch_YOLO_OpenVINO_demo copied to clipboard

cv2.VedioCapture("bus.jpg") will report an error

Open zengqingfa opened this issue 3 years ago • 6 comments

My model was exported successfully. When my input was a video, the program performed fine, but when my input was an image, the program responded with an error.

image image image

How can I fix this demo to solve this problem?

zengqingfa avatar Jun 25 '21 09:06 zengqingfa

Try to type "D:\bus.jpg" instead of "D:/bus.jpg".

Chen-MingChang avatar Jun 25 '21 12:06 Chen-MingChang

Same mistake. @Chen-MingChang

zengqingfa avatar Jun 28 '21 12:06 zengqingfa

@zengqingfa Please check your path where "bus.jpg" is. In my sample, it is images/bus.jpg

Chen-MingChang avatar Jul 07 '21 06:07 Chen-MingChang

videocapture is used to read image sequence or video: https://docs.opencv.org/3.4/d8/dfe/classcv_1_1VideoCapture.html#a949d90b766ba42a6a93fe23a67785951 So, you'd better rename your image to bus001.jpg or use video file instead.

wdkwyf avatar Jul 07 '21 06:07 wdkwyf

@zengqingfa After checking, this problem is related to media files with audio streams and MSMF backend. You can follow the link bellow to expand your opencv support.

https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/OpenCV-4-1-2-openvino-CAP-IMAGES-can-t-find-starting-number-in/m-p/1129123#M8204

Chen-MingChang avatar Jul 07 '21 06:07 Chen-MingChang

This seems to be a problem with the OpenCV version used by OpenVino2021.1, I have read elsewhere that OpenVino2021.2 has fixed this problem, that OpenVino2021.2 can read videos and images using cv2.VedioCapture (path), the previous version doesn't seem to work. Since I only need to read the image, I use cv2.imread (img_path) instead of cv2.vediocapture (path), but other things have changed as well. Now the program can be used normally.So I have no problem with this program. Thanks for the answer.

zengqingfa avatar Jul 07 '21 07:07 zengqingfa