some bugfixes & improvements in openfabmap code, docs and samples by Arren Glover
authorVadim Pisarevsky <vadim.pisarevsky@itseez.com>
Sun, 23 Sep 2012 16:57:34 +0000 (20:57 +0400)
committerVadim Pisarevsky <vadim.pisarevsky@itseez.com>
Sun, 23 Sep 2012 16:57:34 +0000 (20:57 +0400)
modules/contrib/doc/openfabmap.rst
modules/contrib/src/openfabmap.cpp
samples/cpp/fabmap_sample.cpp

index 49a98a3..d93b4ee 100644 (file)
@@ -3,7 +3,7 @@ openFABMAP
 
 .. highlight:: cpp
 
-The openFABMAP package has been integrated into OpenCV from the openFABMAP <http://code.google.com/p/openfabmap/> project. OpenFABMAP is an open and modifiable code-source which implements the Fast Appearance-based Mapping algorithm (FAB-MAP) developed by Mark Cummins and Paul Newman. The algorithms used in openFABMAP were developed using only the relevant FAB-MAP publications.
+The openFABMAP package has been integrated into OpenCV from the openFABMAP <http://code.google.com/p/openfabmap/> project [ICRA2011]_. OpenFABMAP is an open and modifiable code-source which implements the Fast Appearance-based Mapping algorithm (FAB-MAP) developed by Mark Cummins and Paul Newman. The algorithms used in openFABMAP were developed using only the relevant FAB-MAP publications.
 
 FAB-MAP is an approach to appearance-based place recognition. FAB-MAP compares images of locations that have been visited and determines the probability of re-visiting a location, as well as providing a measure of the probability of being at a new, previously unvisited location. Camera images form the sole input to the system, from which visual bag-of-words models are formed through the extraction of appearance-based (e.g. SURF) features.
 
index a6b4ac1..e30080b 100644 (file)
@@ -202,14 +202,13 @@ void FabMap::compare(const vector<Mat>& queryImgDescriptors,
 void FabMap::compare(const vector<Mat>& queryImgDescriptors,
         const vector<Mat>& _testImgDescriptors,
         vector<IMatch>& matches, const Mat& /*mask*/) {
-    if (_testImgDescriptors[0].data != this->testImgDescriptors[0].data) {
-        CV_Assert(!(flags & MOTION_MODEL));
-        for (size_t i = 0; i < _testImgDescriptors.size(); i++) {
-            CV_Assert(!_testImgDescriptors[i].empty());
-            CV_Assert(_testImgDescriptors[i].rows == 1);
-            CV_Assert(_testImgDescriptors[i].cols == clTree.cols);
-            CV_Assert(_testImgDescriptors[i].type() == CV_32F);
-        }
+
+    CV_Assert(!(flags & MOTION_MODEL));
+    for (size_t i = 0; i < _testImgDescriptors.size(); i++) {
+        CV_Assert(!_testImgDescriptors[i].empty());
+        CV_Assert(_testImgDescriptors[i].rows == 1);
+        CV_Assert(_testImgDescriptors[i].cols == clTree.cols);
+        CV_Assert(_testImgDescriptors[i].type() == CV_32F);
     }
 
     for (size_t i = 0; i < queryImgDescriptors.size(); i++) {
index a75a076..d4fcf47 100644 (file)
@@ -58,6 +58,24 @@ using namespace std;
 
 int main(int argc, char * argv[]) {
 
+    /*
+    Note: the vocabulary and training data is specifically made for this openCV
+    example. It is not reccomended for use with other datasets as it is 
+    intentionally small to reduce baggage in the openCV project.
+
+    A new vocabulary can be generated using the supplied BOWMSCtrainer (or other
+    clustering method such as K-means
+
+    New training data can be generated by extracting bag-of-words using the 
+    openCV BOWImgDescriptorExtractor class.
+
+    vocabulary, chow-liu tree, training data, and test data can all be saved and
+    loaded using openCV's FileStorage class and it is not necessary to generate 
+    data each time as done in this example
+
+    */
+
     cout << "This sample program demonstrates the FAB-MAP image matching "
         "algorithm" << endl << endl;
 
@@ -188,10 +206,9 @@ int main(int argc, char * argv[]) {
     Mat result_large(100, 100, CV_8UC1);
     resize(result_small, result_large, Size(500, 500), 0, 0, CV_INTER_NN);
 
+    cout << endl << "Press any key to exit" << endl;
     imshow("Confusion Matrix", result_large);
     waitKey();
 
-    cout << endl << "Press any key to exit" << endl;
-
     return 0;
 }