Exemplo n.º 1
0
    def do(self, frame: VideoFrame, *_, **__) -> typing.Optional[VideoFrame]:
        super().do(frame, *_, **__)

        # you can get frame_id and frame data here
        # and use them to custom your own function

        # add your code here
        # ...

        # for example, i want to turn grey, and save size of each frames
        frame.data = toolbox.turn_grey(frame.data)
        self.result[frame.frame_id] = frame.data.shape

        # if you are going to change the origin frame
        # just return the changed frame
        # and set 'overwrite' to 'True' when you are calling __init__
        return frame
Exemplo n.º 2
0
 def do(self, frame: VideoFrame, *_, **__) -> typing.Optional[VideoFrame]:
     super().do(frame, *_, **__)
     frame.data = toolbox.sharpen_frame(frame.data)
     return frame
Exemplo n.º 3
0
 def do(self, frame: VideoFrame, *_, **__) -> typing.Optional[VideoFrame]:
     super().do(frame, *_, **__)
     frame.data = toolbox.compress_frame(frame.data,
                                         compress_rate=self.compress_rate,
                                         target_size=self.target_size)
     return frame