Subversion Repositories seema-scanner

Rev

Rev 89 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#include <iostream>

#include <cvtools.h>

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

    // TEST rotation axis determination
    float checkerSize = 4.0;

    std::vector<cv::Point3f> Qobj;
    for (int h=-3; h<=3; h+=2)
        for (int w=-3; w<=3; w+=2)
            Qobj.push_back(cv::Point3f(checkerSize * w, checkerSize* h, 0.0));


    std::vector< std::vector<cv::Point3f> > Qcam(20);

    for(int i=0; i<20; i++){

        float angleRadians = (i * 5)/180.0*M_PI;
        cv::Vec3f rvec(0.0, 0.0, angleRadians);
        cv::Matx33f R;
        cv::Rodrigues(rvec, R);

        Qcam[i].resize(Qobj.size());

        for(int j=0; j<Qobj.size(); j++)
            Qcam[i][j] = R*(Qobj[j]-cv::Point3f(-2,-0,-0)) + cv::Point3f(-2,-0,-0);
    }

    cv::Vec3f axis, point;

    cvtools::rotationAxisCalibration(Qcam, Qobj, axis, point);

    std::cout << "axis: " << axis << std::endl;
    std::cout << "point: " << point << std::endl;

    return 0;
}