Esempio n. 1
0
    def test_frame_matcher_failure_case2(self):
        """Another failure case detected via GUI"""
        file_parser = GroundTruthParser()

        first_file_lines = file_parser.read_file("src/python/test/27-1-2006_11-48.csv")
        first_pandata_lines = file_parser.read_file("src/python/test/27-1-2006_11-48_PANDATA.csv")
        first_frame_data = file_parser.parse_lines(first_file_lines)
        first_pan_data = file_parser.parse_pandata_lines(first_pandata_lines)

        second_file_lines = file_parser.read_file("src/python/test/27-1-2006_17-0.csv")
        second_pandata_lines = file_parser.read_file("src/python/test/27-1-2006_17-0_PANDATA.csv")
        second_frame_data = file_parser.parse_lines(second_file_lines)
        second_pan_data = file_parser.parse_pandata_lines(second_pandata_lines)

        refiner = PoseRefiner()
        refiner.refine_frame_poses(first_frame_data, first_pan_data)
        refiner.refine_frame_poses(second_frame_data, second_pan_data)

        all_frames = []
        all_frames.append(first_frame_data)
        all_frames.append(second_frame_data)

        frame_matcher = FrameMatcher(all_frames)
        seek_positions, distances = frame_matcher.seek(207)
        print(f'MATCHES ARE {seek_positions}')
        self.assertEqual(len(seek_positions), 1)
        self.assertEqual(seek_positions[0], 67)

        seek_positions, distances = frame_matcher.seek(208)
        print(f'MATCHES ARE {seek_positions}')
        self.assertEqual(len(seek_positions), 1)
        self.assertEqual(seek_positions[0], 69)
Esempio n. 2
0
    def test_frame_matcher_failure_case(self):
        """This test covers a failure case detected when using the GUI"""
        file_parser = GroundTruthParser()

        first_file_lines = file_parser.read_file("src/python/test/26-1-2006_12-40.csv")
        first_pandata_lines = file_parser.read_file("src/python/test/26-1-2006_12-40_PANDATA.csv")
        first_frame_data = file_parser.parse_lines(first_file_lines)
        first_pan_data = file_parser.parse_pandata_lines(first_pandata_lines)

        second_file_lines = file_parser.read_file("src/python/test/25-1-2006_10-49.csv")
        second_pandata_lines = file_parser.read_file("src/python/test/25-1-2006_10-49_PANDATA.csv")
        second_frame_data = file_parser.parse_lines(second_file_lines)
        second_pan_data = file_parser.parse_pandata_lines(second_pandata_lines)

        refiner = PoseRefiner()
        refiner.refine_frame_poses(first_frame_data, first_pan_data)
        refiner.refine_frame_poses(second_frame_data, second_pan_data)

        all_frames = []
        all_frames.append(first_frame_data)
        all_frames.append(second_frame_data)

        frame_matcher = FrameMatcher(all_frames)
        seek_positions, distances = frame_matcher.seek(429)
        print(f'MATCHES ARE {seek_positions}')
        self.assertEqual(len(seek_positions), 1)
        self.assertEqual(seek_positions[0], 295)
Esempio n. 3
0
    def test_all_seven_stages_8th(self):
        file_parser = GroundTruthParser()
        stage8_file_lines = file_parser.read_file(
            "src/python/test/8-2-2006_16-29-stage7.csv")
        stage8_frame_data = file_parser.parse_lines(stage8_file_lines)
        original_file_lines = file_parser.read_file(
            "src/python/test/8-2-2006_16-29.csv")
        original_pandata_lines = file_parser.read_file(
            "src/python/test/8-2-2006_16-29_PANDATA.csv")
        original_frame_data = file_parser.parse_lines(original_file_lines)
        original_pan_data = file_parser.parse_pandata_lines(
            original_pandata_lines)

        refiner = PoseRefiner()
        refiner.refine_frame_poses(original_frame_data, original_pan_data)

        for frame_index, current_frame in enumerate(stage8_frame_data):
            print(
                f'Frame {current_frame.frame_num}: Reference = {current_frame}, live = {original_frame_data[frame_index]}'
            )
            self.assertTrue(current_frame == original_frame_data[frame_index])
Esempio n. 4
0
    def __read_ground_truth(self) -> bool:
        """Reads all required ground truth files and performs the pose refinement"""
        # determine if this video file name has any additional information inside brackets. If so we'll need
        # to remove this info as the ground truth files won't have that same info
        if self._video_name.find("(") == -1:
            ground_truth_path = self._video_file_path[:-4] + '.csv'
            pandata_path = self._video_file_path[:-4] + '_PANDATA.csv'
        else:
            startSubstr = self._video_file_path.rfind("(")
            endSubstr = self._video_file_path.rfind(")")
            ground_truth_path = self._video_file_path[0:startSubstr -
                                                      1] + ".csv"
            pandata_path = self._video_file_path[0:startSubstr -
                                                 1] + '_PANDATA.csv'

        if not Path(ground_truth_path).is_file():
            print(
                f'ERROR: Ground truth file does not exist. Path = {ground_truth_path}'
            )
            return False
        if not Path(pandata_path).is_file():
            print(
                f'ERROR: Ground truth PANDATA file does not exist. Path = {pandata_path}'
            )
            return False

        file_parser = GroundTruthParser()
        file_lines = file_parser.read_file(ground_truth_path)
        pandata_lines = file_parser.read_file(pandata_path)
        self.frame_data = file_parser.parse_lines(file_lines)
        pan_data = file_parser.parse_pandata_lines(pandata_lines)

        refiner = PoseRefiner()
        refiner.refine_frame_poses(self.frame_data, pan_data)

        return True
Esempio n. 5
0
    def test_frame_matcher(self):
        file_parser = GroundTruthParser()

        first_file_lines = file_parser.read_file("src/python/test/26-1-2006_9-37.csv")
        first_pandata_lines = file_parser.read_file("src/python/test/26-1-2006_9-37_PANDATA.csv")
        first_frame_data = file_parser.parse_lines(first_file_lines)
        first_pan_data = file_parser.parse_pandata_lines(first_pandata_lines)

        second_file_lines = file_parser.read_file("src/python/test/8-2-2006_16-29.csv")
        second_pandata_lines = file_parser.read_file("src/python/test/8-2-2006_16-29_PANDATA.csv")
        second_frame_data = file_parser.parse_lines(second_file_lines)
        second_pan_data = file_parser.parse_pandata_lines(second_pandata_lines)

        third_file_lines = file_parser.read_file("src/python/test/23-1-2006_14-9.csv")
        third_pandata_lines = file_parser.read_file("src/python/test/23-1-2006_14-9_PANDATA.csv")
        third_frame_data = file_parser.parse_lines(third_file_lines)
        third_pan_data = file_parser.parse_pandata_lines(third_pandata_lines)

        refiner = PoseRefiner()
        refiner.refine_frame_poses(first_frame_data, first_pan_data)
        refiner.refine_frame_poses(second_frame_data, second_pan_data)
        refiner.refine_frame_poses(third_frame_data, third_pan_data)

        all_frames = []
        all_frames.append(first_frame_data)
        all_frames.append(second_frame_data)
        all_frames.append(third_frame_data)

        frame_matcher = FrameMatcher(all_frames)
        seek_positions, distances = frame_matcher.seek(5)
        self.assertEqual(len(seek_positions), 2)
        self.assertEqual(seek_positions[0], 90)
        self.assertEqual(seek_positions[1], 0)

        seek_positions, distances = frame_matcher.seek(25)
        self.assertEqual(seek_positions[0], 111)
        self.assertEqual(seek_positions[1], 16)

        seek_positions, distances = frame_matcher.seek(100)
        self.assertEqual(seek_positions[0], 187)
        self.assertEqual(seek_positions[1], 81)

        seek_positions, distances = frame_matcher.seek(200)
        self.assertEqual(seek_positions[0], 288)
        self.assertEqual(seek_positions[1], 178)

        seek_positions, distances = frame_matcher.seek(8409) # in stage 8
        self.assertEqual(seek_positions[0], 8419)
        self.assertEqual(seek_positions[1], 7751)