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

cv2 error #17

Open
delray opened this issue May 21, 2024 · 6 comments
Open

cv2 error #17

delray opened this issue May 21, 2024 · 6 comments

Comments

@delray
Copy link

delray commented May 21, 2024

Hi, Just trying your example code and I get :

Starting face averaging for 10 faces.
Image 1 / 10
Traceback (most recent call last):
  File "D:\Facer\facer.py", line 13, in <module>
    average_face = facer.create_average_face(faces, landmarks, save_image=True)
  File "D:\Facer\facer\facer.py", line 224, in create_average_face
    dt = calculateDelaunayTriangles(rect, np.array(pointsAvg))
  File "D:\Facer\facer\utils.py", line 62, in calculateDelaunayTriangles
    subdiv.insert((p[0], p[1]))
cv2.error: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\subdivision2d.cpp:288: error: (-211:One of the arguments' values is out of range)  in function 'cv::Subdiv2D::locate'

Anyone with ideas about this one?

@johnwmillr
Copy link
Owner

Does the code work for you on some images but not others? Or do you get this error no matter what? It could be specific to the image you're running the code on.

@delray
Copy link
Author

delray commented May 21, 2024

I tried looking into that and deleted a few. Should they be the same pixel dimensions? Otherwise, they all have csv landmark files created for them, and all have 67 lines in them, so it seems like it should be OK.

@johnwmillr
Copy link
Owner

If you don't mind uploading an example image that's producing the error, that will help with debugging.

@delray
Copy link
Author

delray commented May 22, 2024

sure, I was using these two...also included the .csl files in case that is helpful. thanks so much!

3994169c8d6bbf39265d1618b1c7f60f
3994169c8d6bbf39265d1618b1c7f60f_landmarks_0.csv
20231222111228-6585b9ff46236751c52f3251jpeg
20231222111228-6585b9ff46236751c52f3251jpeg_landmarks_0.csv

@delray
Copy link
Author

delray commented May 28, 2024

Any ideas on why i might be getting that error?

@johnwmillr
Copy link
Owner

Hi there, I'm just now getting a chance to take a look. I took screenshots of the two images you provided and ran facer on them without issue.

image

The fact that a screenshot worked for me potentially suggests that it's the format your image is saved in, rather than the specific content of the image (i.e. the arrangement of the face) that is causing problems.

It also looks like the landmarks you provided are correctly identifying the face. You could try updating to a newer version of Open CV and dlib. I'm not sure what else to suggest given that I can't reproduce your error.

image

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

No branches or pull requests

2 participants