fix: perspective -> affine, same effect since it's an orthogonal projection
This commit is contained in:
parent
ea1732eddf
commit
5bfa5b763f
|
@ -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],
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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],
|
||||
|
|
Loading…
Reference in a new issue