Last active
June 20, 2022 20:56
-
-
Save mrtj/e30b73a751d73f7586a7e36669043c56 to your computer and use it in GitHub Desktop.
Example usage of backpack.annotation module
This file contains hidden or 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
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