Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example usage of backpack.annotation module
import panoramasdk
from backpack.annotation import (
Point, LabelAnnotation, RectAnnotation, TimestampAnnotation,
OpenCVImageAnnotationDriver,
PanoramaMediaAnnotationDriver
)
class Application(panoramasdk.node):
def __init__(self):
super().__init__()
# self.skyline = ...
self.panorama_driver = PanoramaMediaAnnotationDriver()
self.cv2_driver = OpenCVImageAnnotationDriver()
# called from video processing loop:
def process_streams(self):
streams = self.inputs.video_in.get()
for idx, stream in enumerate(streams):
annotations = [
TimestampAnnotation(),
RectAnnotation(point1=Point(0.1, 0.1), point2=Point(0.9, 0.9)),
LabelAnnotation(point=Point(0.5, 0.5), text='Hello World!')
]
self.panorama_driver.render(annotations, stream)
# TODO: eventually multiplex streams to a single frame
if idx == 0:
rendered = self.cv2_driver.render(annotations, stream.image.copy())
# self.skyline.put(rendered)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment