diff --git a/SIFT/MakePyramid.m b/SIFT/MakePyramid.m new file mode 100644 index 0000000..beda123 --- /dev/null +++ b/SIFT/MakePyramid.m @@ -0,0 +1,22 @@ +% This function makes a pyramid of images +% Minsize dictates the minimum height or width of the smallest image +% in the template +function[pyramid] = MakePyramid(im, octaves) + SCALE = 1.6; + SCALES_PER_OCTAVE = 3; + K = sqrt(2); + RATIO = 0.5; + + im = imgaussfilt(im,0.5); % Blur the image before doubling the size + im = imresize(im, 2); % Double the size of the image + + pyramid = {}; % Initialize cell array + + % Make a pyramid with a specified octave number + for i=1:octaves + for j=1:SCALES_PER_OCTAVE + pyramid{i}{j} = imgaussfilt(im,SCALE*(K^(i-1+j))); + end + im = imresize(im, RATIO); + end +end \ No newline at end of file diff --git a/SIFT/SIFT Papers/SIFT01_Early_iccv99.pdf b/SIFT/SIFT Papers/SIFT01_Early_iccv99.pdf new file mode 100644 index 0000000..37b573d Binary files /dev/null and b/SIFT/SIFT Papers/SIFT01_Early_iccv99.pdf differ diff --git a/SIFT/SIFT Papers/SIFT02_RecentSummary_ijcv03.pdf b/SIFT/SIFT Papers/SIFT02_RecentSummary_ijcv03.pdf new file mode 100644 index 0000000..0235aa5 Binary files /dev/null and b/SIFT/SIFT Papers/SIFT02_RecentSummary_ijcv03.pdf differ diff --git a/SIFT/SIFT Papers/SIFT03_3Drec_cvpr01.pdf b/SIFT/SIFT Papers/SIFT03_3Drec_cvpr01.pdf new file mode 100644 index 0000000..d854146 Binary files /dev/null and b/SIFT/SIFT Papers/SIFT03_3Drec_cvpr01.pdf differ diff --git a/SIFT/SIFT Papers/SIFT04_AffineMatch_bmvc2002.pdf b/SIFT/SIFT Papers/SIFT04_AffineMatch_bmvc2002.pdf new file mode 100644 index 0000000..5b95420 Binary files /dev/null and b/SIFT/SIFT Papers/SIFT04_AffineMatch_bmvc2002.pdf differ diff --git a/SIFT/SIFT Papers/SIFT05_PerformanceEval_01211478.pdf b/SIFT/SIFT Papers/SIFT05_PerformanceEval_01211478.pdf new file mode 100644 index 0000000..a7afee8 Binary files /dev/null and b/SIFT/SIFT Papers/SIFT05_PerformanceEval_01211478.pdf differ diff --git a/SIFT/SIFT Papers/SIFT06I1_For_Edges_mikolajczyk03a.pdf b/SIFT/SIFT Papers/SIFT06I1_For_Edges_mikolajczyk03a.pdf new file mode 100644 index 0000000..9249dca Binary files /dev/null and b/SIFT/SIFT Papers/SIFT06I1_For_Edges_mikolajczyk03a.pdf differ diff --git a/SIFT/SIFT Papers/SIFT06I2_for_texture_varma03.pdf b/SIFT/SIFT Papers/SIFT06I2_for_texture_varma03.pdf new file mode 100644 index 0000000..b7b738f Binary files /dev/null and b/SIFT/SIFT Papers/SIFT06I2_for_texture_varma03.pdf differ diff --git a/SIFT/SIFT Papers/SIFT06M1_Localization2_Map_iros02.pdf b/SIFT/SIFT Papers/SIFT06M1_Localization2_Map_iros02.pdf new file mode 100644 index 0000000..93ed1e5 Binary files /dev/null and b/SIFT/SIFT Papers/SIFT06M1_Localization2_Map_iros02.pdf differ diff --git a/SIFT/SIFT Papers/SIFT06M2_LocalizeFeatures_iros02b.pdf b/SIFT/SIFT Papers/SIFT06M2_LocalizeFeatures_iros02b.pdf new file mode 100644 index 0000000..79b0609 Binary files /dev/null and b/SIFT/SIFT Papers/SIFT06M2_LocalizeFeatures_iros02b.pdf differ diff --git a/SIFT/SIFT Papers/SIFT06M3_RecPanoramas_brown03.pdf b/SIFT/SIFT Papers/SIFT06M3_RecPanoramas_brown03.pdf new file mode 100644 index 0000000..f1609ae Binary files /dev/null and b/SIFT/SIFT Papers/SIFT06M3_RecPanoramas_brown03.pdf differ diff --git a/SIFT/SIFT Papers/SIFT06M4_VideoRetrieval.pdf b/SIFT/SIFT Papers/SIFT06M4_VideoRetrieval.pdf new file mode 100644 index 0000000..572b5f0 Binary files /dev/null and b/SIFT/SIFT Papers/SIFT06M4_VideoRetrieval.pdf differ diff --git a/SIFT/SIFT.m b/SIFT/SIFT.m new file mode 100644 index 0000000..9bba8d2 --- /dev/null +++ b/SIFT/SIFT.m @@ -0,0 +1,18 @@ +% Perform edge detection with interpolation during non maximum suppression +function CannyEdgeDetector() + close all; % Close figures + OCTAVES = 4; + + % Change the current folder to the folder of this m-file. + % Courtesy of Brett Shoelson + if(~isdeployed) + cd(fileparts(which(mfilename))); + end + + im = imread('Test_Photos\box.jpg'); + figure; imshow(im); + title('Original Image'); + + pyramid = MakePyramid(im,OCTAVES); + ShowPyramid(pyramid); +end diff --git a/SIFT/ShowPyramid.asv b/SIFT/ShowPyramid.asv new file mode 100644 index 0000000..3fc8a1e --- /dev/null +++ b/SIFT/ShowPyramid.asv @@ -0,0 +1,16 @@ +% This function shows the pyramid image in a figure +function ShowPyramid(pyramid) + if isempty(pyramid) + return + end + + pyramidImage = uint8(0); + + for i=1:size(pyramid,2) % Iterate through the 1xn pyramid of images + for j=1:size(pyramid{1}) + padadd(pyramidImage,pyramid{i}); + end + end + + imshow(pyramidImage); +end \ No newline at end of file diff --git a/SIFT/ShowPyramid.m b/SIFT/ShowPyramid.m new file mode 100644 index 0000000..0de66ba --- /dev/null +++ b/SIFT/ShowPyramid.m @@ -0,0 +1,22 @@ +% This function shows the pyramid image in a figure +function ShowPyramid(pyramid) + if isempty(pyramid) + return + end + + pyramidImage = cell(1,size(pyramid,2)); + pyramidImage(:) = {uint8(0)}; + + for i=1:size(pyramid,2) % Iterate through the octaves + for j=1:size(pyramid{1},2) % Iterate through the scales + temp = pyramidImage{i}; + padadd(temp, pyramid{i}{j}); + pyramidImage{i} = temp; + end + end + + for i=1:length(pyramidImage) + figure; + imshow(pyramidImage{i}); + end +end \ No newline at end of file diff --git a/SIFT/Test_Photos/box.jpg b/SIFT/Test_Photos/box.jpg new file mode 100644 index 0000000..f6bf758 Binary files /dev/null and b/SIFT/Test_Photos/box.jpg differ diff --git a/SIFT/Test_Photos/scene.jpg b/SIFT/Test_Photos/scene.jpg new file mode 100644 index 0000000..66d2d2c Binary files /dev/null and b/SIFT/Test_Photos/scene.jpg differ diff --git a/SIFT/build_pyramid.m b/SIFT/build_pyramid.m new file mode 100644 index 0000000..48ba553 --- /dev/null +++ b/SIFT/build_pyramid.m @@ -0,0 +1,74 @@ +%///////////////////////////////////////////////////////////////////////////////////////////// +% +% build_pyramid - build scaled image pyramid and difference of gaussians pyramid +% +% Usage: [pyr,imp] = build_pyramid(img,levels,scl); +% +% Parameters: +% +% img : original image +% levels : number of levels in pyramid +% scl : scaling factor between pyramid levels +% +% Returns: +% +% pyr : difference of gaussians filtered image pyramid +% imp : image pyramid cell array +% +% Author: +% Scott Ettinger +% scott.m.ettinger@intel.com +% +% May 2002 +%///////////////////////////////////////////////////////////////////////////////////////////// + +function [pyr,imp] = build_pyramid(img,levels,scl) + +img2 = img; +img2 = resample_bilinear(img2,1/2); %expand to retain spatial frequencies + +%img2 = imresize(img2,2,'bilinear'); %expand to retain spatial frequencies + +sigma=1.5; %variance for laplacian filter +sigma2=1.5; %variance for downsampling + +sig_delta = (1.6-.6)/levels; + + +for i=1:levels + + if i==1 + img3 = img2; + img2 = filter_gaussian(img2,7,.5); %slightly filter bottom level + end + + imp{i}=img2; + A = filter_gaussian(img2,7,sigma); %calculate difference of gaussians + B = filter_gaussian(A,7,sigma); + pyr{i} = A-B; %store result in cell array + + if i==1 + img2 = img3; + else + B = filter_gaussian(img2,7,sigma2); %anti-alias for downsampling + B = filter_gaussian(B,7,sigma2); + end + + img2 = resample_bilinear(B,scl); %downsample for next level + +end + +%show_pyramid(pyr) %show pyramid if desired + +%/////////////////////////////////////////////////////////////////////////////// +function show_pyramid(pyr) + + close all + + [h,w] = size(pyr); + for i=1:w + + figure + imagesc(pyr{i}); + colormap gray; + end \ No newline at end of file diff --git a/SIFT/padadd.m b/SIFT/padadd.m new file mode 100644 index 0000000..234ca21 --- /dev/null +++ b/SIFT/padadd.m @@ -0,0 +1,92 @@ +function [output] = padadd(A, x, index) +% PADADD Adds data columns to an array even column lengths don't match. +% Missmatched areas of data array are padded with NaNs. +% +% answer = padadd(A, x) +% appends "x" column vector as the last column of "A" +% +% answer = padadd(A, x, index) +% assigns "x" to the column specified by "index" in "A" +% by overwriting any existing data. +% +% If "x" is a matrix, "index" specifies the leftmost column written to. +% +% The result is saved recursively to "A" if the output argument is omitted +% and "A" is a defined variable +% +%Example: +% padadd( eye(2,2), 2*ones(4,1) ) +% +% ans = +% +% 1 0 2 +% 0 1 2 +% NaN NaN 2 +% NaN NaN 2 +% +%Author: HDJ + +%check input argument number +if (nargin < 2) + error('not enough input arguments') +end + +%transpose 'x' if it is a row vector +if (size(x,1) == 1) | (size(x,2) == 1) & (size(x,2) > size(x,1)) + x = x'; +end + +%get sizes of 'A' and 'x' +dAr = size(A,1); +dAc = size(A,2); +dxr = size(x,1); +dxc = size(x,2); + + +if nargin == 2 + %if index is not specified + %index = dAc + 1; %default to adding a column to the end + index = dAc + (1:dxc); %default to adding all columns to the end +else + %create index array from index argument + index = index(1)+ (0:dxc-1); +end + +%%%%%%BEGIN PADDING SECTION%%%%%% +%if index is outside current size of 'A' then pad whole columns of 'A' +if dAc < index(end) + answer = [A,NaN*ones(dAr,index(end)-dAc)]; +else + answer = A; +end + +%if 'x' is shorter or the same height as 'A' then pad 'x' as necessary +if dAr >= dxr, + %answer(:,index) = [ x(:,1); NaN*ones(dAr-dxr,1)]; + answer(:,index) = [ x; NaN*ones(dAr-dxr,dxc)]; +end + +%if 'x' is taller than 'A' then pad 'A' +if dAr < dxr, + answer = [answer; NaN*ones(dxr-dAr,size(answer,2))]; + %answer(:,index) = x(:,1); + answer(:,index) = x; +end +%%%%%%END PADDING SECTION%%%%%% + +%%%%%%DECIDE OUTPUT METHOD%%%%%% +%get input arguments name +ARGIN = inputname(1); +%if no output argument, ouput to A is available +if (nargout == 0) + %if ARG is a variable + if ~(isempty(ARGIN)) + assignin('caller', ARGIN, answer); + return + end +end + +%default action if either there is an ouput argument +%or if input is not a variable +output = answer; +%%%%%%END DECIDE OUTPUT METHOD%%%%%% \ No newline at end of file