flann

OpenCV templates in 2D point data set

[亡魂溺海] 提交于 2019-12-20 20:22:09
问题 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

How do I use the relationships between Flann matches to determine a sensible homography?

蹲街弑〆低调 提交于 2019-12-17 20:39:05
问题 I have a panorama image, and a smaller image of buildings seen within that panorama image. What I want to do is recognise if the buildings in that smaller image are in that panorama image, and how the 2 images line up. For this first example, I'm using a cropped version of my panorama image, so the pixels are identical. import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import math # Load images cwImage = cv2.imread('cw1.jpg',0) panImage = cv2

OpenCV 2.4.5: FLANN and hierarchicalClustering

一曲冷凌霜 提交于 2019-12-12 20:54:34
问题 I have recently started porting an application to a new platform which runs OpenCV 2.4.5. Part of my code which uses OpenCV's implementation of FLANN to do hierarchical clustering no longer compiles. The code is as follows: cv::Mat mergedFeatures = cvCreateMat(descriptorTotal, descriptorDims, CV_32F); int counter = 0; for (uint j = 0; j < ImageFeatures.size(); j++) { cv::Mat features = ImageFeatures[j]; for (int k = 0; k < features.rows; k++) { cv::Mat roi = mergedFeatures.row(counter);

OpenCV - Use FLANN with ORB descriptors to match features

扶醉桌前 提交于 2019-12-12 11:28:27
问题 I am using OpenCV 3.2 I am trying to use FLANN to match features descriptors in a faster way than brute force. // Ratio to the second neighbor to consider a good match. #define RATIO 0.75 void matchFeatures(const cv::Mat &query, const cv::Mat &target, std::vector<cv::DMatch> &goodMatches) { std::vector<std::vector<cv::DMatch>> matches; cv::Ptr<cv::FlannBasedMatcher> matcher = cv::FlannBasedMatcher::create(); // Find 2 best matches for each descriptor to make later the second neighbor test.

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

拥有回忆 提交于 2019-12-12 04:17:26
问题 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

Matlab missing dependency MEX-file

风格不统一 提交于 2019-12-11 06:58:50
问题 I have a script in matlab that calls other libraries. I use matlab version 2012a on linux . I get below error and I don't know how to fix it. The error is : Invalid MEX-file '/home/XXX/nearest_neighbors.mexa64': libflann.so.1.8: cannot open shared object file: No such file or directory Error in flann_search (line 82) [indices,dists] = nearest_neighbors('find_nn', data, testset, n, params); Error in MyScript (line 73) [nresult, ndists] = flann_search(Ntraindata', Ntraindata', resu.KNN, struct(

FLANN error in OpenCV 3

ⅰ亾dé卋堺 提交于 2019-12-06 18:51:44
问题 I am running Ubuntu 14.04. I am trying to run FLANN with openCV 3 but I get an error. Everything bellow was tried by using AKAZE and ORB but the code if from my attempt to use ORB. I use ORB to find the descriptors and key-points. Ptr<ORB> detector = ORB::create(); std::vector<KeyPoint> keypoints_1, keypoints_2; Mat descriptors_1, descriptors_2; detector->detectAndCompute( img_1, noArray(), keypoints_1, descriptors_1 ); detector->detectAndCompute( img_2, noArray(), keypoints_2, descriptors_2

FLANN error in OpenCV 3

流过昼夜 提交于 2019-12-05 00:25:44
I am running Ubuntu 14.04. I am trying to run FLANN with openCV 3 but I get an error. Everything bellow was tried by using AKAZE and ORB but the code if from my attempt to use ORB. I use ORB to find the descriptors and key-points. Ptr<ORB> detector = ORB::create(); std::vector<KeyPoint> keypoints_1, keypoints_2; Mat descriptors_1, descriptors_2; detector->detectAndCompute( img_1, noArray(), keypoints_1, descriptors_1 ); detector->detectAndCompute( img_2, noArray(), keypoints_2, descriptors_2 ); After I use ORB, I use the following code to find matches: FlannBasedMatcher matcher; std::vector

OpenCV Python: Occasionally get segmentation fault when using FlannBasedMatcher

被刻印的时光 ゝ 提交于 2019-12-04 09:59:19
I'm trying to classify objects using SURF and kNN. The code work well however it occasionally crashes and shows 'Segmentation Fault'. I'm not sure whether I did something wrong but I'm pretty sure that it is corrected. Here is the input file in case that you want to reproduce the issue. Link to download the dataset import numpy as np import cv2 import sys trainfile = ['/home/nuntipat/Documents/Dataset/Bank/Training/15_20_front.jpg' , '/home/nuntipat/Documents/Dataset/Bank/Training/15_50_front.jpg' , '/home/nuntipat/Documents/Dataset/Bank/Training/15_100_front.jpg' , '/home/nuntipat/Documents

OpenCV Python : No drawMatchesknn function

拈花ヽ惹草 提交于 2019-12-03 18:03:24
问题 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 回答1: 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