Skip to content
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

Fix【wrong type】about eyesCenter #270

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BeGentleman
Copy link

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))

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
Copy link

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
Copy link

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
Copy link

mcp292 commented Jan 2, 2023

Fixes #278.

@iaglourenco
Copy link

Any possibility to merge this PR?

@Darkiee12
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants