Created
January 14, 2023 01:35
-
-
Save Hermann-SW/ec9660498244f960b3e6c25f2c6e666b 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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import numpy as np | |
from picamera import PiCamera | |
win = 100, 100, 640, 480 | |
picam = PiCamera() | |
picam.resolution = (640, 480) | |
picam.preview_window = win | |
picam.preview_fullscreen = False | |
picam.start_preview() | |
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,) | |
o = picam.add_overlay(overlay, layer=3, alpha=64) | |
o.window = win | |
o.fullscreen = False | |
input("Press Enter to continue ...") | |
picam.remove_overlay(o) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example screenshot, shows the 640x75 and 640x150 areas on top of 640x480 camera preview window. To focus camera onto scene for later raspiraw capturing. picamera2 version is not useful for raspiraw capturing, since raspiraw needs legacy camera mode and picamera2 needs libcamera stack.