小编Ram*_*dra的帖子

查找视频中与图像匹配的帧

我正在尝试使用 opencv 查找与图像匹配的帧。我还想找到找到该图像的时间范围。该视频为蒙版视频。到目前为止的代码:

 def occurence_counter(self):
        img = cv2.imread('ref_img.jpg', cv2.IMREAD_COLOR)
        # shrink
        img = cv2.resize(img, (10, 10))
        # convert to b&w
        img = color.rgb2gray(img)
        similarities = []
       
      result = self.parse_video(img, str(self.lineEdit.text()).strip(), 1, False)
        print result

def parse_video(self, image, video, n_matches, break_point=False, 
           verbose=False):

    similarities = [{'frame': 0, 'similarity': 0}]
    frame_count = 0

    cap = cv2.VideoCapture(video)
    while cap.isOpened():

        ret, frame = cap.read()

        if type(frame) == type(None):
            break

        # increment frame counter
        frame_count += 1

        # resize current video frame
        small_frame = cv2.resize(frame, (10, …
Run Code Online (Sandbox Code Playgroud)

python opencv

2
推荐指数
1
解决办法
4119
查看次数

标签 统计

opencv ×1

python ×1