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