Orb feature detection problem
Hello,
So I'm trying to use opencv's ORB features detector on an object. So I want to get as much points on my object as I can even if I have a textured background. So I created an orb detector :
Ptr<featuredetector> orb = ORB::create(300, 2.0, 3, 31, 0, 2, 0, 31,15);
and then I tried to compare detect function with and without mask. what I did is, in the png below, I did a color filter then I tried to compare detection on the image and detection with a mask based on color. The first image is the original. The second shows the result for detection on the whole image , the second image is the mask that I want to apply. And the last image is the result of the detection by applying a mask( using the function : detect(image, keypoints, mask).
So what I was expecting is by applying the mask I would get more features on the object and less on the chessboard but what I got was the opposite. I circled in red some points that I found by detecting on the whole image and didn't find using the mask. Can someone tell me what am I missing ? by the way both detections give the same number of keypoints.
I cannot reproduce your problem can you post original image?
I added the original on top
" I would get more features on the object" -- that's probably a misassumption. why would that happen ?
because I thought that the points that it detects outside the mask, it will detect them inside it. So let's say without the mask I got 100 on the object and 200 on the chessboard, I thought that with the mask I would get the same 100 + some points because I gave it less space to search.
no, not so. if it did not find any keypoints on your plain, yellow surface before, it won't find any there now.
the mask just restricts the search area, that's it.
yes but my problem is that without the mask there were more points on the object (I circled some of them with red) so normally I get at least those same points no?
are those jpg images ?
yes they are why?
Could be that with multi-scale pyramidal detection, you lose some features when the masked image is very small? You need to detect corner-like feature, by masking the image, maybe at a very high level of the pyramid it changes the appearance of the previously detected features?
Looks like you changed
scaleFactor
. You could try with defaultscaleFactor=1.2f
to see if it changes something.I have the same results with scaleFactor=1.2f