Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Created March 5, 2019 02:06
Show Gist options
  • Select an option

  • Save treyhuffine/6d005156cb451360ff0e08db0fc46ef4 to your computer and use it in GitHub Desktop.

Select an option

Save treyhuffine/6d005156cb451360ff0e08db0fc46ef4 to your computer and use it in GitHub Desktop.
vector<Point3f> objectPoints {
{8.27412, 1.33849, 10.63490}, //left eye corner
{-8.27412, 1.33849, 10.63490}, //right eye corner
{0, -4.47894, 17.73010}, //nose tip
{-4.61960, -10.14360, 12.27940}, //right mouth corner
{4.61960, -10.14360, 12.27940}, //left mouth corner
};
vector<int> landmarksIDsFor3DPoints {45, 36, 30, 48, 54}; // 0-index
// ...
vector<Point2f> points2d;
for (int pId : landmarksIDsFor3DPoints) {
points2d.push_back(shapes[0][pId] / scaleFactor);
}
solvePnP(objectPoints, points2d, K, Mat(), rvec, tvec, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment