示例#1
0
文件: hook.py 项目: uchenp/stagesepx
    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
示例#2
0
文件: hook.py 项目: zsg555/stagesepx
 def do(self, frame: VideoFrame, *_, **__) -> typing.Optional[VideoFrame]:
     super().do(frame, *_, **__)
     frame.data = toolbox.sharpen_frame(frame.data)
     return frame
示例#3
0
文件: hook.py 项目: zsg555/stagesepx
 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