Esempio n. 1
0
def ut_add_keyframe_with_ba():
    input = SequenceManager(
        "/Users/jimmy/Desktop/ptz_slam_dataset/basketball/basketball_anno.mat",
        "/Users/jimmy/Desktop/ptz_slam_dataset/basketball/images",
        "/Users/jimmy/PycharmProjects/ptz_slam/Camera-Calibration/basketball/objects_basketball.mat"
    )

    camera_center = input.get_camera_center()
    base_rotation = input.get_base_rotation()
    u = 1280 / 2
    v = 720 / 2

    image_index = [0]  # 680, 690, 700, 730, 800
    im = input.get_image(image_index[0])
    ptz = input.get_ptz(image_index[0])
    keyframe = KeyFrame(im, image_index[0], camera_center, base_rotation, u, v,
                        ptz[0], ptz[1], ptz[2])

    a_map = Map('orb')
    a_map.add_first_keyframe(keyframe, False)

    # test the result frames
    for i in range(1, 3600, 5):
        ptz = input.get_ptz(i)
        im = input.get_image(i)
        keyframe = KeyFrame(im, i, camera_center, base_rotation, u, v, ptz[0],
                            ptz[1], ptz[2])

        if a_map.good_new_keyframe(ptz, 10, 25, 1280, False):
            print('add key frame from index %d, pan angle %f' % (i, ptz[0]))
            a_map.add_keyframe_with_ba(keyframe, '.', True)

    print('number of keyframe is %d' % (len(a_map.keyframe_list)))
Esempio n. 2
0
def ut_add_first_key_frame():
    input = SequenceManager(
        "/Users/jimmy/Desktop/ptz_slam_dataset/basketball/basketball_anno.mat",
        "/Users/jimmy/Desktop/ptz_slam_dataset/basketball/images",
        "/Users/jimmy/PycharmProjects/ptz_slam/Camera-Calibration/basketball/objects_basketball.mat"
    )

    camera_center = input.get_camera_center()
    base_rotation = input.get_base_rotation()
    u = 1280 / 2
    v = 720 / 2

    image_index = [0]  # 680, 690, 700, 730, 800
    im = input.get_image(image_index[0])
    ptz = input.get_ptz(image_index[0])
    keyframe = KeyFrame(im, image_index[0], camera_center, base_rotation, u, v,
                        ptz[0], ptz[1], ptz[2])

    a_map = Map()
    a_map.add_first_keyframe(keyframe, True)