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

How to show the keypoints? #9

Open
Rich700000000000 opened this issue Jun 17, 2016 · 2 comments
Open

How to show the keypoints? #9

Rich700000000000 opened this issue Jun 17, 2016 · 2 comments

Comments

@Rich700000000000
Copy link

In faceswap.py there is this chunk of code:

def annotate_landmarks(im, landmarks):
    im = im.copy()
    for idx, point in enumerate(landmarks):
        pos = (point[0, 0], point[0, 1])
        cv2.putText(im, str(idx), pos,
                    fontFace=cv2.FONT_HERSHEY_SCRIPT_SIMPLEX,
                    fontScale=0.4,
                    color=(0, 0, 255))
        cv2.circle(im, pos, 3, color=(0, 255, 255))
    return im

Which I assume was used to generate like this image. However, the code was never used and despite my attempts I can't seem to get it working. Can you show me how it worked?

@brycepg
Copy link

brycepg commented Sep 5, 2016

You can apply the annotation directly to the source images after read_im_and_get_landmarks

im1, landmarks1 = read_im_and_landmarks(sys.argv[1])
im2, landmarks2 = read_im_and_landmarks(sys.argv[2])
im1_annotated = annotate_landmarks(im1, landmarks1)
im2_annotated = annotate_landmarks(im2, landmarks2)
cv2.imwrite('output-src1-annotate.jpg', im1_annotated)
cv2.imwrite('output-src2-annotate.jpg', im2_annotated)

output-src2-annotate

@Rich700000000000
Copy link
Author

Cool, thanks.

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