tzutalin / dlib-android

:dragon: Port dlib to Android
MIT License
865 stars 268 forks source link

I need to crop the face landmarks #74

Open SHUJAAT-DEV opened 6 years ago

SHUJAAT-DEV commented 6 years ago

Hi, I want to crop the face landmark , can any one please send me the suggestion. I'll be thankful that person.

Thanks

ScotticRobotic commented 6 years ago

I am assuming you want to crop the face different than the detection box and around the face landmarks? It really depends on how you want to crop.

In general, you have landmarks and their x,y coordinates in the frame. You need to find an x,y for the top left corner and an x,y for the bottom right corner (i.e. a new bounding box). You could find some center x,y of the face (like the nose) and -/+ a value from it (scaled based on a distance, like the distance between the eyes).

Look in OnImageListener.java, and do these operations near the for loop that draws the landmarks on the bitmap.