filestorage failing on isOpened() (and crashing)

asked 2012-12-12 05:56:38 -0500

Rex gravatar image

updated 2012-12-12 06:38:24 -0500

Hi,

(2.4.3, VS 2008, Qt)

if passing the FileStorage constructor below file it fails:

Having tried everything inclkuding feeding it the contents of the file in string format (which the reference manual says should work) my only hope now is that there is something wrong with the file format.?

This is indeed straight from the opencv

<opencv_storage> <settings> <boardsize_width> 9</boardsize_width> <boardsize_height>6</boardsize_height>

<square_size>50</square_size>

<calibrate_pattern>"CHESSBOARD"</calibrate_pattern>

<input>"images/CameraCalibraation/VID5/VID5.xml"</input> <input_fliparoundhorizontalaxis>0</input_fliparoundhorizontalaxis>

<input_delay>100</input_delay>

<calibrate_nrofframetouse>25</calibrate_nrofframetouse> <calibrate_fixaspectratio> 1 </calibrate_fixaspectratio> <calibrate_assumezerotangentialdistortion>1</calibrate_assumezerotangentialdistortion> <calibrate_fixprincipalpointatthecenter> 1 </calibrate_fixprincipalpointatthecenter>

<write_outputfilename>"out_camera_data.xml"</write_outputfilename> <write_detectedfeaturepoints>1</write_detectedfeaturepoints> <write_extrinsicparameters>1</write_extrinsicparameters> <show_undistortedimage>1</show_undistortedimage>

</settings> </opencv_storage>

This is my code:

void Calib3dOCV::startCalibration(const QString& SettingsFileName){

Calib3dSettings s;

std::string FN=SettingsFileName.toStdString();
FileStorage fs(FN, FileStorage::READ); // Read the settings
if (!fs.isOpened())
{
    qDebug() << "Could not open the configuration file: " << SettingsFileName;
    return;
}
s.read(fs["Settings"]);// >> s;
fs.release();  

vector<vector<Point2f> > imagePoints;
Mat cameraMatrix, distCoeffs;
Size imageSize;
int mode = s.inputType == Calib3dSettings::IMAGE_LIST ? CAPTURING : DETECTION;
//clock_t prevTimestamp = 0;
const Scalar RED(0,0,255), GREEN(0,255,0);

return;

}

Am I overlooking something here?

edit retag flag offensive close merge delete