Ask Your Question

Face Landmark Cropping using Android

asked 2017-11-23 22:30:20 -0500

Hi every, I am successful detect the face landmarks using dlib library, now i need to crop that area of face using opencv, I am beginner of openCv, kindly any one help out from this problem. I'll be thankful, i have attached the demo image just for concept i want need to crop.

image description


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-11-24 02:19:36 -0500

Okay some keypoints

  • You no longer need dlib for facial landmark detection, since OpenCV has its own interface, right here
  • Secondly, once you have the landmarks, they should be stored in a vector<Point>. On top of that you can call the convexHull function to find a surrounding contour of the keypoints.
  • Thirdly, on that convexHull you either apply boundingRect or minAreaRect to get a upright or rotated bounding rectangle.
edit flag offensive delete link more



Respected Steven,

Thank you so much for your kind reply, Let me try.


Shujaat Ali gravatar imageShujaat Ali ( 2017-11-24 02:33:12 -0500 )edit

I have search Opencv manual on google but i can't understand any thing from there, so again ..... I have get the points from the image , so how can i cropping the face area using this points?? Code : ArrayList<point> landmarks = ret.getFaceLandmarks(); for (Point point : landmarks) { int pointX = (int) (point.x * resizeRatio); int pointY = (int) (point.y * resizeRatio); canvas.drawCircle(pointX, pointY, 2, mFaceLandmardkPaint); } I really appreciate, if you people help me out thanks ...

Shujaat Ali gravatar imageShujaat Ali ( 2017-11-24 09:35:27 -0500 )edit

I guess you have to read again. If you have the points, put them into a vector and call the function boundingRect on that vector of points.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-11-27 04:46:11 -0500 )edit

Hello StevenPuttemans sir, Sir, i am android developer, and i want to crop face area from facial landmarks only, so that face is cropped by using landmark points. please provide your help, to achieve that,

Waiting for your reply sir...

Many Thanks sir Naveen

Naveen pachal gravatar imageNaveen pachal ( 2018-05-08 03:03:45 -0500 )edit

Naveen, please have a look at the documentation ... Also, next time, let's not hijack an old topic, but open a new question!

StevenPuttemans gravatar imageStevenPuttemans ( 2018-05-08 03:39:35 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2017-11-23 22:30:20 -0500

Seen: 165 times

Last updated: Nov 24 '17