# How to improve homography

Hi guys, I'm implementing manually a stitcher from a video.Here's the problem: often,it seems that the homography isn't stimated correctly.I say this because when I'm going to stitch the new frame to the mosaic, only a part fits well, and the other part seems "sliced". How can I improve the ransac algorithm for getting better results? I'm using opencv 3 with AKAZE, with a threshold of 0.00001 (it's very low but it work a lot better respect to SURF!!!) and I'm calculating the homography with this parameters:

Mat H = findHomography(obj, scene, RANSAC,2.5);


(I've read the 2.5 from AKAZE paper)

Hope someone could help

edit retag close merge delete

Sort by ยป oldest newest most voted

Try using top matched points (like top 10) instead of applying threshold. Usually top matched points are good enough matches. I dont prefer using threshold coz you cant come up with best which fits for all

more

How can I take top matches using AKAZE?

( 2015-06-10 01:57:51 -0600 )edit

When you match key points , you get result as MatOfDMatch. Convert that to List<dmatch> , then sort the list based on the distance , in ascending order . So now you can take 10 DMatch objects from list from i 0 to 10

DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING); MatOfDMatch matches = new MatOfDMatch(); matcher.match( descriptorsUser, descriptorsTemplate, matches ); List<dmatch> listMatches = matches.toList();

    Collections.sort(listMatches, new Comparator<DMatch>(){

@Override
public int compare(DMatch arg0, DMatch arg1) {
if(arg0.distance<arg1.distance)
return -1;
else if(arg0.distance>arg1.distance)
return 1;
else
return 0;
}});


List<dmatch> goodMatches = listMatches.subList(0, 10);

( 2015-06-10 02:26:05 -0600 )edit

Sorry man but it doesn't work :S

( 2015-06-10 07:53:54 -0600 )edit

Official site

GitHub

Wiki

Documentation