Skip to content

Commit

Permalink
Implemented difference of gaussian algorithm.
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinLiang committed Mar 21, 2016
1 parent 5e9a7d5 commit adc7840
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
14 changes: 14 additions & 0 deletions SIFT/ComputeDifferenceOfGaussian.asv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
% This function computes the difference in gaussian and outputs a new pyramid
function gaussianPyramid = ComputeDifferenceOfGaussian(pyramid)
if isempty(pyramid)
return
end

gaussianPyramid = {}; % Initialize difference of gaussian cell array

for i=1:size(pyramid,2) % Iterate through the octaves
for j=1:size(pyramid{1},2)-1 % Iterate through the scales
gaussianPyramid{i}{j} = pyramid{i}{j} - pyramid{i;
end
end
end
14 changes: 14 additions & 0 deletions SIFT/ComputeDifferenceOfGaussian.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
% This function computes the difference in gaussian and outputs a new pyramid
function gaussianPyramid = ComputeDifferenceOfGaussian(pyramid)
if isempty(pyramid)
return
end

gaussianPyramid = {}; % Initialize difference of gaussian cell array

for i=1:size(pyramid,2) % Iterate through the octaves
for j=1:size(pyramid{1},2)-1 % Iterate through the scales
gaussianPyramid{i}{j} = pyramid{i}{j+1} - pyramid{i}{j};
end
end
end
6 changes: 5 additions & 1 deletion SIFT/SIFT.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% Perform edge detection with interpolation during non maximum suppression
function CannyEdgeDetector()
close all; % Close figures
OCTAVES = 4;
OCTAVES = 3;

% Change the current folder to the folder of this m-file.
% Courtesy of Brett Shoelson
Expand All @@ -15,4 +15,8 @@ function CannyEdgeDetector()

pyramid = MakePyramid(im,OCTAVES);
ShowPyramid(pyramid);

pyramid = ComputeDifferenceOfGaussian(pyramid);
ShowPyramid(pyramid);

end
3 changes: 2 additions & 1 deletion SIFT/ShowPyramid.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ function ShowPyramid(pyramid)
end
end

figure;
for i=1:length(pyramidImage)
figure;
subplot(length(pyramidImage),1,i);
imshow(pyramidImage{i});
end
end

0 comments on commit adc7840

Please sign in to comment.