Git Product home page Git Product logo

Comments (8)

vijaychav avatar vijaychav commented on July 20, 2024 1

Hi Hemanth, I know that its been a while, but could you point out what the error was. I was able to extract the 68 feature points but need some help on getting the pose parameters from those points.

Thanks!

from clm-framework.

TadasBaltrusaitis avatar TadasBaltrusaitis commented on July 20, 2024

Hi,

You can do that using the PDM::CalcParams(Vec6d& out_params_global, const Mat_<double>& out_params_local, const Mat_<double>& landmark_locations, const Vec3d rotation) function. You can pass it the ground truth location in the landmark_locations matrix (and optional initial rotation estimate), and it will return out_params_global which will include scaling, translation, rotation parameters, which can be used with camera parameters to get a head pose estimate (or used directly, but that will not account for perspective transform).

Thanks,
Tadas

from clm-framework.

hemanthkorrapati avatar hemanthkorrapati commented on July 20, 2024

Hi,
Thanks for the quick answer. I will try this out.
Just to confirm, your approach does not account the perspective transform in visualizing the tracking results, right ?
In other words, your landmark detection and tracking process does not encode or somehow calculate the perspective information. Am I correct ?

Thank you

from clm-framework.

TadasBaltrusaitis avatar TadasBaltrusaitis commented on July 20, 2024

The landmark detection does not account for the perspective transform explicitly, neither does the CalcParams, but the Vec6d pose_estimate_to_draw = CLMTracker::GetCorrectedPoseWorld(clm_model, fx, fy, cx, cy); does as it uses the camera focal lengths and optical centers.

-Tadas

from clm-framework.

hemanthkorrapati avatar hemanthkorrapati commented on July 20, 2024

Ah, I get the complete picture now 👍 Thanks so much :)

from clm-framework.

hemanthkorrapati avatar hemanthkorrapati commented on July 20, 2024

Hi Tadas,

I 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 ?

Thanks.

#include "CLM_core.h"

#include <fstream>
#include <sstream>

#include <boost/accumulators/accumulators.hpp>


using namespace std;
using namespace cv;

int main (int argc, char **argv)
{

    // Assuming 640x490 images
    float fx = 500, fy = 500, cx = 320, cy = 245;

        //Image sequence read from a file
    std::ifstream imageFile("Path_Images.txt");
    if(!imageFile.good())
    {
        std::cout << "Image list not found." << std::endl;
        return 0;
    }

    CLMTracker::PDM pdm;
    pdm.Read("./bin/model/pdms/In-the-wild_aligned_PDM_68.txt");

    string line;
    cv::Vec6d pose_params = 0;
    while(getline(imageFile, line))
    {
        Mat im = cv::imread(line, CV_LOAD_IMAGE_COLOR);
        line.replace(line.size()-3, 3, "pts");

        cv::Mat_<double> landmarks(136, 1);
        std::ifstream landmarkFile(line.c_str());
        if(!landmarkFile.good())
        {
            std::cout << "Landmark file: " << line << " not readable" << std::endl;
            return 0;
        }
        std::cout << "Processing Image: " << line << std::endl;
        string temp;
        landmarkFile >> temp;
        landmarkFile >> temp;
        landmarkFile >> temp;
        for(int i=0; i< 68; i++)
        {
            landmarkFile >> landmarks.at<double>(i, 0);
            landmarkFile >> landmarks.at<double>(i+68, 0);
        }

        cv::Mat_<double> local_params(34, 1);
        local_params.setTo(0);
        cv::Vec3d rotation;
        rotation[0] = pose_params[3]; rotation[1] = pose_params[4]; rotation[2] = pose_params[5];
        auto t1 = std::chrono::high_resolution_clock::now();
        pdm.CalcParams( pose_params, local_params, landmarks, rotation);
        auto t2 = std::chrono::high_resolution_clock::now();
        auto timeTaken = std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1);
        std::cout << pose_params << std::endl;

        int thickness = 2;
        CLMTracker::DrawBox(im, pose_params, Scalar(0, 0, 255), thickness, fx, fy, cx, cy);
        imshow("tracking_result", im);
        waitKey(1);
    }

    return 0;
}

from clm-framework.

hemanthkorrapati avatar hemanthkorrapati commented on July 20, 2024

Never mind. Figured it out and works like a charm :)
Thanks

from clm-framework.

misakibiu avatar misakibiu commented on July 20, 2024

Hi,Tadas,
I am confused about the world coordinate, what is the original point of this world coordinate. And what about the head coordinate space? I could not find any information about it. Thanks!^O^

Jane

from clm-framework.

Related Issues (20)

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.