Exemplo n.º 1
0
void CalibrationWindow::signalEnd() {
	QMessageBox::information(this, "Calibration running", "Please wait until the calibration is over. This can take a while...");

	StereoCalib("list.txt", 9, 6, 0, 2.5);

	this->deleteLater();
}
Exemplo n.º 2
0
int main(){
    // connect to the cameras
    VideoCapture leftCam(1);
    VideoCapture rightCam(2);
    char response[4];
    // if needed: Capture calibration images and save to disk
    printf("Would you like to capture new calibration images? (y/n): ");
    fgets(response, sizeof response, stdin);
    bool recapture = (response[0] == 'y');
    if (recapture) {
        calibCapture( leftCam, rightCam );
    }
    // if needed: calibrate the cameras
    printf("Would you like to recalibrate the cameras? (y/n): ");
    fgets(response, sizeof response, stdin);
    bool recalibrate = (response[0] == 'y');
    if (recalibrate) {
        vector<string> imageList;
        bool read_ok = readStringList("calib/image_list.xml", imageList);
        if(!read_ok || imageList.empty()) {
            cout << "Failed to read calibration image list (calib/image_list.xml)" << endl;
            return 1;
        }
        FileStorage fs("calib/image_list.xml", FileStorage::READ);
        int boardSizeX = (int)fs["boardSizeX"];
        int boardSizeY = (int)fs["boardSizeY"];
        Size boardSize(boardSizeX, boardSizeY);
        fs.release();

        cout << "calibrating cameras...";
        StereoCalib(imageList, boardSize, true, true);
    }
    StereoMatcher sm("calib/intrinsics.yml", "calib/extrinsics.yml");
    Mat left, right, disp;
    left = imread("calib/left1.bmp");
    right = imread("calib/right1.bmp");
    sm.getDisp(left, right, disp);
    namedWindow("Disparity");
    imshow("Disparity", disp);
    waitKey(-1);
    while(1){
        // grab images from left and right cameras
        // rectify images
        // calculate disparity
        // show depth map
        // break if exit condition
        break;
    }
    return 0;
}
void MainWindow::on_calibrateCams_clicked()
{
    // This function will use the
    // ListOfPics file to calibrate
    // the cameras
    QMessageBox::StandardButton check;
    check = QMessageBox::question(this,tr("Info"),tr("| You have images ready to be calibrated |"),
                          QMessageBox::Yes|QMessageBox::No);

    if (check == QMessageBox::Yes ){
        check = QMessageBox::question(this,tr("Info"),tr("| Ok calibrating now....|"));
        StereoCalib();
    }else
        check = QMessageBox::question(this,tr("Info"),tr("| Take pictures of chessboard and then calibrate....|"));
}