1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

core: fix persistence with deprecated traits

This commit is contained in:
Alexander Alekhin
2017-12-12 17:07:03 +03:00
parent b0bce60c16
commit 825b14278e
3 changed files with 26 additions and 0 deletions
+20
View File
@@ -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();