Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenCV
opencv
提交
c996fd1c
O
opencv
项目概览
OpenCV
/
opencv
上一次同步 9 个月
通知
993
Star
71100
Fork
55581
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c996fd1c
编写于
11月 09, 2020
作者:
F
Felix Gorschlüter
提交者:
Alexander Smorkalov
11月 20, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Small improvements to persistence-API doc
上级
b5c16217
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
4 deletion
+31
-4
modules/core/include/opencv2/core/persistence.hpp
modules/core/include/opencv2/core/persistence.hpp
+5
-4
modules/core/test/test_io.cpp
modules/core/test/test_io.cpp
+26
-0
未找到文件。
modules/core/include/opencv2/core/persistence.hpp
浏览文件 @
c996fd1c
...
...
@@ -403,8 +403,8 @@ public:
/**
* @brief Simplified writing API to use with bindings.
* @param name Name of the written object
* @param val Value of the written object
* @param name Name of the written object
. When writing to sequences (a.k.a. "arrays"), pass an empty string.
* @param val Value of the written object
.
*/
CV_WRAP
void
write
(
const
String
&
name
,
int
val
);
/// @overload
...
...
@@ -437,9 +437,10 @@ public:
CV_WRAP
void
writeComment
(
const
String
&
comment
,
bool
append
=
false
);
/** @brief Starts to write a nested structure (sequence or a mapping).
@param name name of the structure
(if it's a member of parent mapping, otherwise it should be empty
@param name name of the structure
. When writing to sequences (a.k.a. "arrays"), pass an empty string.
@param flags type of the structure (FileNode::MAP or FileNode::SEQ (both with optional FileNode::FLOW)).
@param typeName usually an empty string
@param typeName optional name of the type you store. The effect of setting this depends on the storage format.
I.e. if the format has a specification for storing type information, this parameter is used.
*/
CV_WRAP
void
startWriteStruct
(
const
String
&
name
,
int
flags
,
const
String
&
typeName
=
String
());
...
...
modules/core/test/test_io.cpp
浏览文件 @
c996fd1c
...
...
@@ -1640,6 +1640,32 @@ TEST(Core_InputOutput, FileStorage_free_file_after_exception)
ASSERT_EQ
(
0
,
std
::
remove
(
fileName
.
c_str
()));
}
TEST
(
Core_InputOutput
,
FileStorage_write_to_sequence
)
{
const
std
::
vector
<
std
::
string
>
formatExts
=
{
".yml"
,
".json"
,
".xml"
};
const
std
::
string
fileName
=
"FileStorage_write_to_sequence"
;
for
(
const
auto
&
ext
:
formatExts
)
{
FileStorage
fs
(
fileName
+
ext
,
FileStorage
::
WRITE
);
std
::
vector
<
int
>
in
=
{
23
,
42
};
fs
.
startWriteStruct
(
"some_sequence"
,
cv
::
FileNode
::
SEQ
);
for
(
int
i
:
in
)
fs
.
write
(
""
,
i
);
fs
.
endWriteStruct
();
fs
.
release
();
FileStorage
fsIn
(
fileName
+
ext
,
FileStorage
::
READ
);
FileNode
seq
=
fsIn
[
"some_sequence"
];
FileNodeIterator
it
=
seq
.
begin
(),
it_end
=
seq
.
end
();
std
::
vector
<
int
>
out
;
for
(;
it
!=
it_end
;
++
it
)
out
.
push_back
((
int
)
*
it
);
EXPECT_EQ
(
in
,
out
);
}
}
TEST
(
Core_InputOutput
,
FileStorage_YAML_parse_multiple_documents
)
{
const
std
::
string
filename
=
"FileStorage_YAML_parse_multiple_documents.yml"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录