The SIFT paper and the paper of Anatomy of the SIFT Method do not mention that the input images should be preprocessed (normalized, re-scaled) before feeding images into the standard SIFT algorithm. But the following two SIFT implementations both normalized images to 0-1
beforehand.
- The implementation from the author of Anatomy of the SIFT Method
- Another implementation of C++ language
In both implementations above, it looks like they accept unsigned 8bits png images as input. And the statement of x /= 255
or x = x / 255
will normalize the pixel value to 0-1.
My questions are:
Is it necessary to normalize images to 0-1 before using the standard SIFT algorithm and the standard/default parameters described in the papers?
I am guessing here that if I want to use the default parameters described in the paper then I have to normalize it to 0-1. A little experiment is done here.
- An unsigned 8-bits image is normalized to 0-1: 796 keypoints found with the standard SIFT and parameters.
- An unsigned 8-bits image as-is: 2654 keypoints found with the standard SIFT and parameters. I can't really explain the experiment result. And the papers don't mention the prerequisite of using the standard SIFT and the default parameters.
I've been using the standard SIFT and the default parameters processing unsigned 12-bits images and I found that more keypoints are found if images are not normalized to 0-1. This is actually good result but I am just afraid that I am doing things wrong and being lucky here.
In SIFT, there is one step: discarding low contrasted extrema with a threshold $C_{DOG}$. It looks like because it's using the inverse of hessian matrix, the range of the original pixel values shouldn't matter here?
Thanks for reading. Any feedback is appreciated.
Another update:
Here is an intuitive explanation of why normalization is essential in computer vision, using template matching as an example. Suppose we want to match a template (a circle) with two different shapes, one is a very bright rectangle, and another one is a very dark circle. We multiply our template with two different shapes and see which produces the biggest number. Without normalization, apparently the very bright rectangle will produce higher value than the dark circle even though the form doesn't match at all. But with normalization (variance=1), we can find the right match because the bright rectangle loses its advantage on pixel intensity. It also means that the normalization shall be performed on each patch in an image if patches are fed into algorithms one after one. It cannot perform normalization on the whole image and send patches into algorithms, which will still give advantage to local bright pixels. How about normalization range? Does it matter if it's 0 to 1
or -1 to 1