Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ilirosmanaj/detect_kermit/llms.txt
Use this file to discover all available pages before exploring further.
convert_vid2image.py reads a video file using OpenCV and writes one JPEG frame per second to disk, producing the raw images needed for dataset preparation. These frames form the foundation of the Kermit detection training and test sets — episodes 1 and 2 supply training images, while episode 3 supplies the validation set.
Source code
helpers/convert_vid2image.py
How to use
- Place your video file at
data/video.avi(or edit the path string in the script to match your file location). - Create the output directory so OpenCV has somewhere to write:
- Run the script from the
helpers/directory: - Frame images are written to
data/videoframe/and named sequentially —frame0.jpg,frame1.jpg, and so on.
How it works
The script opens the video withcv2.VideoCapture and enters a loop that advances one second on every iteration. Seeking is done by calling:
cv2.CAP_PROP_POS_MSEC sets the playback position in milliseconds, so multiplying the integer count by 1000 moves the read head to exactly count seconds into the video. The resulting frame is then encoded and saved as a JPEG via cv2.imwrite. The loop terminates when cap.read() returns ret = False, which happens once the end of the video is reached.
Video files are intentionally not checked into the repository due to their large file sizes. Only this helper script is provided. You must supply your own
.avi episode files before running the extraction.