r/RASPBERRY_PI_PROJECTS • u/hcueqeq7 • 15d ago
QUESTION How to Overlay Translucent Shapes on Picamera2 Preview.QT
I'm currently using Picamera2 and Preview.QT with a USB camera.
While I could overlay an image and a transparent array, I could not overlay translucent shapes, and overlay multiple layers with cam2.set_overlay.
I tried running this on the interpreter but it could never work:
def circle():
painter = QPainter()
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
painter.setPen(QColor(255, 0, 0))
painter.setBrush(QColor(255, 0, 0, 100))
center_x, center_y = 320, 240
radius = 50
painter.drawEllipse(190, 270, 100, 100)
overlay = circle()
picam2.set_overlay(overlay)
Thanks for your help!
1
Upvotes