Ejemplo n.º 1
0
def run_all_pm_tests(test_type_str, video_location, start_fnum, stop_fnum,
                     save_flag, show_flag, wait_flag):

    # Create a capture object and set the stop frame number if none was given.
    capture = cv2.VideoCapture(video_location)
    if stop_fnum == 0:
        stop_fnum = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))

    # Run the PM test with grayscale and non-grayscale parameters.
    for gray_flag in [True, False]:

        # Display the flags used for the current PM test.
        print("==== Percent Matching Test ====")
        print("\tgray_flag={}".format(gray_flag))
        print("\tshow_flag={}".format(show_flag))
        pm = percent_matching.PercentMatcher(capture, [start_fnum, stop_fnum],
                                             gray_flag, save_flag, show_flag,
                                             wait_flag)

        # Run the PM test according to the input test_type_str.
        if test_type_str == "pms":
            pm.sweep_test()
        elif test_type_str == "pmc":
            pm.calibrate_test()
        elif test_type_str == "pmi":
            pm.initialize_test()
        elif test_type_str == "pmt":
            pm.timeline_test()

    # Release the OpenCV capture object.
    capture.release()
Ejemplo n.º 2
0
 def __init__(self, video_location, tfnet, show_flag=False):
     print("Video Location: {:}".format(video_location))
     self.capture = cv2.VideoCapture(video_location)
     self.sd = stage_detection.StageDetector(self.capture,
                                             tfnet,
                                             show_flag=show_flag)
     self.pm = percent_matching.PercentMatcher(self.capture,
                                               show_flag=show_flag)