当前位置:网站首页>【opencv450 samples】创建图像列表yaml
【opencv450 samples】创建图像列表yaml
2022-06-25 21:59:00 【十年一梦实验室】
/*this creates a yaml or xml list of files from the command line args
*/
#include "opencv2/core.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <string>
#include <iostream>
using std::string;
using std::cout;
using std::endl;
using namespace cv;
static void help(char** av)
{
cout << "\nThis creates a yaml or xml list of files from the command line args\n"
"这会从命令行 args 创建一个 yaml 或 xml 文件列表\n"
"usage:\n./" << av[0] << " imagelist.yaml *.png\n"
<< "Try using different extensions.(e.g. yaml yml xml xml.gz etc...)\n"
<< "This will serialize this list of images or whatever with opencv's FileStorage framework" << endl;
}
int main(int ac, char** av)
{
cv::CommandLineParser parser(ac, av, "{help h||}{@output||}");
if (parser.has("help"))
{
help(av);
return 0;
}
string outputname = parser.get<string>("@output");//输出文件名
if (outputname.empty())
{
help(av);
return 1;
}
Mat m = imread(outputname); //检查输出是否为图像 - 防止覆盖! check if the output is an image - prevent overwrites!
if (!m.empty()) {//失败! 请指定一个输出文件,不要覆盖你的图像
std::cerr << "fail! Please specify an output file, don't want to overwrite you images!" << endl;
help(av);
return 1;
}
FileStorage fs(outputname, FileStorage::WRITE);//文件存储写入
fs << "images" << "[";
for (int i = 2; i < ac; i++) {//遍历所有图像名
fs << string(av[i]);
}
fs << "]";
return 0;
}边栏推荐
- 电路模块分析练习5(电源)
- 一位博士在华为的22年
- OSPF - detailed explanation of GRE tunnel (including configuration command)
- 等价类,边界值,场景法的使用方法和运用场景
- Global and Chinese oleic acid operation mode and market supply and demand forecast report 2022 ~ 2028
- Network security project questions of the first Henan vocational skills competition in 2022
- Unity技术手册 - GetKey和GetAxis和GetButton
- What should it personnel over 35 years old do if they are laid off by the company one day?
- The wisdom of questioning? How to ask questions?
- App test points
猜你喜欢

String deformation (string case switching and realization)

Eureka core ⼼ source code analysis
2、一个向量乘它的转置,其几何意义是什么?

【EOSIO】EOS/WAX签名错误 is_canonical( c ): signature is not canonical 问题

【ModuleBuilder】GP服务实现SDE中两个图层相交选取

Basic concepts of processor scheduling

字符串变形(字符串大小写切换和变现)

2022 love analysis · panoramic report of it operation and maintenance manufacturers

ES6学习-- LET

Another breakthrough! Alibaba cloud enters the Gartner cloud AI developer service Challenger quadrant
随机推荐
zabbix_server配置文件详解
Oracle - getting started
APP-新功能上线
The applet draws a simple pie chart
哪些PHP开源作品值得关注
What are the channels for Internet advertising to gain customers?
UE4\UE5 蓝图节点Delay与Retriggerable Delay的使用与区别
The sum of logarithms in group 52--e of Niuke Xiaobai monthly race (two points)
.sql数据库导入错误:/*!40101 SET @[email protected]@COLLATION_CONNECTION */
为什么OpenCV计算的帧率是错误的?
关闭MongoDB一些服务需要注意的地方(以及开启的相关命令)
Transformers load pre training model
牛客小白月赛52--E 分组求对数和(二分)
oracle -- 表操作
Paper notes: multi tag learning MSWl
Unity的Ping类使用
异或运算符简单逻辑运算 a^=b
UE4_ Ue5 combines the offline voice recognition plug-in for speech recognition
adb常用命令
Unity technical manual - life cycle rotation rotationoverlifetime- speed rotation rotationbyspeed- and external forces