Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
BeGentleman wants to merge 1 commit into PyImageSearch:master
base: master
Choose a base branch
Loading
from BeGentleman:patch-1

Conversation

@BeGentleman
Copy link

@BeGentleman BeGentleman commented Apr 2, 2022

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

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.

Copy link

mcp292 commented Jan 2, 2023

Fixes #278.

Copy link

Any possibility to merge this PR?

pe712 reacted with thumbs up emoji

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

Reviewers

1 more reviewer

@Cozmo25 Cozmo25 Cozmo25 approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /