Skip to content

Instantly share code, notes, and snippets.

@Hermann-SW
Created January 14, 2023 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hermann-SW/336063988f502047b6ebddd09b2038f5 to your computer and use it in GitHub Desktop.
Save Hermann-SW/336063988f502047b6ebddd09b2038f5 to your computer and use it in GitHub Desktop.
Overlay displaying 640x75 and 640x150 areas for Raspberry v2 camera raspiraw capturing at 1007fps (with 640x75 and 640x150_s tools)
#!/usr/bin/python3
import numpy as np
from picamera2 import Picamera2, Preview
picam2 = Picamera2()
picam2.configure(picam2.create_preview_configuration())
picam2.start_preview(Preview.QTGL, x=100, y=100, width=640, height=480)
picam2.start()
overlay = np.zeros((480, 640, 4), dtype=np.uint8)
col = (0xFF, 0xFF, 0x00)
overlay[0 , : ] = (col) + (0xFF,)
overlay[74 , : ] = (col) + (0x80,)
overlay[149 , : ] = (col) + (0xFF,)
overlay[:150, :1] = (col) + (0xFF,)
overlay[:150, 639: ] = (col) + (0xFF,)
picam2.set_overlay(overlay)
input("Press Enter to continue ...")
@Hermann-SW
Copy link
Author

Hermann-SW commented Jan 14, 2023

Example screenshot, shows the 640x75 and 640x150 areas on top of 640x480 camera preview window. Not really useful for raspiraw capturing, because raspiraw needs legacy camera mode, and picamera2 needs libcamera stack. So for working with raspiraw better use picamera version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment