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

This reverts commit 5bfa5b763f.
This commit is contained in:
Laureηt 2023-01-12 08:19:56 +01:00
parent 5bfa5b763f
commit eb2cf131d5
Signed by: Laurent
SSH key fingerprint: SHA256:kZEpW8cMJ54PDeCvOhzreNr4FSh6R13CMGH/POoO8DI
10 changed files with 37 additions and 37 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -24,7 +24,7 @@ if __name__ == "__main__":
# setup logging format # setup logging format
logging.basicConfig( logging.basicConfig(
level=logging.INFO, level=logging.INFO,
format="%(asctime)s %(name)s %(levelname)-8s %(message)s", format="%(asctime)s %(name)s %(levelname)-8s %(message)s",
datefmt="(%F %T)", datefmt="(%F %T)",
) )