[Python] Easy reading of serial number image files with OpenCV

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

[Python] Easy reading of serial number image files with OpenCV
[Easy Python] Reading Excel files with openpyxl
[Easy Python] Reading Excel files with pandas
Image editing with python OpenCV
Sorting image files with Python (2)
Sorting image files with Python (3)
Sorting image files with Python
Reading .txt files with Python
Extract the table of image files with OneDrive & Python
I tried "gamma correction" of the image with Python + OpenCV
[Python] Using OpenCV with Python (Image Filtering)
[Python] Using OpenCV with Python (Image transformation)
Easy Python + OpenCV programming with Canopy
Find image similarity with Python + OpenCV
Basic study of OpenCV with Python
Basics of binarized image processing with Python
Easy introduction of speech recognition with Python
Image processing with Python & OpenCV [Tone Curve]
Image acquisition from camera with Python + OpenCV
Reading and writing JSON files with Python
Drawing with Matrix-Reinventor of Python Image Processing-
Easy image processing in Python with Pillow
Easy introduction of python3 series and OpenCV3
How to crop the lower right part of the image with Python OpenCV
I tried "smoothing" the image with Python + OpenCV
Performance comparison of face detector with Python + OpenCV
I tried "differentiating" the image with Python + OpenCV
Color page judgment of scanned image with python
Erase & generate serial number files with shell script
Calculate the total number of combinations with python
How to crop an image with Python + OpenCV
I tried "binarizing" the image with Python + OpenCV
Reading and writing fits files with Python (memo)
Example of reading and writing CSV with Python
[Python + OpenCV] Whiten the transparent part of the image
Serial communication with Python
Serial communication with python
Binarization with OpenCV / Python
Image processing with Python
Connect a large number of videos together!
Web scraping with BeautifulSoup4 (serial number page)
Erase & generate serial number files with shell script
Serial communication with Python
Serial communication with python
Import tsv with Python
Make a gif animation from a serial number file with matplotlib
[Python] Easy reading of serial number image files with OpenCV
[Python] Reading CSV files
Easy TopView with OpenCV
Try projective transformation of images using OpenCV with Python
Easy partial download of mp4 with python and youtube-dl!
JPEG image generation by specifying quality with Python + OpenCV
Create miscellaneous Photoshop videos with Python + OpenCV ② Create still image Photoshop
[Windows] [Python] Camera calibration of fisheye lens with OpenCV
I tried "morphology conversion" of images with Python + OpenCV
Consolidate a large number of CSV files in folders with python (data without header)
An easy way to pad the number with zeros depending on the number of digits [Python]
Image processing with Python (Part 2)
I tried to find the entropy of the image with python
[Python] Send gmail with python: Send one by one with multiple image files attached
"Apple processing" with OpenCV3 + Python3
[python] Change the image file name to a serial number
[Co-occurrence analysis] Easy co-occurrence analysis with Python! [Python]
Camera capture with Python + OpenCV
Paste a large number of image files into PowerPoint [python-pptx]
Easy folder synchronization with Python
Sort huge files with python
Python application: Data cleansing # 3: Use of OpenCV and preprocessing of image data