您的位置:首页 > 运维架构

OpenCV两种方式创建图像序列文件xml,yml,yaml等

2016-07-26 09:42 375 查看
Demo路径:./opencv/sources/samples/cpp/imagelist_creator.cpp

“This create a yaml or xml list of files from the command line args”

用法:

在Debug目录下,输入命令行:imagelist_creator.exe imglist.xml 1.bmp 2.bmp

输出文件

imglist.xml

<?xml version="1.0"?>

<opencv_storage>

<images>

"1.bmp" "2.bmp" </images>

</opencv_storage>

需要注意的是,该demo不从任何地方读取图片,它只接受通过命令行输入文件名并创建相应格式的文件,个人觉得需要创建一个包含几十个图像文件名的xml文件时,该方法太笨重,不如考虑下面的方法:
1.把需要创建xml路径的全部图片放到指定文件夹中

2.在该文件夹下使用命令行 dir /s /b >imglist.txt

3.使用word等编辑工具打开,替换文件名

4.复制到xml文件里面并保存

实测并不复杂!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: