-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix【wrong type】about eyesCenter #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Error Info:【TypeError: Can't parse 'center'. Sequence item with index 0 has a wrong type】 Cause by: eyesCenter's element's type is numpy.int64, which is need an int type Solved by: change numpy.int64 into int type sources: eyesCenter = ((leftEyeCenter[0] + rightEyeCenter[0]) // 2, (leftEyeCenter[1] + rightEyeCenter[1]) // 2) -> eyesCenter = (int((leftEyeCenter[0] + rightEyeCenter[0]) // 2), int((leftEyeCenter[1] + rightEyeCenter[1]) // 2))
AiDeepAlgo
commented
Sep 11, 2022
I want to verify this fix, I have tested this.
I'm also asking if this can be marge and integrated into a new release.
thanks
mlgarrett
commented
Dec 30, 2022
i too would love to see this fix merged as soon as possible! i have tested it as well and casting to int does make it work.
mcp292
commented
Jan 2, 2023
Fixes #278.
iaglourenco
commented
Nov 4, 2023
Any possibility to merge this PR?
Darkiee12
commented
Nov 15, 2024
Does this fix work? I believe we need the cast to float instead here
class FaceAligner: def align(self, image, gray, rect): eyesCenter: float = ((leftEyeCenter[0] + rightEyeCenter[0]) / 2, # change from // to / to get float value (leftEyeCenter[1] + rightEyeCenter[1]) / 2) # do the same M = cv2.getRotationMatrix2D(eyesCenter, angle, scale)
As this function calls the C++ written function in OpenCV, stated here,
cv::getRotationMatrix2D(Point2f center, double angle, double scale) typedef Point_<float> cv::Point2f
Error Info:【TypeError: Can't parse 'center'. Sequence item with index 0 has a wrong type】
Cause by: eyesCenter's element's type is numpy.int64, which is need an int type
Solved by: change numpy.int64 into int type
sources: eyesCenter = ((leftEyeCenter[0] + rightEyeCenter[0]) // 2, (leftEyeCenter[1] + rightEyeCenter[1]) // 2) ->
eyesCenter = (int((leftEyeCenter[0] + rightEyeCenter[0]) // 2), int((leftEyeCenter[1] + rightEyeCenter[1]) // 2))