Camera calibration using CalibrationApp

2010-07-22
2013-05-09
  • Dear Sir,
    I would like to thank you for your help previously while dealing with the point grey cameras. I am referring your Computer Vision Principles and Vision book for calibrating two webcams at a time. It is mentioned in the book that I should use CStereoCalibration class for a stereo camera system. However, there is an application  named CalibrationApp (that came with IVT installation)  which also calibrates more than one camera at a time if I am not wrong. Can I use this application to calibrate two webcams at a time?

    There is a parameter named CAMERA_CALIBRATION_PARAMETER_FILENAMEwhich is defined as "camera_armar_640x480.txt" at the beginning of the CalibrationApp application. Does this file save camera calibration results? If so, how will I know which ones are intrinsic and which one’s are extrinsic parameters? I will be thankful to you if you can guide me in this regard.

    Have a nice day.

     
  • Pedram Azad
    Pedram Azad
    2010-07-22

    Hi,

    you are confusing two things:

    1. IVT/examples/CalibrationApp is the application to perform calibration, i.e. produce a file that contains the camera parameters. The target file name for this target file is specified by the define CAMERA_CALIBRATION_PARAMETER_FILENAME, which is usually set to "cameras.txt". This file is read by various classes for initialization (e.g. CCalibration, CStereoCalibration, CUndistortion, CRectification, CStereoMatcher).

    2. CStereoCalibration is a class that can read the camera parameter file (e.g. "cameras.txt") produced by CalibrationApp. By reading this file, the instance of CStereoCalibration reads all information about your camera setup, and you can easily computer projection and back projection for both cameras, compute epipolar lines, and perform stereo triangulation.

    I hope that helps.

    Pedram

     
  • Hello sir,
    Thanks for the reply. I have been trying to calibrate 2 web cams using calibrationapp application as you have mentioned in point one in your previous message. I am using a 7rows by 9 columns chessboard calibration frame for calibration.

    In OpenCVCalibrationAlgorithm class file, while debugging the below mentioned code,the message "corner picture taken" is shown on the command prompt but m_pCalibFilter->IsCalibrated() is always false. ppIplImages is also not set properly. The roi and maskROI paramenters for ppIplImages  has CXX0030: Error: expression cannot be evaluated. Could you please let me what could be the problem here?
    m_pCalibFilter->DrawPoints(ppIplImages);
    if ((nTotalCount++ % 20) == 0)
    {
    printf("corner picture taken\n");
    m_pCalibFilter->Push();

    if (m_pCalibFilter->IsCalibrated())
    {
    m_pCalibFilter->SaveCameraParams(m_sCameraParameterFileName.c_str());
    return true;
    }
    }

     
  • Pedram Azad
    Pedram Azad
    2010-07-27

    Hello,

    with the default settings, you have to wait for "corner picture taken" to appear 20 times. See also this thread for additional information/hints on calibration:

    https://sourceforge.net/projects/ivt/forums/forum/522991/topic/1953746

    I don't exactly understand what you mean with the error for maskROI. Where in the code is that? Do you get a segfault?

    Which version of OpenCV are you using? It is guaranteed to work fine with OpenCV 1.0. I haven't tested with OpenCV 2.0 yet. Also note that the distortion model has changed from OpenCV 1.0 to OpenCV 2.0 (a fifth parameter was added), which is why it is recommended to use OpenCV 1.0 with the IVT, in order to guarantee compatibility of the file formats.

    Pedram

    Pedram

     
  • Hello Sir,
    Thankyou very much for your inputs. I am using Opencv 1.0 version. After the corner pictures are taken 20 times, this message appears in the message box: "one of arguments' values is out of range (Principal point must be within the image) in function cvCalibrateCamera2". Do you have any idea why I am getting this message?Thanks

     
  • Hello sir, the problem is resolved. The cameras were not set properly. After resetting it, I was able to generate the calibration parameters text file. Thanks for all your help.