A memo on how to read the serial number file that was spit out in the previous post. [Python] Save the video data imported by OpenCV as a serial number jpg file
You can pass it to VideoCapture in a syntax that uses a conversion specifier. In the source code example below, 00000.jpg, 00001.jpg, 00002.jpg… are read in order.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cv2
print(__doc__)
video_input = cv2.VideoCapture("%05d.jpg ")
while(video_input.isOpened() == True):
ret, frame = video_input.read()
cv2.imshow('frame', frame)
c = cv2.waitKey(50) & 0xFF
if c==27: # ESC
break
video_input.release()
cv2.destroyAllWindows()
The C ++ version looks like this ↓
cv::VideoCapture capture("%05d.jpg ");
that's all.
Recommended Posts