3
$\begingroup$

When reading about SIFT I read halving resolution is the same as increasing $\sigma$ of the gaussian in terms of feature detection but reducing resolution has the advantage of reducing processing.

What I am curious about is suppose we keep the image the same size and only modify $\sigma$ and apply DOG as usual. When a feature is found how would a descriptor be implemented which is scale invariant? I'm assuming it would have to be a function of $\sigma$.

$\endgroup$
2

1 Answer 1

1
$\begingroup$

One could show that holding the $ \sigma $ parameter constant while downsampling the image is equivalent of increasing the sigma while holding the image size constant.

Let's do a simple test:

clear();
close('all');

paramSigma          = 6;
sigmaToRediusFactor = 4;
decimationFctr      = 2;

hFilterSize = @(paramStd) (2 * ceil(sigmaToRediusFactor * paramStd)) + 1;


lenaImgUrl = 'https://github.com/RoyiAvital/StackExchangeCodes/raw/7dc76e23ed08eb900b66c816665564657a8e2251/StackOverflow/Q50614085/Lena.png';
mI = im2double(imread(lenaImgUrl));
mI = mean(mI, 3); %<! Make it grayscale

mIBlurred = imgaussfilt(mI, paramSigma, 'FilterSize', hFilterSize(paramSigma), 'FilterDomain', 'spatial');

numRows = size(mI, 1); %<! 512
numCols = size(mI, 2); %<! 512

% With decimation
numRowsDown     = floor(numRows / decimationFctr);
numColsDown     = floor(numCols / decimationFctr);
paramSigmaDec   = paramSigma / decimationFctr;

mIDec        = imresize(mI, 'OutputSize', [numRowsDown, numColsDown]);
mIDecBlurred = imgaussfilt(mIDec, paramSigmaDec, 'FilterSize', hFilterSize(paramSigmaDec), 'FilterDomain', 'spatial');
mIDecBlurred = imresize(mIDecBlurred, 'OutputSize', [numRows, numCols]);

figure('Position', [100, 100, 1200, 450]);
hA = subplot(1, 4, 1);
imshow(mI);
set(get(hA, 'Title'), 'String', 'Lena Image');
hA = subplot(1, 4, 2);
imshow(mIBlurred);
set(get(hA, 'Title'), 'String', ['Lena Blurred, Sigma: ', num2str(paramSigma)]);
hA = subplot(1, 4, 3);
imshow(mIDecBlurred);
set(get(hA, 'Title'), 'String', ['Lena Blurred Decimated, Sigma: ', num2str(paramSigmaDec)']);
hA = subplot(1, 4, 4);
imagesc(mIBlurred - mIDecBlurred);
set(hA, 'DataAspectRatio', [1, 1, 1]);
set(get(hA, 'Title'), 'String', ['Difference Image']);

The output is:

enter image description here

What we did?
We applied a gaussian blur on an image with a given $\sigma$.
We also applied a gaussian blur on the same image after a decimation with factor 2 image with $\frac{\sigma}{2}$.
The we upsampled the downsampled image to the original size and display the 2 results and their difference.

Beside some edge issues, the output of both is the same.

So, if they are the same, what should we use?
The one which is faster, of course, it is the one which is applied on less pixels.

Regarding your question, in order to keep the scale invariance you can take the same strategy used in the À-Trous Wavelets (Also known as dilated convolution). Basically decimating the grid when collecting the samples. It will give you, neglecting border issues, the same results.

$\endgroup$
1
  • $\begingroup$ I'm a bit curious how the descriptor can work through the big jumps in image size vs having it be scale dependent but it appears to be good enough the way it's currently implemented. $\endgroup$ Feb 25, 2023 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.