def test_convert_keypoints_to_albumentations(): keypoints = [[20, 30, 40, 50], [30, 40, 50, 60, 99]] image = np.ones((100, 100, 3)) converted_keypoints = convert_keypoints_to_albumentations(keypoints, rows=image.shape[0], cols=image.shape[1], source_format='xyas') converted_keypoint_1 = convert_keypoint_to_albumentations(keypoints[0], rows=image.shape[0], cols=image.shape[1], source_format='xyas') converted_keypoint_2 = convert_keypoint_to_albumentations(keypoints[1], rows=image.shape[0], cols=image.shape[1], source_format='xyas') assert converted_keypoints == [converted_keypoint_1, converted_keypoint_2]
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_to_albumentations(kp, source_format, expected): image = np.ones((100, 100, 3)) converted_keypoint = convert_keypoint_to_albumentations( kp, rows=image.shape[0], cols=image.shape[1], source_format=source_format ) assert converted_keypoint == expected