diff --git a/modules/contrib/doc/openfabmap.rst b/modules/contrib/doc/openfabmap.rst
index 49a98a38c..d93b4ee1a 100644
--- a/modules/contrib/doc/openfabmap.rst
+++ b/modules/contrib/doc/openfabmap.rst
@@ -3,7 +3,7 @@ openFABMAP
.. highlight:: cpp
-The openFABMAP package has been integrated into OpenCV from the 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 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.
diff --git a/modules/contrib/src/openfabmap.cpp b/modules/contrib/src/openfabmap.cpp
index a6b4ac177..e30080bfc 100644
--- a/modules/contrib/src/openfabmap.cpp
+++ b/modules/contrib/src/openfabmap.cpp
@@ -202,14 +202,13 @@ void FabMap::compare(const vector& queryImgDescriptors,
void FabMap::compare(const vector& queryImgDescriptors,
const vector& _testImgDescriptors,
vector& 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++) {
diff --git a/samples/cpp/fabmap_sample.cpp b/samples/cpp/fabmap_sample.cpp
index a75a076d4..d4fcf476c 100644
--- a/samples/cpp/fabmap_sample.cpp
+++ b/samples/cpp/fabmap_sample.cpp
@@ -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;
}