Subversion Repositories seema-scanner

Rev

Rev 27 | Rev 31 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27 Rev 29
Line 29... Line 29...
29
            cv::cvtColor(SMCalibrationSetI.frame0, gray, CV_RGB2GRAY);
29
            cv::cvtColor(SMCalibrationSetI.frame0, gray, CV_RGB2GRAY);
30
            cv::cornerSubPix(gray, qci0, cv::Size(5, 5), cv::Size(-1, -1),cv::TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 20, 0.001));
30
            cv::cornerSubPix(gray, qci0, cv::Size(5, 5), cv::Size(-1, -1),cv::TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 20, 0.001));
31
            // Draw colored chessboard
31
            // Draw colored chessboard
32
            SMCalibrationSetI.frame0Result = SMCalibrationSetI.frame0.clone();
32
            SMCalibrationSetI.frame0Result = SMCalibrationSetI.frame0.clone();
33
            cv::drawChessboardCorners(SMCalibrationSetI.frame0Result, patternSize, qci0, success0);
33
            cv::drawChessboardCorners(SMCalibrationSetI.frame0Result, patternSize, qci0, success0);
34
 
-
 
35
            emit newFrameResult(i, 0, SMCalibrationSetI.frame0Result);
-
 
36
        }
34
        }
37
 
35
 
-
 
36
        emit newFrameResult(i, 0, success0, SMCalibrationSetI.frame0Result);
-
 
37
 
38
        // Camera 1
38
        // Camera 1
39
        std::vector<cv::Point2f> qci1;
39
        std::vector<cv::Point2f> qci1;
40
        // Extract checker corners
40
        // Extract checker corners
41
        bool success1 = cv::findChessboardCorners(SMCalibrationSetI.frame1, patternSize, qci1, cv::CALIB_CB_ADAPTIVE_THRESH);
41
        bool success1 = cv::findChessboardCorners(SMCalibrationSetI.frame1, patternSize, qci1, cv::CALIB_CB_ADAPTIVE_THRESH);
42
        if(success1){
42
        if(success1){
Line 44... Line 44...
44
            cv::cvtColor(SMCalibrationSetI.frame1, gray, CV_RGB2GRAY);
44
            cv::cvtColor(SMCalibrationSetI.frame1, gray, CV_RGB2GRAY);
45
            cv::cornerSubPix(gray, qci1, cv::Size(5, 5), cv::Size(-1, -1),cv::TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 20, 0.001));
45
            cv::cornerSubPix(gray, qci1, cv::Size(5, 5), cv::Size(-1, -1),cv::TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 20, 0.001));
46
            // Draw colored chessboard
46
            // Draw colored chessboard
47
            SMCalibrationSetI.frame1Result = SMCalibrationSetI.frame1.clone();
47
            SMCalibrationSetI.frame1Result = SMCalibrationSetI.frame1.clone();
48
            cv::drawChessboardCorners(SMCalibrationSetI.frame1Result, patternSize, qci1, success1);
48
            cv::drawChessboardCorners(SMCalibrationSetI.frame1Result, patternSize, qci1, success1);
49
 
-
 
50
            emit newFrameResult(i, 1, SMCalibrationSetI.frame1Result);
-
 
51
        }
49
        }
52
 
50
 
-
 
51
        emit newFrameResult(i, 1, success1, SMCalibrationSetI.frame1Result);
-
 
52
 
53
        SMCalibrationSetI.success = success0 && success1;
53
        SMCalibrationSetI.success = success0 && success1;
54
 
54
 
55
        // Add to whole set
55
        // Add to whole set
56
        if(SMCalibrationSetI.success){
56
        if(SMCalibrationSetI.success){
57
            qc[0].push_back(qci0);
57
            qc[0].push_back(qci0);
Line 63... Line 63...
63
    }
63
    }
64
 
64
 
65
    int nValidSets = qc[0].size();
65
    int nValidSets = qc[0].size();
66
    if(nValidSets < 2){
66
    if(nValidSets < 2){
67
        std::cerr << "Not enough valid calibration sequences!" << std::endl;
67
        std::cerr << "Not enough valid calibration sequences!" << std::endl;
-
 
68
        emit done();
68
        return;
69
        return;
69
    }
70
    }
70
 
71
 
71
    // Generate world object coordinates [mm]
72
    // Generate world object coordinates [mm]
72
    std::vector<cv::Point3f> Qi;
73
    std::vector<cv::Point3f> Qi;