SIFT 2.3.1 versus SIFT 2.4.1 (Bug #2025)
Description
Hi,
Using the SIFT keypoint detector and then descriptor extractor on OpenCV 2.3.1, in a given image 1944 by 2592, I get 48525 distinct keypoints. In a set of 60, low resolution images, I get 5902 total keypoints.
While in the OpenCV 2.4.1 I get 16065 and 2454 respectively.
I did not alter my source code in anyway and I am using the SIFT default parameters.
I did noticed the SIFT call in 2.4.1 to be different from 2.3.1, asking for a parameter nFeatures and deprecating the nOctaves and two more parameters that weren't used in 2.3.1.
Besides that I noticed the excellent work made to the SIFT source code reimplementation.
I don't know what may be causing this difference in the number of keypoints, but I don't think it is associated with the nOctaves parameter.
My sift calls are like this:
Ptr<FeatureDetector> detector = new SiftFeatureDetector();
Ptr<DescriptorExtractor> extractor = new SiftDescriptorExtractor();
detector->detect(frame, kpVect);
extractor->compute(frame, kpVect, descVect);
I did tried the, new?, way of defining the Sift/Surf/etc keypoint/descriptor calls:
FeatureDetector::create("SIFT");
DescriptorExtractor::create("SIFT");
But the results were still different to those attained in OpenCV 2.3.1.
I did notice SIFT to be a lot faster, although the number of keypoints are different. I tried incrementing/decrementing the initial sigma and the number of octave layers, but I could not reproduce the same values as of those achieved by 2.3.1. I could get a lot more keypoints with sigma=0.5 and they were calculated really fast although no direct comparison can be made as the keypoints are different.
My OpenCV was built with TBB and CUDA, although I am not using any cuda functions yet (this was the reason to go to 4.2.1). And I installed the OpenCV library to my OS.
I'm using ubuntu 11.04 64bits.
If you want any more info/help/files/tests please do ask.
I really appreciate the opencv library, excellent work!!!! Just one suggestion, add a "Donate" button to the new page.
Best regards,
Fábio R.
Associated revisions
fixed #2580, #2210. some work on #2025.
modified SIFT to 1) double image before finding keypoints, 2) use floating-point internally instead of 16-bit integers, 3) set the keypoint response to the abs(interpolated_DoG_value). step 1) increases the number of detected keypoints significantly and together with 2) and 3) it improves some detection benchmarks. On the other hand, the stability of the small keypoints is lower, so the rotation and scale invariance tests now struggle a bit. In 2.5 need to make this feature optional and add some more intelligence to the algorithm.
added test that finds a planar object using SIFT.
History
Updated by Fábio Reis almost 13 years ago
1Ptr<FeatureDetector> detector = new SiftFeatureDetector(); 2Ptr<DescriptorExtractor> extractor = new SiftDescriptorExtractor(); 3 4Ptr<FeatureDetector> detector = FeatureDetector::create("SIFT"); 5Ptr<DescriptorExtractor> extractor = DescriptorExtractor::create("SIFT"); 6 7detector->detect(frame, kpVect); 8extractor->compute(frame, kpVect, descVect);
Just reformatted the code. And to add that I do have the relevant includes in my project and I even tried adding the:
init_module_nonfree();
before the calls to the sift extractor.
I did not check the SURF algorithm, but I will check if it is giving the same type of results between 2.3.1 and 2.4.1.
Fábio R.
Updated by Manel Verdu almost 13 years ago
Hi,
I'm dealing with the same problem actually. In version 2.4 it is only possible to detect 30% to 40% of the Sift keypoints, which were detected in version 2.3.1 and 2.3.3. But now the point is when I use the keypoints and its matches to estimate a homography of an object in a scene I get better results with the older version. See attached images. Only the best 40 matches are drawn and used for the estimation with a RANSAC (Iterative) sceme. In all versions I used the default parameters for SIFT and RANSAC.
Regards
Manel
- File v233.jpg added
- File v24.jpg added
- File v231.jpg added
Updated by Ziang Xie over 12 years ago
Hi,
Also experiencing this issue using Ubuntu 12.04 on 64bit machine, ROS Fuerte, and OpenCV 2.4. Getting about 1/3 of keypoints detected, performance of nearest neighbor based recognition scheme reduced significantly.
Thanks,
Ziang
Updated by Sly Chief over 12 years ago
Hi,
I also confirm this problem. The same relation - 1/3 of keypoints - can be observed when comparing OpenCV's SIFT implementation with Lowe's Matlab siftDemoV4.
Applying both algorithms to the same image (see attachment) resuls in
- 14615 - original Matlab version
- 4558 - OpenCV242 default parameters
Regards,
Sly
- File 00000010.jp2 added
Updated by Sly Chief over 12 years ago
Hi!
We further compared the Lowe implementation with the one from OpenCV. If you scale down the image to the half of its resolution the Lowe implementation provides about the same number of Keypoints with approximately same coordinates as the OpenCV implementation on the full size image.
So we suppose that the OpenCV implementation starts with a different layer than the Lowe implemetation.
Regards,
Sly
Updated by Vadim Pisarevsky over 12 years ago
- Target version deleted ()
Updated by Kirill Kornyakov over 12 years ago
- Target version set to Next Hackathon
Updated by Vadim Pisarevsky about 12 years ago
- Assignee set to Vadim Pisarevsky
- Target version deleted (
Next Hackathon)
Updated by Vadim Pisarevsky about 12 years ago
- Assignee deleted (
Vadim Pisarevsky)
Updated by Vadim Pisarevsky about 12 years ago
- Assignee set to Vadim Pisarevsky
Updated by Vadim Pisarevsky about 12 years ago
I think, in 2.4 branch the problem has been fixed. Please, test 2.4 snapshot or the upcoming 2.4.4. If there is still regression, please, reopen the ticket
- Affected version set to 2.4.3
- Status changed from Open to Done
Updated by Kirill Kornyakov about 12 years ago
- Target version set to 2.4.4