{"action":"created","issue":{"url":"https://api.github.com/repos/TadasBaltrusaitis/CLM-framework/issues/36","repository_url":"https://api.github.com/repos/TadasBaltrusaitis/CLM-framework","labels_url":"https://api.github.com/repos/TadasBaltrusaitis/CLM-framework/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/TadasBaltrusaitis/CLM-framework/issues/36/comments","events_url":"https://api.github.com/repos/TadasBaltrusaitis/CLM-framework/issues/36/events","html_url":"https://github.com/TadasBaltrusaitis/CLM-framework/issues/36","id":147477570,"number":36,"title":"Head pose estimation","user":{"login":"hemanthkorrapati","id":8028905,"avatar_url":"https://avatars.githubusercontent.com/u/8028905?v=3","gravatar_id":"","url":"https://api.github.com/users/hemanthkorrapati","html_url":"https://github.com/hemanthkorrapati","followers_url":"https://api.github.com/users/hemanthkorrapati/followers","following_url":"https://api.github.com/users/hemanthkorrapati/following{/other_user}","gists_url":"https://api.github.com/users/hemanthkorrapati/gists{/gist_id}","starred_url":"https://api.github.com/users/hemanthkorrapati/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hemanthkorrapati/subscriptions","organizations_url":"https://api.github.com/users/hemanthkorrapati/orgs","repos_url":"https://api.github.com/users/hemanthkorrapati/repos","events_url":"https://api.github.com/users/hemanthkorrapati/events{/privacy}","received_events_url":"https://api.github.com/users/hemanthkorrapati/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-11T16:06:53Z","updated_at":"2016-04-12T15:01:05Z","closed_at":null,"body":"Hi, \r\nI see that the head pose estimation is encoded in clm_model.params_global and clm_model.params_local which are being updated in CLMTracker::PDM::CalcParams and CLMTracker::CLM::NU_RLMS. Is there a way by which I can just retrieve the head pose estimation using the ground truth labelling of the landmark positions ? For example, like the algorithm 1 in your thesis which takes as input the parameters learned offline on the training data and the landmarks and outputs the pose information p.\r\n\r\nThank you"},"comment":{"url":"https://api.github.com/repos/TadasBaltrusaitis/CLM-framework/issues/comments/208949771","html_url":"https://github.com/TadasBaltrusaitis/CLM-framework/issues/36#issuecomment-208949771","issue_url":"https://api.github.com/repos/TadasBaltrusaitis/CLM-framework/issues/36","id":208949771,"user":{"login":"hemanthkorrapati","id":8028905,"avatar_url":"https://avatars.githubusercontent.com/u/8028905?v=3","gravatar_id":"","url":"https://api.github.com/users/hemanthkorrapati","html_url":"https://github.com/hemanthkorrapati","followers_url":"https://api.github.com/users/hemanthkorrapati/followers","following_url":"https://api.github.com/users/hemanthkorrapati/following{/other_user}","gists_url":"https://api.github.com/users/hemanthkorrapati/gists{/gist_id}","starred_url":"https://api.github.com/users/hemanthkorrapati/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hemanthkorrapati/subscriptions","organizations_url":"https://api.github.com/users/hemanthkorrapati/orgs","repos_url":"https://api.github.com/users/hemanthkorrapati/repos","events_url":"https://api.github.com/users/hemanthkorrapati/events{/privacy}","received_events_url":"https://api.github.com/users/hemanthkorrapati/received_events","type":"User","site_admin":false},"created_at":"2016-04-12T15:01:05Z","updated_at":"2016-04-12T15:01:05Z","body":"Hi Tadas,\r\n\r\nI tried to use the CalcParams() function in a standalone fashion. But I am not getting the correct head pose. I am sure that I am doing something wrong. Could you take a look at the minimal code below and give your opinion ?                 \r\n\r\nThanks.\r\n============================================================================\r\n``` cpp\r\n#include \"CLM_core.h\"\r\n\r\n#include <fstream>\r\n#include <sstream>\r\n\r\n#include <boost/accumulators/accumulators.hpp>\r\n\r\n\r\nusing namespace std;\r\nusing namespace cv;\r\n\r\nint main (int argc, char **argv)\r\n{\r\n\r\n\t// Assuming 640x490 images\r\n\tfloat fx = 500, fy = 500, cx = 320, cy = 245;\r\n\r\n        //Image sequence read from a file\r\n\tstd::ifstream imageFile(\"Path_Images.txt\");\r\n\tif(!imageFile.good())\r\n\t{\r\n\t\tstd::cout << \"Image list not found.\" << std::endl;\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tCLMTracker::PDM pdm;\r\n\tpdm.Read(\"./bin/model/pdms/In-the-wild_aligned_PDM_68.txt\");\r\n\r\n\tstring line;\r\n\tcv::Vec6d pose_params = 0;\r\n\twhile(getline(imageFile, line))\r\n\t{\r\n\t\tMat im = cv::imread(line, CV_LOAD_IMAGE_COLOR);\r\n\t\tline.replace(line.size()-3, 3, \"pts\");\r\n\r\n\t\tcv::Mat_<double> landmarks(136, 1);\r\n\t\tstd::ifstream landmarkFile(line.c_str());\r\n\t\tif(!landmarkFile.good())\r\n\t\t{\r\n\t\t\tstd::cout << \"Landmark file: \" << line << \" not readable\" << std::endl;\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tstd::cout << \"Processing Image: \" << line << std::endl;\r\n\t\tstring temp;\r\n\t\tlandmarkFile >> temp;\r\n\t\tlandmarkFile >> temp;\r\n\t\tlandmarkFile >> temp;\r\n\t\tfor(int i=0; i< 68; i++)\r\n\t\t{\r\n\t\t\tlandmarkFile >> landmarks.at<double>(i, 0);\r\n\t\t\tlandmarkFile >> landmarks.at<double>(i+68, 0);\r\n\t\t}\r\n\r\n\t\tcv::Mat_<double> local_params(34, 1);\r\n\t\tlocal_params.setTo(0);\r\n\t\tcv::Vec3d rotation;\r\n\t\trotation[0] = pose_params[3]; rotation[1] = pose_params[4]; rotation[2] = pose_params[5];\r\n\t\tauto t1 = std::chrono::high_resolution_clock::now();\r\n\t\tpdm.CalcParams( pose_params, local_params, landmarks, rotation);\r\n\t\tauto t2 = std::chrono::high_resolution_clock::now();\r\n\t\tauto timeTaken = std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1);\r\n\t\tstd::cout << pose_params << std::endl;\r\n\r\n\t\tint thickness = 2;\r\n\t\tCLMTracker::DrawBox(im, pose_params, Scalar(0, 0, 255), thickness, fx, fy, cx, cy);\r\n\t\timshow(\"tracking_result\", im);\r\n\t\twaitKey(1);\r\n\t}\r\n\r\n\treturn 0;\r\n}\r\n``` \r\n============================================================================"}}