Ask Your Question

Weird words in my bag

asked 2017-10-21 06:41:34 -0600

tischenkoalex gravatar image

Hello, I'm using BOWKMeansTrainer to cluster ORB keypoints with FREAK descriptors. This combination of detector and matcher show good results for drawing-style images, which I trying to analyze, however BOWKMeansTrainer makes some problems...

After training, when I process an image with BOWImgDescriptorExtractor and get its image descriptor, I see that often words (clusters) consist of keypoints, which are too far from each other.

image description

Here are highlighted keypoints of one of the words. Of course there are other words, which are localized enough, but I'm curious why it happens when they're not localized?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-10-21 07:34:20 -0600

berak gravatar image

updated 2017-10-21 09:20:35 -0600

BowKmeansClustering requires float descriptors, while FREAK is a binary one, and cannot be used here. (you can only use SIFT, SURF or KAZE with BOW).

(trying to cheat by converting the FREAK descriptor to float does not help, since it gets the distance between descriptors entirely wrong, that's what you're seing here.)

again, kmeans uses L2 distance, while you have to use hamming distance for binary descriptors. (also the "mean" in kmeans does not make sense with a bitstring. if you wanted to cluster bitstrings, it would need something like "kmedian" or "kmajority", which opencv does not supply as of now. )

edit flag offensive delete link more



Thanks, this makes perfect sense for me. I tried with KAZE and it looks much better.

tischenkoalex gravatar imagetischenkoalex ( 2017-10-21 15:47:06 -0600 )edit

Question Tools

1 follower


Asked: 2017-10-21 06:41:34 -0600

Seen: 201 times

Last updated: Oct 21 '17