From 0f94dce1cb3aab510d5c39e9e976fe2381b968de Mon Sep 17 00:00:00 2001 From: NirZarrabi Date: Wed, 12 Jun 2019 14:48:39 +0300 Subject: [PATCH] changed warpPerspective to warpAffine at line 380 (#328) since the transformation is affine and not perspective it is more efficient to use the warpAffine function --- utils/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/datasets.py b/utils/datasets.py index d9749ca6..98d855e0 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -371,7 +371,7 @@ def random_affine(img, targets=(), degrees=(-10, 10), translate=(.1, .1), scale= S[1, 0] = math.tan((random.random() * (shear[1] - shear[0]) + shear[0]) * math.pi / 180) # y shear (deg) M = S @ T @ R # Combined rotation matrix. ORDER IS IMPORTANT HERE!! - imw = cv2.warpPerspective(img, M, dsize=(width, height), flags=cv2.INTER_LINEAR, + imw = cv2.warpAffine(img, M[:2], dsize=(width, height), flags=cv2.INTER_LINEAR, borderValue=borderValue) # BGR order borderValue # Return warped points also