Absolutely! You just need to define video source gizmo to read frames from PiCamera.
Something like that (I did not check this code myself, but it is based on one of our examples: 016_custom_video_source.ipynb):
from picamera2 import Picamera2
class PiCameraSourceGizmo(dgstreams.Gizmo):
"""Picamera2-based video source gizmo"""
def __init__(self):
super().__init__()
def run(self):
picam2 = Picamera2()
picam2.configure(picam2.preview_configuration(main={"format": "BGR888"}))
picam2.start()
try:
while not self._abort:
data = picam2.capture_array()
self.send_result(dgstreams.StreamData(data))
finally:
picam2.stop()
Then you use PiCameraSourceGizmo()
instead of dgstreams.VideoSourceGizmo(video_source)
in the code above.