What is the thread-safety status of FlannBasedMatcher and indices?
I'm using Flann in a multithreaded application. The threads share one instance of the flann matcher. However I'm getting trouble with some index types. LinearIndex works fine. But with LshIndex i get a segfault:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe1b9c700 (LWP 19056)]
0x00007ffff5e0c460 in cvflann::LshIndex<cvflann::HammingLUT2>::getNeighbors(unsigned char const*, cvflann::ResultSet<int>&) ()
from /usr/local/lib/libopencv_flann.so.2.4
(gdb) bt
#0 0x00007ffff5e0c460 in cvflann::LshIndex<cvflann::HammingLUT2>::getNeighbors(unsigned char const*, cvflann::ResultSet<int>&) ()
from /usr/local/lib/libopencv_flann.so.2.4
#1 0x00007ffff5e00482 in cvflann::LshIndex<cvflann::HammingLUT2>::knnSearch(cvflann::Matrix<unsigned char> const&, cvflann::Matrix<int>&, cvflann::Matrix<int>&, int, cvflann::SearchParams const&) () from /usr/local/lib/libopencv_flann.so.2.4
#2 0x00007ffff5e2fb5c in void cv::flann::runKnnSearch_<cvflann::HammingLUT2, cvflann::Index<cvflann::HammingLUT2> >(void*, cv::Mat const&, cv::Mat&, cv::Mat&, int, cv::flann::SearchParams const&) () from /usr/local/lib/libopencv_flann.so.2.4
#3 0x00007ffff5e30578 in cv::flann::Index::knnSearch(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, cv::flann::SearchParams const&) () from /usr/local/lib/libopencv_flann.so.2.4
#4 0x00007ffff60b8404 in cv::FlannBasedMatcher::knnMatchImpl(cv::Mat const&, std::vector<std::vector<cv::DMatch, std::allocator<cv::DMatch> >, std::allocator<std::vector<cv::DMatch, std::allocator<cv::DMatch> > > >&, int, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, bool) ()
from /usr/local/lib/libopencv_features2d.so.2.4
#5 0x00007ffff60b6fa9 in cv::DescriptorMatcher::knnMatch(cv::Mat const&, std::vector<std::vector<cv::DMatch, std::allocator<cv::DMatch> >, std::allocator<std::vector<cv::DMatch, std::allocator<cv::DMatch> > > >&, int, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, bool) ()
from /usr/local/lib/libopencv_features2d.so.2.4
#6 0x00007ffff60b7248 in cv::DescriptorMatcher::match(cv::Mat const&, std::vector<cv::DMatch, std::allocator<cv::DMatch> >&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&) () from /usr/local/lib/libopencv_features2d.so.2.4
And with HierarchicalClusteringIndex I get:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe179b700 (LWP 19168)]
0x00007ffff5e1c368 in cvflann::HierarchicalClusteringIndex<cvflann::HammingLUT2>::findNeighbors(cvflann::ResultSet<int>&, unsigned char const*, cvflann::SearchParams const&) () from /usr/local/lib/libopencv_flann.so.2.4
(gdb) bt
#0 0x00007ffff5e1c368 in cvflann::HierarchicalClusteringIndex<cvflann::HammingLUT2>::findNeighbors(cvflann::ResultSet<int>&, unsigned char const*, cvflann::SearchParams const&) () from /usr/local/lib/libopencv_flann.so.2.4
#1 0x00007ffff5dfff37 in cvflann::NNIndex<cvflann::HammingLUT2>::knnSearch(cvflann::Matrix<unsigned char> const&, cvflann::Matrix<int>&, cvflann::Matrix<int>&, int, cvflann::SearchParams const&) () from /usr/local/lib/libopencv_flann.so.2.4
#2 0x00007ffff5e2fb5c in void cv::flann::runKnnSearch_<cvflann::HammingLUT2, cvflann::Index<cvflann::HammingLUT2> >(void*, cv::Mat const&, cv::Mat&, cv::Mat&, int, cv::flann::SearchParams const&) () from /usr/local/lib/libopencv_flann.so.2.4
#3 0x00007ffff5e30578 in cv::flann::Index::knnSearch(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, cv::flann::SearchParams const&) () from /usr/local/lib/libopencv_flann.so.2.4
#4 0x00007ffff60b8404 in cv::FlannBasedMatcher::knnMatchImpl(cv::Mat const&, std::vector<std::vector<cv::DMatch, std::allocator<cv::DMatch> >, std::allocator ...