yaml写法的简单例子。将 $ ./ 1 2 3 4 5 命令的参数(代表图片地址)写入yaml中。

 

写yaml文件。

参考:[OpenCV] Samples 06: [ML] logistic regression 读xml文件。

    {
        /*
         * Jeff --> Load xml.
         *          transform to Mat.
         * FileStorage.
         */
        cout << "loading the dataset...";
        // Step 1.
        FileStorage f;
        if(f.open(filename, FileStorage::READ))
        {
            // Step 2.
            f["datamat"] >> data;
            f["labelsmat"] >> labels;
            f.release();
        }
        else
        {
            cerr << "file can not be opened: " << filename << endl;
            return 1;
        }
        // Step 3.
        data.convertTo(data, CV_32F);
        labels.convertTo(labels, CV_32F);
 
        cout << "read " << data.rows << " rows of data" << endl;
    }
read xml

相关文章:

  • 2022-12-23
  • 2021-12-30
  • 2021-07-12
  • 2021-10-06
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
猜你喜欢
  • 2021-06-27
  • 2021-11-23
  • 2021-11-20
  • 2022-02-05
  • 2021-11-18
  • 2021-09-12
  • 2022-12-23
相关资源
相似解决方案