Subversion Repositories seema-scanner

Rev

Rev 90 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 90 Rev 141
Line -... Line 1...
-
 
1
#include <QTime>
1
#include <iostream>
2
#include <iostream>
2
 
3
 
3
#include <cvtools.h>
4
#include <cvtools.h>
4
 
5
 
5
int main(int argc, char *argv[]){
6
int main(int argc, char *argv[]){
6
 
7
 
7
    // TEST rotation axis determination
8
    QTime time;
8
    float checkerSize = 4.0;
9
    time.start();
9
 
10
 
10
    std::vector<cv::Point3f> Qobj;
11
//    // TEST rotation axis determination
11
    for (int h=-3; h<=3; h+=2)
12
//    float checkerSize = 4.0;
12
        for (int w=-3; w<=3; w+=2)
-
 
13
            Qobj.push_back(cv::Point3f(checkerSize * w, checkerSize* h, 0.0));
-
 
14
 
13
 
-
 
14
//    std::vector<cv::Point3f> Qobj;
-
 
15
//    for (int h=-3; h<=3; h+=2)
-
 
16
//        for (int w=-3; w<=3; w+=2)
-
 
17
//            Qobj.push_back(cv::Point3f(checkerSize * w, checkerSize* h, 0.0));
15
 
18
 
16
    std::vector< std::vector<cv::Point3f> > Qcam(20);
-
 
17
 
19
 
18
    for(int i=0; i<20; i++){
20
//    std::vector< std::vector<cv::Point3f> > Qcam(20);
19
 
21
 
20
        float angleRadians = (i * 5)/180.0*M_PI;
-
 
21
        cv::Vec3f rvec(0.0, 0.0, angleRadians);
-
 
22
        cv::Matx33f R;
-
 
23
        cv::Rodrigues(rvec, R);
22
//    for(int i=0; i<20; i++){
24
 
23
 
-
 
24
//        float angleRadians = (i * 5)/180.0*M_PI;
-
 
25
//        cv::Vec3f rvec(0.0, 0.0, angleRadians);
-
 
26
//        cv::Matx33f R;
25
        Qcam[i].resize(Qobj.size());
27
//        cv::Rodrigues(rvec, R);
26
 
28
 
27
        for(int j=0; j<Qobj.size(); j++)
29
//        Qcam[i].resize(Qobj.size());
28
            Qcam[i][j] = R*(Qobj[j]-cv::Point3f(-2,-0,-0)) + cv::Point3f(-2,-0,-0);
-
 
29
    }
-
 
30
 
30
 
31
    cv::Vec3f axis, point;
31
//        for(int j=0; j<Qobj.size(); j++)
-
 
32
//            Qcam[i][j] = R*(Qobj[j]-cv::Point3f(-2,-0,-0)) + cv::Point3f(-2,-0,-0);
-
 
33
//    }
32
 
34
 
33
    cvtools::rotationAxisCalibration(Qcam, Qobj, axis, point);
35
//    cv::Vec3f axis, point;
34
 
36
 
-
 
37
//    cvtools::rotationAxisCalibration(Qcam, Qobj, axis, point);
-
 
38
 
35
    std::cout << "axis: " << axis << std::endl;
39
//    std::cout << "axis: " << axis << std::endl;
36
    std::cout << "point: " << point << std::endl;
40
//    std::cout << "point: " << point << std::endl;
-
 
41
 
-
 
42
    cv::Mat frame = cv::imread("frame.png");
-
 
43
 
-
 
44
    std::cout << time.restart() << "ms" << std::endl;
-
 
45
 
-
 
46
    cvtools::imwritePNG("frame2.png", frame);
-
 
47
//    cv::imwrite("frame2.tiff", frame, compression_params);
-
 
48
 
-
 
49
    std::cout << time.restart() << "ms" << std::endl;
37
 
50
 
38
    return 0;
51
    return 0;
39
}
52
}