From f77c65a8f1c21a8200a6e19fe189f692713cf5a8 Mon Sep 17 00:00:00 2001
From: Thomas VL <Thomasvl@stud.ntnu.no>
Date: Wed, 20 Apr 2022 00:03:41 +0100
Subject: [PATCH] Implemented SIFT and added to test file

---
 Test.m | 29 +++++++++++++++++------------
 sift.m |  7 +++++++
 2 files changed, 24 insertions(+), 12 deletions(-)
 create mode 100644 sift.m

diff --git a/Test.m b/Test.m
index 531fef4..44b7d7b 100644
--- a/Test.m
+++ b/Test.m
@@ -14,20 +14,25 @@ img = imread("colorHistogram/Edvard_Munch_-_Despair_(1894).jpg");
 % "visual" contains visualization object that can be used in plot method
 [hog, visual] = histogramOrientedGradients(img);
 
-figure,
-imshow(img),
-hold on,
-plot(visual),
-title("Hog features of image");
+%figure,
+%imshow(img),
+%hold on,
+%plot(visual),
+%title("Hog features of image");
 
 % Using Cellsize this time
 [hog2, visual2] = histogramOrientedGradients(img, 32);
 
-figure,
-imshow(img),
+%figure,
+%imshow(img),
+%hold on,
+%plot(visual2),
+%title("Hog features using Cellsize");
+%% Scaling Invariant Feature Transform - Test of imlementation
+%Can look at this https://www.analyticsvidhya.com/blog/2019/10/detailed-guide-powerful-sift-technique-image-matching-python/
+points = sift(img);
+
+imshow(img);
 hold on,
-plot(visual2),
-title("Hog features using Cellsize");
-%% Section 2 Title
-% Description of second code block
-b = 2;
+plot(points);
+
diff --git a/sift.m b/sift.m
new file mode 100644
index 0000000..23ce43f
--- /dev/null
+++ b/sift.m
@@ -0,0 +1,7 @@
+function siftPoints = sift(image)
+    %Convert image to greyscale
+    greyImage = rgb2gray(image);
+    %Use inbuilt edge function
+    siftPoints = detectSIFTFeatures(greyImage);
+end
+
-- 
GitLab