-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from nathanhhughes/fix/opencv4_patch
fix issue with vocab loading taking to long with system opencv
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
diff --git a/include/DBoW2/TemplatedVocabulary.h b/include/DBoW2/TemplatedVocabulary.h | ||
index 6d8d621..c95e72e 100644 | ||
--- a/include/DBoW2/TemplatedVocabulary.h | ||
+++ b/include/DBoW2/TemplatedVocabulary.h | ||
@@ -1473,12 +1473,12 @@ void TemplatedVocabulary<TDescriptor,F>::load(const cv::FileStorage &fs, | ||
m_nodes.resize(fn.size() + 1); // +1 to include root | ||
m_nodes[0].id = 0; | ||
|
||
- for(unsigned int i = 0; i < fn.size(); ++i) | ||
+ for(auto iter = fn.begin(); iter != fn.end(); ++iter) | ||
{ | ||
- NodeId nid = (int)fn[i]["nodeId"]; | ||
- NodeId pid = (int)fn[i]["parentId"]; | ||
- WordValue weight = (WordValue)fn[i]["weight"]; | ||
- std::string d = (std::string)fn[i]["descriptor"]; | ||
+ NodeId nid = (int)(*iter)["nodeId"]; | ||
+ NodeId pid = (int)(*iter)["parentId"]; | ||
+ WordValue weight = (WordValue)(*iter)["weight"]; | ||
+ std::string d = (std::string)(*iter)["descriptor"]; | ||
|
||
m_nodes[nid].id = nid; | ||
m_nodes[nid].parent = pid; | ||
@@ -1493,10 +1493,10 @@ void TemplatedVocabulary<TDescriptor,F>::load(const cv::FileStorage &fs, | ||
|
||
m_words.resize(fn.size()); | ||
|
||
- for(unsigned int i = 0; i < fn.size(); ++i) | ||
+ for(auto iter = fn.begin(); iter != fn.end(); ++iter) | ||
{ | ||
- NodeId wid = (int)fn[i]["wordId"]; | ||
- NodeId nid = (int)fn[i]["nodeId"]; | ||
+ NodeId wid = (int)(*iter)["wordId"]; | ||
+ NodeId nid = (int)(*iter)["nodeId"]; | ||
|
||
m_nodes[nid].word_id = wid; | ||
m_words[wid] = &m_nodes[nid]; |