Ask Your Question
0

detectAndCompute method not working for useProvidedKeypoints flag

asked 2019-04-22 05:18:31 -0600

Sita gravatar image

(JAVA) I am using Akaze to detect keypoints. I then prune keypoints according to few criteria. But passing those keypoints to the detectAndCompute method by setting the 'useProvidedKeypoints' flag to true, doesn't compute the descriptor. Instead the keypoint becomes null after calling the method. Please post the necessary fix.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-04-22 05:30:21 -0600

berak gravatar image

updated 2019-04-22 05:31:29 -0600

Instead the keypoint becomes null after calling the method.

this means, no descriptors could be computed for your given keypoints (so the invalid ones were removed)

I then prune keypoints according to few criteria

this needs some explanation ? you're pruning unmatched keypoints ? why at all?

Please post the necessary fix.

hate to say so, but most probably you'll have to change your concept. maybe your pruning is broken ? maybe you can't do this with AKAZE keypoint ? noone knows,without more information

edit flag offensive delete link more

Comments

Sorry for not being clear, earlier. The below is a snippet of what I'm trying to do. By pruning, I meant I'm taking the top, say 40 keypoints by comparing the response field of the keypoints. I did run akaze with detectAndCompute() method and it worked as expected. Which is why, I thought of separating the methods to pick top keypoints. Please let me know if there's a much easier way to go about this. Thanks

Sita gravatar imageSita ( 2019-04-22 07:08:16 -0600 )edit

descriptors = new Mat(); keypoints = new MatOfKeyPoint();

            // Separate detect and compute
            akaze.detect(logoMat, keypoints);
            List<KeyPoint> kps= keypoints.toList().stream()
                                .sorted((KeyPoint k1, KeyPoint k2) -> ((Float) 
                                                                         k2.response).compareTo(((Float) k1.response)))
                                .collect(Collectors.toList());

            kps= kps.subList(0, 40 > kps.size()? kps.size(): 40);
            MatOfKeyPoint mkp= new MatOfKeyPoint();
            mkp.fromList(kps);

            // using from already detected keypoints
            akaze.detectAndCompute(logoMat, new Mat(), mkp, descriptors, true);
Sita gravatar imageSita ( 2019-04-22 07:08:40 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-04-22 05:18:31 -0600

Seen: 753 times

Last updated: Apr 22 '19