Ejemplo n.º 1
0
def bench(folder):
    from os.path import join
    from video_capture.av_file_capture import File_Capture

    cap = File_Capture(join(folder, "marker-test.mp4"))
    markers = []
    detected_count = 0

    for x in range(500):
        frame = cap.get_frame()
        img = frame.img
        gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        markers = detect_markers_robust(gray_img,
                                        5,
                                        prev_markers=markers,
                                        true_detect_every_frame=1,
                                        visualize=True)

        draw_markers(img, markers)
        cv2.imshow("Detected Markers", img)

        # for m in markers:
        #     if 'img' in m:
        #         cv2.imshow('id %s'%m['id'], m['img'])
        #         cv2.imshow('otsu %s'%m['id'], m['otsu'])
        if cv2.waitKey(1) == 27:
            break
        detected_count += len(markers)
    print(detected_count)  # 2900 #3042 #3021
Ejemplo n.º 2
0
def bench(folder):
    from os.path import join
    from video_capture.av_file_capture import File_Capture

    cap = File_Capture(join(folder, "marker-test.mp4"))
    markers = []
    detected_count = 0

    for x in range(500):
        frame = cap.get_frame()
        img = frame.img
        gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        markers = detect_markers_robust(
            gray_img, 5, prev_markers=markers, true_detect_every_frame=1, visualize=True
        )

        draw_markers(img, markers)
        cv2.imshow("Detected Markers", img)

        # for m in markers:
        #     if 'img' in m:
        #         cv2.imshow('id %s'%m['id'], m['img'])
        #         cv2.imshow('otsu %s'%m['id'], m['otsu'])
        if cv2.waitKey(1) == 27:
            break
        detected_count += len(markers)
    print(detected_count)  # 2900 #3042 #3021
Ejemplo n.º 3
0
def bench(folder):
    from os.path import join
    from video_capture.av_file_capture import File_Capture
    cap = File_Capture(join(folder, 'marker-test.mp4'))

    tracker = MarkerTracker()
    detected_count = 0
    for x in range(500):
        frame = cap.get_frame()
        img = frame.img
        gray_img = cv2.cvtColor(img, cv2.cv.CV_BGR2GRAY)
        markers = tracker.track_in_frame(gray_img, 5, visualize=True)
        draw_markers(img, markers)
        cv2.imshow('Detected Markers', img)
        if cv2.waitKey(1) == 27:
            break
        detected_count += len(markers)

    print detected_count  #3106 #3226