Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

Help required converting a few lines of Python to Java (Android)

$
0
0
Hi, I've been trying to implement the following Python example from the OpenCV docs into Java for OpenCV4Android: http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.html I'm stuck on this particular part for the FLANN based matcher and was wondering if anyone could help me out: FLANN_INDEX_KDTREE = 0 index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5) search_params = dict(checks = 50) flann = cv2.FlannBasedMatcher(index_params, search_params) matches = flann.knnMatch(des1,des2,k=2) // store all the good matches as per Lowe's ratio test. good = [] for m,n in matches: if m.distance < 0.7*n.distance: good.append(m) So far I have: DescriptorMatcher FLANN = DescriptorMatcher.create(1); FLANN.knnMatch(descriptorsRef, descriptors, matches, 2); I'm struggling to figure out how to express the index_params and search_params as well as the for loop for storing all the good matches as per Lowe's ratio test. Any help would be very much appreciated!

Viewing all articles
Browse latest Browse all 2088

Trending Articles