Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
99183e98
Commit
99183e98
authored
Dec 13, 2017
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10293 from alalek:fix_persistence_with_deprecated_traits
parents
c231472a
825b1427
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
persistence.hpp
modules/core/include/opencv2/core/persistence.hpp
+2
-0
persistence.cpp
modules/core/src/persistence.cpp
+20
-0
test_io.cpp
modules/core/test/test_io.cpp
+4
-0
No files found.
modules/core/include/opencv2/core/persistence.hpp
View file @
99183e98
...
...
@@ -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
View file @
99183e98
...
...
@@ -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
View file @
99183e98
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment