-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix inconsistent image resizing between CPU/GPU implementations of SIFT #1642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
While I am aware of discrepancies between CPU and GPU implementations, I am not so sure that this fix is correct. I would imagine that one has to consider the upsampling factor for the first scale in the pyramid to do this calculation correctly (that would be first_octave)? |
|
I think you are right, we need to take the 'first_octave' option into account to unify the downsampling ratio setting between CPU and GPU implementation. By default('first_octave = -1'), if we set the 'max_image_size' to 3200, and we provide images whose dimension are 1920 * 1080. The CPU implementation would not perform downsamping to the original images(which is the work of ImageResizerThread), while the GPU implementation would downsample the original images on its side(cause 3840 exceeds the threshold 3200 we provided). |
| // Set maximum image dimension. | ||
| // Note the max dimension of SiftGPU is the maximum dimension of the | ||
| // first octave in the pyramid (which is the 'first_octave'). | ||
| const double compensation_ratio = std::pow(2, -options.first_octave); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Johannes, I am a little confused by this line's modification. No image up-sampling happens in the GPU version SIFT when 'first_ocatve' > 1. In that case, image resizing happens only in ImageResizerThread. So I think the compensation_ratio should be 1 when 'first_ocatve' > 1. Otherwise, image will be downsampled more than we've
expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I overlooked the fact that SIFT doesn't handle the upsampling. Should be fixed here: #1751
|
This breaks
even with the lowest setting for Reference: #2125 |
This is an important fix which could improves reconstruction quality in many cases.
Fix the issue of inconsistent resize behavior between CPU version of SIFT and siftGPU.
The 'max_image_size' is passed to '-maxd' flag of siftGPU. The '-maxd' flag means maximum working dimension of SIFT algorithm. The problem is that the maximum working dimension of SIFT algorithm is twice the maximum of the image width/height(The SIFT algorithm first doubles the width and height of its input image).
The issue will cause that many reconstructions which used siftGPU features suffer from potentially lower feature quality and less feature numbers due to unexpected image down-sampling.
Check siftGPU manual for more details.