Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenCV
opencv
提交
825b1427
O
opencv
项目概览
OpenCV
/
opencv
上一次同步 9 个月
通知
992
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 搜索 >>
提交
825b1427
编写于
12月 12, 2017
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: fix persistence with deprecated traits
上级
b0bce60c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
0 deletion
+26
-0
modules/core/include/opencv2/core/persistence.hpp
modules/core/include/opencv2/core/persistence.hpp
+2
-0
modules/core/src/persistence.cpp
modules/core/src/persistence.cpp
+20
-0
modules/core/test/test_io.cpp
modules/core/test/test_io.cpp
+4
-0
未找到文件。
modules/core/include/opencv2/core/persistence.hpp
浏览文件 @
825b1427
...
...
@@ -851,7 +851,9 @@ namespace internal
size_t
remaining
=
it
->
remaining
;
size_t
cn
=
DataType
<
_Tp
>::
channels
;
int
_fmt
=
traits
::
SafeFmt
<
_Tp
>::
fmt
;
CV_Assert
((
_fmt
>>
8
)
<
9
);
char
fmt
[]
=
{
(
char
)((
_fmt
>>
8
)
+
'1'
),
(
char
)
_fmt
,
'\0'
};
CV_Assert
((
remaining
%
cn
)
==
0
);
size_t
remaining1
=
remaining
/
cn
;
count
=
count
<
remaining1
?
count
:
remaining1
;
vec
.
resize
(
count
);
...
...
modules/core/src/persistence.cpp
浏览文件 @
825b1427
...
...
@@ -7367,8 +7367,18 @@ void read(const FileNode& node, std::vector<KeyPoint>& keypoints)
if
(
first_node
.
isSeq
())
{
// modern scheme
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
FileNodeIterator
it
=
node
.
begin
();
size_t
total
=
(
size_t
)
it
.
remaining
;
keypoints
.
resize
(
total
);
for
(
size_t
i
=
0
;
i
<
total
;
++
i
,
++
it
)
{
(
*
it
)
>>
keypoints
[
i
];
}
#else
FileNodeIterator
it
=
node
.
begin
();
it
>>
keypoints
;
#endif
return
;
}
keypoints
.
clear
();
...
...
@@ -7394,8 +7404,18 @@ void read(const FileNode& node, std::vector<DMatch>& matches)
if
(
first_node
.
isSeq
())
{
// modern scheme
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
FileNodeIterator
it
=
node
.
begin
();
size_t
total
=
(
size_t
)
it
.
remaining
;
matches
.
resize
(
total
);
for
(
size_t
i
=
0
;
i
<
total
;
++
i
,
++
it
)
{
(
*
it
)
>>
matches
[
i
];
}
#else
FileNodeIterator
it
=
node
.
begin
();
it
>>
matches
;
#endif
return
;
}
matches
.
clear
();
...
...
modules/core/test/test_io.cpp
浏览文件 @
825b1427
...
...
@@ -1199,6 +1199,7 @@ TEST(Core_InputOutput, FileStorage_DMatch_vector_vector)
EXPECT_NO_THROW
(
fs
<<
"dvv"
<<
dvv
);
cv
::
String
fs_result
=
fs
.
releaseAndGetString
();
#ifndef OPENCV_TRAITS_ENABLE_DEPRECATED
#if defined _MSC_VER && _MSC_VER <= 1700
/* MSVC 2012 and older */
EXPECT_STREQ
(
fs_result
.
c_str
(),
"%YAML:1.0
\n
"
...
...
@@ -1226,6 +1227,7 @@ TEST(Core_InputOutput, FileStorage_DMatch_vector_vector)
" - [ 1, 2, 3, -1.5000000000000000e+00 ]
\n
"
);
#endif
#endif // OPENCV_TRAITS_ENABLE_DEPRECATED
cv
::
FileStorage
fs_read
(
fs_result
,
cv
::
FileStorage
::
READ
|
cv
::
FileStorage
::
MEMORY
);
...
...
@@ -1344,6 +1346,7 @@ TEST(Core_InputOutput, FileStorage_KeyPoint_vector_vector)
EXPECT_NO_THROW
(
fs
<<
"kvv"
<<
kvv
);
cv
::
String
fs_result
=
fs
.
releaseAndGetString
();
#ifndef OPENCV_TRAITS_ENABLE_DEPRECATED
EXPECT_STREQ
(
fs_result
.
c_str
(),
"<?xml version=
\"
1.0
\"
?>
\n
"
"<opencv_storage>
\n
"
...
...
@@ -1362,6 +1365,7 @@ TEST(Core_InputOutput, FileStorage_KeyPoint_vector_vector)
" 1. 2. 16. 0. 100. 1 -1</_></_></kvv>
\n
"
"</opencv_storage>
\n
"
);
#endif //OPENCV_TRAITS_ENABLE_DEPRECATED
cv
::
FileStorage
fs_read
(
fs_result
,
cv
::
FileStorage
::
READ
|
cv
::
FileStorage
::
MEMORY
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录