Git Product home page Git Product logo

face-yaw-roll-pitch-from-pose-estimation-using-opencv's Introduction

Face-Yaw-Roll-Pitch-from-Pose-Estimation-using-OpenCV

Description

This work is used for pose estimation(yaw, pitch and roll) by Face landmarks(left eye, right eye, nose, left mouth, right mouth and chin). Roll:+90°:-90°/Pitch:+90°:-90°/Yaw:+90°:-90°, like the picture below:

Roll_Pitch_Yaw.png

The order of numbers is ROLL, PITCH, YAWJay_Result1.png Jay_Result2.png Jay_Result3.png

Preprocessing

  • I fine-tune the MTCNN into the output of 6 landmark feature points, reference and make some adjustments in this article 'Head Pose Estimation using OpenCV and Dlib'.
  • Because the MTCNN's eyes are the middle of the position rather than the corner of the eye, so we modify the world coordinate(model point) from original to (-150.0, -150.0, -125.0)# Left Mouth corner/(150.0, -150.0, -125.0)# Right mouth corner
  • Modify the camera matrix's focal_length from original to img_size[1]/2 / np.tan(60/2 * np.pi / 180).

Step

  1. imgpts, jac = cv2.projectPoints(axis, rotation_vector, translation_vector, camera_matrix, dist_coeffs)
  2. modelpts, jac2 = cv2.projectPoints(model_points, rotation_vector, translation_vector, camera_matrix, dist_coeffs)
  3. rvec_matrix = cv2.Rodrigues(rotation_vector)[0]
  4. proj_matrix = np.hstack((rvec_matrix, translation_vector))
  5. eulerAngles = cv2.decomposeProjectionMatrix(proj_matrix)[6]
  6. pitch, yaw, roll = [math.radians(_) for _ in eulerAngles]
  7. pitch = math.degrees(math.asin(math.sin(pitch)))
  8. roll = -math.degrees(math.asin(math.sin(roll)))
  9. yaw = math.degrees(math.asin(math.sin(yaw)))

References

  1. Head Pose Estimation using OpenCV and Dlib
  2. MTCNN-tensorflow

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.