With 4.6 installed via apt, I get the same error as you (black screen) with your code. V3 camera on a Pi 5 with Bookworm.
However, this works to add a timestamp to an imageDoes that work for you?
However, this works to add a timestamp to an image
Code:
# cv2-stamp.py from picamera2 manual 8.2.1#import timefrom picamera2 import Picamera2, MappedArrayimport cv2picam2 = Picamera2()colour = (0, 255, 0)origin = (0, 30)font = cv2.FONT_HERSHEY_SIMPLEXscale = 1thickness = 2def apply_timestamp(request): timestamp = time.strftime("%Y-%m-%d %X") with MappedArray(request, "main") as m: cv2.putText(m.array, timestamp, origin, font, scale, colour, thickness)picam2.pre_callback = apply_timestamppicam2.start(show_preview=True)time.sleep(5)
Statistics: Posted by neilgl — Tue Apr 23, 2024 12:54 pm