Exemple #1
0
def test_convert_keypoints_from_albumentations():
    keypoints = [[0.2, 0.3, 0.6, 0.8], [0.3, 0.4, 0.7, 0.9, 99]]
    image = np.ones((100, 100, 3))
    converted_keypointes = convert_keypoints_from_albumentations(keypoints, rows=image.shape[0], cols=image.shape[1],
                                                                 target_format='xyas')
    converted_keypoint_1 = convert_keypoint_from_albumentations(keypoints[0], rows=image.shape[0], cols=image.shape[1],
                                                                target_format='xyas')
    converted_keypoint_2 = convert_keypoint_from_albumentations(keypoints[1], rows=image.shape[0], cols=image.shape[1],
                                                                target_format='xyas')
    assert converted_keypointes == [converted_keypoint_1, converted_keypoint_2]
Exemple #2
0
def test_convert_keypoint_to_albumentations_and_back(kp, keypoint_format):
    image = np.ones((100, 100, 3))
    converted_kp = convert_keypoint_to_albumentations(kp, rows=image.shape[0], cols=image.shape[1],
                                                      source_format=keypoint_format)
    converted_back_kp = convert_keypoint_from_albumentations(converted_kp, rows=image.shape[0], cols=image.shape[1],
                                                             target_format=keypoint_format)
    assert converted_back_kp == kp
def test_convert_keypoint_from_albumentations(kp, target_format, expected):
    image = np.ones((100, 100, 3))
    converted_keypoint = convert_keypoint_from_albumentations(
        kp,
        rows=image.shape[0],
        cols=image.shape[1],
        target_format=target_format)
    assert converted_keypoint == expected