function Points = compute_dog_points(Image)
%% computes difference-of-gaussian keypoints on Image

   function sd = sigmadelta(k,sigma_cur)
   %% returns the sigma_delta (what we need to convolve with to
   %% achieve an blur of k more than sigma_cur
      sd = sigma_cur*sqrt(k.^2-1);
   end;

%% retrieves parameters from get_dog_params
%% first scales up image, and blurs it to initial sigma
[InitSigma,Scales,PeakThresh,R] = get_dog_params;

%% first upsample by 2
Image = imresize(Image, [2*size(Image,1) 2*size(Image,2)], 'bilinear');

% then blur to initial sigma
% initial_image = conv2(Image,gauss2d([-0.5:0.01:0.5],InitSigma));

initial_image = blurGauss(Image,sigmadelta(1.6,1.0));

% figure out realistically the # of octaves we want to do
% n_octaves = 6; % floor(log2(size(Image,1)-10));
n_octaves = floor(log2(min(size(Image))-10)) - 5

 Points = [];
 cur_octave = initial_image;
 osize = 0.5;

 for octave=1:n_octaves,
   [p cur_octave] = process_octave(cur_octave,osize);
   Points = [Points; p];
   osize = osize/2;
 end
end