[Opencv4] Settings.write not working Incorrect element name {; should start with a letter or '_' in function 'operator<<'

asked 2019-01-15 16:47:59 -0600

mikeitexpert gravatar image

updated 2019-01-15 18:34:30 -0600

Tetragramm gravatar image

I am just trying to perform chessboard camera calibration based on camera calibration sample.

So I am trying to let my QT app save the calibrations settings using Settings class as defined int above code. There is a function for this which is Settings.write but when I call as below it gives me this error:

void saveCalibrationSettings(const Settings currentSettings){
    FileStorage fs = FileStorage(Ui::calibrationFilename, FileStorage::WRITE);
    currentSettings.write(fs);
    fs.release();
}

the error is as below:

Gtk-Message: 02:56:21.529: Failed to load module "canberra-gtk-module"
 Input does not exist: images/CameraCalibration/VID5/VID5.xmlterminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.0.1) /home/mike/opencv-4.0.1/modules/core/src/persistence.cpp:1995: error: (-2:Unspecified error) Incorrect element name {; should start with a letter or '_' in function 'operator<<'

I just need my QT GUI application to be able to save a Settings object into a file so that it could follow the correct calibration settings format which then can be fed to the calibration process.

edit retag flag offensive close merge delete

Comments

I just resolved by commenting line 27 and 47. here

mikeitexpert gravatar imagemikeitexpert ( 2019-01-15 17:00:31 -0600 )edit

I just changed fs << "{" to fs << "Settings" << "{" and it is working :)

mikeitexpert gravatar imagemikeitexpert ( 2019-01-15 18:10:49 -0600 )edit