Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

StereoCalibrate - error: (-206) in function cvReleaseMat


I try to calibrate two cameras. When I call cv::stereoCalibrate I get the following error

C:\builds\2_4_PackSlave-win32-vc12-shared\opencv\modules\core\src\array.cpp:190: error: (-206) in function cvReleaseMat

I have really no clue why this happens and how to solve it. And I have no idea what error -206 means.

Here is the part of my code:

StereoCalibrationStruct stereoCali;

    stereoCali.cameraMatrix1 = img1It->second.cameraMatrix;
    stereoCali.distortion1 = img1It->second.distortion;
    stereoCali.cameraMatrix2 = img2It->second.cameraMatrix;
    stereoCali.distortion2 = img2It->second.distortion;
    stereoCali.imageSize = img1It->second.imageSize;

        stereoCali.error = cv::stereoCalibrate(objIt->second,
            img1It->second.corners, img2It->second.corners,
            stereoCali.cameraMatrixMesa, stereoCali.distortionMesa,
            stereoCali.cameraMatrixIds, stereoCali.distortionIds,
            stereoCali.imageSize, stereoCali.R, stereoCali.T, stereoCali.E, stereoCali.T,
            cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 30, 1e-6), CV_CALIB_FIX_INTRINSIC);

objIt->second is a vector with the vectors of the 44 objectpoints as x/y/z with z=0 (I use a 4x11 asym circle pattern) img1/2It->second.coners is a vector of the 44 found objectpoints as x/y. StereoCalibrationStruct looks like that:

typedef struct {
    cv::Mat cameraMatrix1;
    cv::Mat cameraMatrix2;
    cv::Mat distortion1;
    cv::Mat distortion2;
    cv::Mat R;
    cv::Mat T;
    cv::Mat E;
    cv::Mat F;
    double error;
    cv::Size imageSize;
} StereoCalibrationStruct;

The 4 matrices look like they have non default values. So it seems that function do the work but then crashes.

Any ideas how to fix it or why this happens?