用cv :: fileStorage保存一个双变量

时间:2013-10-29 08:55:52

标签: c++ opencv

我有一个运行相机校准的校准程序。我想将校准结果保存在YML文件中,除非我尝试保存重投影错误,这是我所做的双倍值,否则无需任何问题:

cv::FileStorage fs= cv::FileStorage("calibration_result.yml",cv::FileStorage::WRITE); /*creating the storage file for the calibration results */

.......................................................


this->fs << "the camera matrix is "<<this->cameraMatrix;
.....................................................................
        this->fs<< "the number of used frames is "<<this->actualnumberOfFrames;
        ///this->fs<< " the reprojection error " << this->reprojectionError;   when I activate this line the storage stops at the **actualnumberOfFrames**
        this->fs<<"the used resolution is " << this->theFrameSIZE;
        this->fs << "used flags in the calirbation function" << this->flagsName;
        this->fs<<"the distortion Coefficients are "<< this->distortionCoeff;
        this->fs<<"the rotation vector is "<< this->rvec;
        this->fs <<"the tangiantiale vector" << this->tvecs;
......................................................

我仔细检查了变量值,这很好,我真的知道了结果文件中的值!

任何想法我怎么解决这个问题?在此先感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

您是否尝试删除姓名开头的空格?

自:

this->fs<< " the reprojection error " << this->reprojectionError;   

要:

this->fs<< "the reprojection error " << this->reprojectionError;