当前位置:网站首页>【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;
}边栏推荐
- STM32开发板+机智云AIoT+家庭监测控制系统
- How to solve the problem of SQL?
- Record the learning record of the exists keyword once
- How to use JMeter for interface testing
- Es6-- set
- The applet draws a simple pie chart
- Thinking while walking
- 2022年中职组网络安全新赛题
- Several optimization scenarios using like fuzzy retrieval in SQL
- Huawei cloud SRE deterministic operation and maintenance special issue (the first issue)
猜你喜欢

No absurd tea applet - rule change

电路模块分析练习5(电源)

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

Why is the frame rate calculated by opencv wrong?

What aspects should we start with in the feasibility analysis of dry goods?

As a programmer, how can we learn, grow and progress happily? (personal perception has nothing to do with technology)

腾讯《和平精英》新版本将至:新增账号安全保护系统,游戏内违规行为检测升级

What is 5g? What can 5g do? What will 5g bring in the future?

Several optimization scenarios using like fuzzy retrieval in SQL

不荒唐的茶小程序-规则改动
随机推荐
Flex & Bison Start
Global and Chinese oleic acid operation mode and market supply and demand forecast report 2022 ~ 2028
Some points to pay attention to when closing mongodb services (as well as related commands when opening)
Does jQuery cache any selectors- Does jQuery do any kind of caching of “selectors”?
No absurd tea applet - rule change
Three layer architecture + routing experiment
LM小型可编程控制器软件(基于CoDeSys)笔记十七:pto脉冲功能块
Baidu: in 2022, the top ten hot spots will rise and the profession will be released. There is no suspense about the first place!
pdm的皮毛
Glory launched the points mall to support the exchange of various glory products
Core points of assembly language
Flex & Bison 开始
字符串变形(字符串大小写切换和变现)
Basic concepts of processor scheduling
How to solve the problem of SQL?
App test points
Global and Chinese flame retardant ABS industry development trend and market demand analysis report 2022 ~ 2028
Equivalence class, boundary value, application method and application scenario of scenario method
Live800在线客服系统:跨越时空做生意,从每次互动开始
牛客小白月賽52--E 分組求對數和(二分)