flann

Which distance function does FlannBasedMatcher use and how to change it?

删除回忆录丶 提交于 2019-12-03 16:40:39
Which distance function does openCVs flannBasedMatcher use and is it possible to change the default? In the user manual from the original flann by Muja and Lowe there are some different distance types (flann_distance_t) and I don't see a method in opencv to change them :-/ This is very poorly documented in the code for openCV but the default settings for the flannBasedMatcher are found in these two functions flann::SearchParams(); //32 checks, 0, sorted=true flann::KDTreeIndexParams(); //uses 4 randomized KD trees The distance function by default is FLANN_DIST_L2. I think this bit of code

OpenCV templates in 2D point data set

放肆的年华 提交于 2019-12-03 06:31:19
I was wandering what the best approach would be for detecting 'figures' in an array of 2D points. In this example I have two 'templates'. Figure 1 is a template and figure 2 is a template. Each of these templates exists only as a vector of points with an x,y coordinate. Let's say we have a third vector with points with x,y coordinate What would be the best way to find out and isolate points matching one of the first two arrays in the third one. (including scaling, rotation)? I have been trying nearest neigbours(FlannBasedMatcehr) or even SVM implementation but it doesn't seem to get me any

Recognizing an image from a list with OpenCV SIFT using the FLANN matching

99封情书 提交于 2019-12-03 06:23:23
问题 The point of the application is to recognize an image from an already set list of images. The list of images have had their SIFT descriptors extracted and saved in files. Nothing interesting here: std::vector<cv::KeyPoint> detectedKeypoints; cv::Mat objectDescriptors; // Extract data cv::SIFT sift; sift.detect(image, detectedKeypoints); sift.compute(image, detectedKeypoints, objectDescriptors); // Save the file cv::FileStorage fs(file, cv::FileStorage::WRITE); fs << "descriptors" <<

Recognizing an image from a list with OpenCV SIFT using the FLANN matching

独自空忆成欢 提交于 2019-12-02 20:56:52
The point of the application is to recognize an image from an already set list of images. The list of images have had their SIFT descriptors extracted and saved in files. Nothing interesting here: std::vector<cv::KeyPoint> detectedKeypoints; cv::Mat objectDescriptors; // Extract data cv::SIFT sift; sift.detect(image, detectedKeypoints); sift.compute(image, detectedKeypoints, objectDescriptors); // Save the file cv::FileStorage fs(file, cv::FileStorage::WRITE); fs << "descriptors" << objectDescriptors; fs << "keypoints" << detectedKeypoints; fs.release(); Then the device takes a picture. SIFT

FlannBasedMatcher returning different results

大城市里の小女人 提交于 2019-12-01 09:42:11
Using the FlannBasedMatcher in OpenCV, I am getting different results calling the matcher with the same parameters. Can anyone suggest what I am doing wrong please? The code below shows a minimal example of the problem I am having - it is simplified representative of how I use the FlannBasedMatcher - this isn't real code :) Results output each time around the loop should be identical, but they are not. int const k = std::min(query_descriptors.rows, std::min(train_descriptors.rows, 2)); cv::Mat query_descriptors_original = query_descriptors.clone(); cv::Mat train_descriptors_original = train

FlannBasedMatcher returning different results

北战南征 提交于 2019-12-01 04:36:28
问题 Using the FlannBasedMatcher in OpenCV, I am getting different results calling the matcher with the same parameters. Can anyone suggest what I am doing wrong please? The code below shows a minimal example of the problem I am having - it is simplified representative of how I use the FlannBasedMatcher - this isn't real code :) Results output each time around the loop should be identical, but they are not. int const k = std::min(query_descriptors.rows, std::min(train_descriptors.rows, 2)); cv:

OpenCV feature matching for multiple images

女生的网名这么多〃 提交于 2019-11-29 22:41:31
How can I optimise the SIFT feature matching for many pictures using FLANN? I have a working example taken from the Python OpenCV docs. However this is comparing one image with another and it's slow. I need it to search for features matching in a series of images (a few thousands) and I need it to be faster. My current idea: Run through all the images and save the features. How? Compare an image from a camera with this above base, and find the correct one. How? Give me the result, matching image or something. http://docs.opencv.org/trunk/doc/py_tutorials/py_feature2d/py_feature_homography/py

cv2 3.0.0 cv2.FlannBasedMatcher: flann.knnMatch is throwing cv2 error

大兔子大兔子 提交于 2019-11-29 14:42:22
I want to use a flann-based matcher in Python as described in http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_feature2d/py_matcher/py_matcher.html Since I am using OpenCV 3.0.0, I had to adjust the code regarding the initialization of the SIFT detector. The rest is taken without changes def calculateMatch(self): # Initiate SIFT detector sift = cv2.xfeatures2d.SIFT_create() # find the keypoints and descriptors with SIFT (kp1, desc1) = sift.detectAndCompute(self.image1,None) (kp2, desc2) = sift.detectAndCompute(self.image2,None) # FLANN parameters FLANN_INDEX_KDTREE = 0

OpenCV Python : No drawMatchesknn function

*爱你&永不变心* 提交于 2019-11-29 06:49:28
When I tried to use drawMatchesKnn function as mentioned in this tutorial for FLANN feature matching, I get the following error AttributeError: 'module' object has no attribute 'drawMatchesKnn' I checked with other resources that drawMatchesKnn method is present in opencv. Why am I getting this error? Thanks in advance ryanmeasel The functions cv2.drawMatches and cv2.drawMatchesKnn are not available in newer versions of OpenCV 2.4. @rayryeng provided a lightweight alternative which works as is for the output of DescriptorMatcher.match . The difference with DescriptorMatcher.knnMatch is that

OpenCV feature matching for multiple images

懵懂的女人 提交于 2019-11-28 19:25:09
问题 How can I optimise the SIFT feature matching for many pictures using FLANN? I have a working example taken from the Python OpenCV docs. However this is comparing one image with another and it's slow. I need it to search for features matching in a series of images (a few thousands) and I need it to be faster. My current idea: Run through all the images and save the features. How? Compare an image from a camera with this above base, and find the correct one. How? Give me the result, matching