fix: perspective -> affine, same effect since it's an orthogonal projection

This commit is contained in:
Laureηt 2022-12-29 20:25:12 +01:00
parent ea1732eddf
commit 5bfa5b763f
Signed by: Laurent
SSH key fingerprint: SHA256:kZEpW8cMJ54PDeCvOhzreNr4FSh6R13CMGH/POoO8DI
9 changed files with 36 additions and 36 deletions

View file

@ -46,13 +46,13 @@ class Crown:
).astype(np.float32)
# get perspective transform
transform_mat = cv2.getPerspectiveTransform(
self.bouding_box,
self.translated_box,
transform_mat = cv2.getAffineTransform(
self.bouding_box[:-1, :],
self.translated_box[:-1, :],
)
# apply perspective transform to image
warped = cv2.warpPerspective(
warped = cv2.warpAffine(
self.image,
transform_mat,
self.env.frame.shape[1::-1],

View file

@ -46,13 +46,13 @@ class Head:
).astype(np.float32)
# get perspective transform
transform_mat = cv2.getPerspectiveTransform(
self.bouding_box,
self.translated_head_box,
transform_mat = cv2.getAffineTransform(
self.bouding_box[:-1, :],
self.translated_head_box[:-1, :],
)
# apply perspective transform to image
warped = cv2.warpPerspective(
warped = cv2.warpAffine(
self.image,
transform_mat,
self.env.frame.shape[1::-1],

View file

@ -46,13 +46,13 @@ class LeftEar:
).astype(np.float32)
# get perspective transform
transform_mat = cv2.getPerspectiveTransform(
self.bouding_box,
self.translated_box,
transform_mat = cv2.getAffineTransform(
self.bouding_box[:-1, :],
self.translated_box[:-1, :],
)
# apply perspective transform to image
warped = cv2.warpPerspective(
warped = cv2.warpAffine(
self.image,
transform_mat,
self.env.frame.shape[1::-1],

View file

@ -46,13 +46,13 @@ class LeftEye:
).astype(np.float32)
# get perspective transform
transform_mat = cv2.getPerspectiveTransform(
self.bouding_box,
self.translated_box,
transform_mat = cv2.getAffineTransform(
self.bouding_box[:-1, :],
self.translated_box[:-1, :],
)
# apply perspective transform to image
warped = cv2.warpPerspective(
warped = cv2.warpAffine(
self.image,
transform_mat,
self.env.frame.shape[1::-1],

View file

@ -46,13 +46,13 @@ class LeftMoustache:
).astype(np.float32)
# get perspective transform
transform_mat = cv2.getPerspectiveTransform(
self.bouding_box,
self.translated_box,
transform_mat = cv2.getAffineTransform(
self.bouding_box[:-1, :],
self.translated_box[:-1, :],
)
# apply perspective transform to image
warped = cv2.warpPerspective(
warped = cv2.warpAffine(
self.image,
transform_mat,
self.env.frame.shape[1::-1],

View file

@ -46,13 +46,13 @@ class Mouth:
).astype(np.float32)
# get perspective transform
transform_mat = cv2.getPerspectiveTransform(
self.bouding_box,
self.translated_box,
transform_mat = cv2.getAffineTransform(
self.bouding_box[:-1, :],
self.translated_box[:-1, :],
)
# apply perspective transform to image
warped = cv2.warpPerspective(
warped = cv2.warpAffine(
self.image,
transform_mat,
self.env.frame.shape[1::-1],

View file

@ -46,13 +46,13 @@ class RightEar:
).astype(np.float32)
# get perspective transform
transform_mat = cv2.getPerspectiveTransform(
self.bouding_box,
self.translated_box,
transform_mat = cv2.getAffineTransform(
self.bouding_box[:-1, :],
self.translated_box[:-1, :],
)
# apply perspective transform to image
warped = cv2.warpPerspective(
warped = cv2.warpAffine(
self.image,
transform_mat,
self.env.frame.shape[1::-1],

View file

@ -46,13 +46,13 @@ class RightEye:
).astype(np.float32)
# get perspective transform
transform_mat = cv2.getPerspectiveTransform(
self.bouding_box,
self.translated_box,
transform_mat = cv2.getAffineTransform(
self.bouding_box[:-1, :],
self.translated_box[:-1, :],
)
# apply perspective transform to image
warped = cv2.warpPerspective(
warped = cv2.warpAffine(
self.image,
transform_mat,
self.env.frame.shape[1::-1],

View file

@ -46,13 +46,13 @@ class RightMoustache:
).astype(np.float32)
# get perspective transform
transform_mat = cv2.getPerspectiveTransform(
self.bouding_box,
self.translated_box,
transform_mat = cv2.getAffineTransform(
self.bouding_box[:-1, :],
self.translated_box[:-1, :],
)
# apply perspective transform to image
warped = cv2.warpPerspective(
warped = cv2.warpAffine(
self.image,
transform_mat,
self.env.frame.shape[1::-1],