Ask Your Question

How to improve homography

asked 2015-06-09 15:14:33 -0500

bjorn89 gravatar image

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-06-09 15:50:05 -0500

iamprivate gravatar image

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

edit flag offensive delete link more


How can I take top matches using AKAZE?

bjorn89 gravatar imagebjorn89 ( 2015-06-10 01:57:51 -0500 )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>(){

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

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

iamprivate gravatar imageiamprivate ( 2015-06-10 02:26:05 -0500 )edit

Sorry man but it doesn't work :S

bjorn89 gravatar imagebjorn89 ( 2015-06-10 07:53:54 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-06-09 15:14:33 -0500

Seen: 508 times

Last updated: Jun 09 '15