问题
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);
}
}
How do I make it so that the path only follows the outer outline of the face
回答1:
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.
来源:https://stackoverflow.com/questions/55533133/vision-api-cropping-face-landmark