Chain Cross
Chain Cross

Reputation: 351

Vision API Cropping Face Landmark

I'm trying to outline the whole image with a path so I could crop it out, but the path is not following the face's outline. Here's my code :

 for (Landmark landmark : face.getLandmarks()) {
                    if (face.getLandmarks().indexOf(landmark) == 0) {
                        path.moveTo(landmark.getPosition().x, landmark.getPosition().y);
                    } else {
                        path.lineTo(landmark.getPosition().x, landmark.getPosition().y);
                    }
            }

enter image description here

How do I make it so that the path only follows the outer outline of the face

Upvotes: 1

Views: 126

Answers (1)

Brendan
Brendan

Reputation: 1060

Look at the Type of each landmark. If you are looking at types, you will know which landmark to use next rather than whichever landmark is next in the array.

Upvotes: 1

Related Questions