i have a problem with Keypoints detection of an image in OpenCV. If i have for example a SIFT detector, when it detects an image it retrives 1000 keypoints but if i split the image in two "sub-image", and foreach SIFT detects keypoints, the sum is not 1000, but less. For me the total keypoints number can be different but not too much! Thanks
-
Welcome to SO! In order to get some help you should post your code, where the errors are and what you have tried to fix it. – GPPK Oct 12 '17 at 14:26
-
I detect Mat m and keypoints go to kp: sift.detect(m, kp); after i split m in two submatrix: Mat m2 = m.submat(0,300, 0, 500).clone(); Mat m3 = m.submat(300, 480, 500, 640).clone(); but if i now detect sift sift.detect(m2, kp2); sift.detect(m3, kp3); the sum of kp2 and kp3 is not kp! – Vertex Oct 12 '17 at 14:36
-
Post your code properly in your question, Please read [this](https://stackoverflow.com/help/how-to-ask) and clean up your question – GPPK Oct 12 '17 at 14:37
-
Because there are some keypoints near the splitting line in the original image. After splited into two subregions, the keypoints disappear. – Kinght 金 Oct 13 '17 at 02:36
1 Answers
This is not really a question as stated, but obviously the question at heart is something like:
Why do two images separated have a different number of SIFT keypoints (usually less) than if they are concatenated into a single image?
The basic answer is that features can be big, and can land close to the border of the two subimages. If they are split, those features no longer exist. Really, SIFT shouldn't be expected to produce the same number of keypoints. If you think of features strictly as corners, then sure---you should get roughly the same amount either way. But some features come as gradients, rough "blobs", etc which can be easily cut off by a split image, and thus splitting the image can remove these features, and can similarly duplicate others.
You can generally verify this by examining only those features that are well within the borders of the two subimages. If you remove the features close to the edges of the images, and examine only features in the same space for the combined image, you should see a similar number of features across the two.
Imagine if you took the process of splitting the image to the extreme. There are typically a lot of SIFT keypoints in an image. If you broke it down to a ton of 2x2 images do you think you'd get the same number of keypoints? Of course not, as 2x2 images do not hold enough information to recreate all the same features as the full image.

- 22,094
- 5
- 78
- 94