Course materials · Microprocessor Applications

Camera frames and frame rate · Learning

English translation

Execution conditions

Inputs: a generated image and timestamps. The real capture example uses Picamera2 on Raspberry Pi OS. If it is not installed in the OS, run sudo apt install python3-picamera2 in a terminal.

Topics covered

Choosing a resolution and capture interval requires understanding the trade-offs among storage, field of view, and frame rate.

Overall workflow

Frame array → ROI and resolution → timestamps → memory and actual FPS

Cost of one frame

Uncompressed storage is height × width × number of channels × bytes per channel. Doubling the resolution along both axes quadruples the pixel count. Using only the required region as an ROI lets you adjust both observed information and processing cost.

Requested FPS and actual records

Exposure, transmission, conversion, and storage take time. Calculate actual FPS from timestamp intervals. Counting frames alone or recording only requested settings can miss interruptions and delays.

Worked example

Use the 120×160×3 uint8 RGB image generated by the provided NumPy code.

import numpy as np
import matplotlib.pyplot as plt
x,y=np.meshgrid(np.linspace(0,255,160),np.linspace(0,255,120))
frame=np.stack([x,y,255-x],axis=-1).astype(np.uint8)
small=frame[::2,::2]
print(frame.shape,frame.nbytes,small.shape,small.nbytes)
(120, 160, 3) 57600 (60, 80, 3) 14400

Reference example

View more examples

Reference materials