├── KeyPoint Detection with SIFT ├── Images │ └── Img.jpg ├── Results │ ├── Octave_1_Scale_1.jpg │ ├── Octave_1_Scale_2.jpg │ ├── Octave_1_Scale_3.jpg │ ├── Octave_1_Scale_4.jpg │ ├── Octave_1_Scale_5.jpg │ ├── Octave_2_Scale_1.jpg │ ├── Octave_2_Scale_2.jpg │ ├── Octave_2_Scale_3.jpg │ ├── Octave_2_Scale_4.jpg │ ├── Octave_2_Scale_5.jpg │ ├── Octave_3_Scale_1.jpg │ ├── Octave_3_Scale_2.jpg │ ├── Octave_3_Scale_3.jpg │ ├── Octave_3_Scale_4.jpg │ ├── Octave_3_Scale_5.jpg │ ├── Octave_4_Scale_1.jpg │ ├── Octave_4_Scale_2.jpg │ ├── Octave_4_Scale_3.jpg │ ├── Octave_4_Scale_4.jpg │ ├── Octave_4_Scale_5.jpg │ ├── Keypoints_Octave_1.jpg │ ├── Keypoints_Octave_2.jpg │ ├── Keypoints_Octave_3.jpg │ ├── Keypoints_Octave_4.jpg │ ├── DoG_Octave_1_Scale_1.jpg │ ├── DoG_Octave_1_Scale_2.jpg │ ├── DoG_Octave_1_Scale_3.jpg │ ├── DoG_Octave_1_Scale_4.jpg │ ├── DoG_Octave_2_Scale_1.jpg │ ├── DoG_Octave_2_Scale_2.jpg │ ├── DoG_Octave_2_Scale_3.jpg │ ├── DoG_Octave_2_Scale_4.jpg │ ├── DoG_Octave_3_Scale_1.jpg │ ├── DoG_Octave_3_Scale_2.jpg │ ├── DoG_Octave_3_Scale_3.jpg │ ├── DoG_Octave_3_Scale_4.jpg │ ├── DoG_Octave_4_Scale_1.jpg │ ├── DoG_Octave_4_Scale_2.jpg │ ├── DoG_Octave_4_Scale_3.jpg │ ├── DoG_Octave_4_Scale_4.jpg │ ├── BlackKeypoints_Octave_1.jpg │ ├── BlackKeypoints_Octave_2.jpg │ ├── BlackKeypoints_Octave_3.jpg │ └── BlackKeypoints_Octave_4.jpg ├── Key Point detection with SIFT.pdf └── main.py ├── Epipolar Geometry and Depth map ├── Images │ ├── tsucuba_left.png │ └── tsucuba_right.png ├── Results │ ├── task2_sift1.jpg │ ├── task2_sift2.jpg │ ├── task2_epi_left.jpg │ ├── task2_disparity.jpg │ ├── task2_epi_right.jpg │ └── task2_matches_knn.jpg ├── Epipolar geometry and Depth Map.pdf └── main.py ├── Panorama estimation with Image features and Homography ├── Images │ ├── mountain1.jpg │ └── mountain2.jpg ├── Results │ ├── task1_pano.jpg │ ├── task1_sift1.jpg │ ├── task1_sift2.jpg │ ├── task1_matches.jpg │ └── task1_matches_knn.jpg ├── Panorama estimation with Image features and Homography.pdf └── main.py ├── README.md └── LICENSE /KeyPoint Detection with SIFT/Images/Img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Images/Img.jpg -------------------------------------------------------------------------------- /Epipolar Geometry and Depth map/Images/tsucuba_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Epipolar Geometry and Depth map/Images/tsucuba_left.png -------------------------------------------------------------------------------- /Epipolar Geometry and Depth map/Results/task2_sift1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Epipolar Geometry and Depth map/Results/task2_sift1.jpg -------------------------------------------------------------------------------- /Epipolar Geometry and Depth map/Results/task2_sift2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Epipolar Geometry and Depth map/Results/task2_sift2.jpg -------------------------------------------------------------------------------- /Epipolar Geometry and Depth map/Images/tsucuba_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Epipolar Geometry and Depth map/Images/tsucuba_right.png -------------------------------------------------------------------------------- /Epipolar Geometry and Depth map/Results/task2_epi_left.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Epipolar Geometry and Depth map/Results/task2_epi_left.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_1_Scale_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_1_Scale_1.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_1_Scale_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_1_Scale_2.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_1_Scale_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_1_Scale_3.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_1_Scale_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_1_Scale_4.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_1_Scale_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_1_Scale_5.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_2_Scale_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_2_Scale_1.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_2_Scale_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_2_Scale_2.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_2_Scale_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_2_Scale_3.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_2_Scale_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_2_Scale_4.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_2_Scale_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_2_Scale_5.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_3_Scale_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_3_Scale_1.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_3_Scale_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_3_Scale_2.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_3_Scale_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_3_Scale_3.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_3_Scale_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_3_Scale_4.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_3_Scale_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_3_Scale_5.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_4_Scale_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_4_Scale_1.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_4_Scale_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_4_Scale_2.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_4_Scale_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_4_Scale_3.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_4_Scale_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_4_Scale_4.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Octave_4_Scale_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Octave_4_Scale_5.jpg -------------------------------------------------------------------------------- /Epipolar Geometry and Depth map/Results/task2_disparity.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Epipolar Geometry and Depth map/Results/task2_disparity.jpg -------------------------------------------------------------------------------- /Epipolar Geometry and Depth map/Results/task2_epi_right.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Epipolar Geometry and Depth map/Results/task2_epi_right.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Keypoints_Octave_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Keypoints_Octave_1.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Keypoints_Octave_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Keypoints_Octave_2.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Keypoints_Octave_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Keypoints_Octave_3.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/Keypoints_Octave_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/Keypoints_Octave_4.jpg -------------------------------------------------------------------------------- /Epipolar Geometry and Depth map/Results/task2_matches_knn.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Epipolar Geometry and Depth map/Results/task2_matches_knn.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Key Point detection with SIFT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Key Point detection with SIFT.pdf -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_1_Scale_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_1_Scale_1.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_1_Scale_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_1_Scale_2.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_1_Scale_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_1_Scale_3.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_1_Scale_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_1_Scale_4.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_2_Scale_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_2_Scale_1.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_2_Scale_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_2_Scale_2.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_2_Scale_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_2_Scale_3.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_2_Scale_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_2_Scale_4.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_3_Scale_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_3_Scale_1.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_3_Scale_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_3_Scale_2.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_3_Scale_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_3_Scale_3.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_3_Scale_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_3_Scale_4.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_4_Scale_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_4_Scale_1.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_4_Scale_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_4_Scale_2.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_4_Scale_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_4_Scale_3.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/DoG_Octave_4_Scale_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/DoG_Octave_4_Scale_4.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/BlackKeypoints_Octave_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/BlackKeypoints_Octave_1.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/BlackKeypoints_Octave_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/BlackKeypoints_Octave_2.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/BlackKeypoints_Octave_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/BlackKeypoints_Octave_3.jpg -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/Results/BlackKeypoints_Octave_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/KeyPoint Detection with SIFT/Results/BlackKeypoints_Octave_4.jpg -------------------------------------------------------------------------------- /Epipolar Geometry and Depth map/Epipolar geometry and Depth Map.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Epipolar Geometry and Depth map/Epipolar geometry and Depth Map.pdf -------------------------------------------------------------------------------- /Panorama estimation with Image features and Homography/Images/mountain1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Panorama estimation with Image features and Homography/Images/mountain1.jpg -------------------------------------------------------------------------------- /Panorama estimation with Image features and Homography/Images/mountain2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Panorama estimation with Image features and Homography/Images/mountain2.jpg -------------------------------------------------------------------------------- /Panorama estimation with Image features and Homography/Results/task1_pano.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Panorama estimation with Image features and Homography/Results/task1_pano.jpg -------------------------------------------------------------------------------- /Panorama estimation with Image features and Homography/Results/task1_sift1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Panorama estimation with Image features and Homography/Results/task1_sift1.jpg -------------------------------------------------------------------------------- /Panorama estimation with Image features and Homography/Results/task1_sift2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Panorama estimation with Image features and Homography/Results/task1_sift2.jpg -------------------------------------------------------------------------------- /Panorama estimation with Image features and Homography/Results/task1_matches.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Panorama estimation with Image features and Homography/Results/task1_matches.jpg -------------------------------------------------------------------------------- /Panorama estimation with Image features and Homography/Results/task1_matches_knn.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Panorama estimation with Image features and Homography/Results/task1_matches_knn.jpg -------------------------------------------------------------------------------- /Panorama estimation with Image features and Homography/Panorama estimation with Image features and Homography.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dani-amirtharaj/KeyPointDetection-Homography-EpipolarGeometry/HEAD/Panorama estimation with Image features and Homography/Panorama estimation with Image features and Homography.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KeyPoint detection, Panorama estimation with Homography, Epipolar geometry and Depth map 2 | 3 | * Each folder in this Repo has a main.py file, Images folder, Results folder and a .pdf report describing the Python program. 4 | * Each folder represents an individual program and has been appropriately named to identify its application. 5 | * Note that the program for keypoint detection using SIFT has been written using Python and Numpy (without OpenCV or other CV libraries - with the exception of reading or writing Images). 6 | * Other programs have been written in Python using OpenCV. 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Daniel Amirtharaj 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Epipolar Geometry and Depth map/main.py: -------------------------------------------------------------------------------- 1 | 2 | # Setting up program 3 | import cv2 4 | import numpy as np 5 | import matplotlib.pyplot as plt 6 | import numpy as np 7 | from scipy.stats import multivariate_normal 8 | from matplotlib.patches import Ellipse 9 | 10 | # Setting seed for reproducibility 11 | UBIT = 'damirtha' 12 | np.random.seed(sum([ord(c) for c in UBIT])) 13 | 14 | 15 | # Function to apply SIFT to given image 16 | def applySIFT(image): 17 | 18 | # Creating SIFT object, which will be used for applying SIFT on images 19 | sift = cv2.xfeatures2d.SIFT_create() 20 | 21 | # Detecting keypoints and computing keypoint descriptors for the inout images 22 | keypointsImage, descriptorImage = sift.detectAndCompute(image,None) 23 | 24 | return keypointsImage, descriptorImage 25 | 26 | # Function to get good matches, given feature descriptors 27 | def getGoodMatches(descriptorImage1, descriptorImage2): 28 | 29 | # Applying Brute Force matcher for getting K nearest neighbours for 30 | # each keypoint using respective descriptors 31 | bf = cv2.BFMatcher() 32 | matches = bf.knnMatch(descriptorImage1, descriptorImage2, k=2) 33 | 34 | goodList = [] 35 | good = [] 36 | 37 | # Filtering good matches based on a distance of 0.75 between 38 | # keypoint pairs in 2 images 39 | for m,n in matches: 40 | if m.distance < 0.75*n.distance: 41 | goodList.append([m]) 42 | good.append(m) 43 | 44 | return goodList, good 45 | 46 | # Function to get Inliers after RANSAC, accepts mask returned 47 | def getInliers(mask, num=10): 48 | matchesMask = mask.ravel().tolist() 49 | indices = [] 50 | for ind in range(len(matchesMask)): 51 | if matchesMask[ind] == 1: 52 | indices.append(ind) 53 | matchesMask = [0]*len(matchesMask) 54 | np.random.shuffle(indices) 55 | indices = indices[:num] 56 | for ind in indices: 57 | matchesMask[ind] = 1 58 | return matchesMask 59 | 60 | 61 | image1=cv2.imread('Images/tsucuba_left.png') 62 | image2=cv2.imread('Images/tsucuba_right.png') 63 | 64 | # Detecting keypoints and computing keypoint descriptors for the 2 inout images 65 | keypointsImage1, descriptorImage1 = applySIFT(image1) 66 | keypointsImage2, descriptorImage2 = applySIFT(image2) 67 | 68 | # Writing the matches detected in the 2 images to the filesystem 69 | Image1Keypoints=cv2.drawKeypoints(image1,keypointsImage1,None) 70 | cv2.imwrite('Results/task2_sift1.jpg',Image1Keypoints) 71 | Image2Keypoints=cv2.drawKeypoints(image2,keypointsImage2,None) 72 | cv2.imwrite('Results/task2_sift2.jpg',Image2Keypoints) 73 | 74 | # Get good matches using KNN algorithm between kepoint descriptors of 75 | # 2 input images 76 | goodList, good = getGoodMatches(descriptorImage1, descriptorImage2) 77 | 78 | # Plotting knn matches based on the keypoint distances computed 79 | # cv2.drawMatchesKnn expects list of lists as matkeypointsches 80 | imagePlot = cv2.drawMatchesKnn(image1,keypointsImage1,image2,keypointsImage2,goodList,None,flags=2) 81 | cv2.imwrite('Results/task2_matches_knn.jpg',imagePlot) 82 | 83 | # Getting keypoint locations as an array of (x,y) pixel coordinates 84 | ptsImage1 = np.int32(np.round([keypointsImage1[m.queryIdx].pt for m in good]).reshape(-1,1,2)) 85 | ptsImage2 = np.int32(np.round([keypointsImage2[m.trainIdx].pt for m in good]).reshape(-1,1,2)) 86 | 87 | # Getting Fundamental matrix after applying RANSAC on 88 | # well matched keypoints on both images 89 | F, mask = cv2.findFundamentalMat(ptsImage1,ptsImage2,cv2.RANSAC,1) 90 | 91 | # Get 10 inlier matches after applying RANSAC 92 | matchesMask = getInliers(mask, 10) 93 | inlierImage = cv2.drawMatches(image1,keypointsImage1,image2,keypointsImage2, 94 | good,None,matchesMask = matchesMask,flags = 2) 95 | 96 | # Applying mask on the keypoints to get 10 inlier pairs 97 | ptsImage1 = ptsImage1[np.array(matchesMask).ravel() == 1] 98 | ptsImage2 = ptsImage2[np.array(matchesMask).ravel() == 1] 99 | 100 | 101 | # Iterate over 10 inliers to calculate epilines 102 | h ,w, d = image1.shape 103 | for i in range(len(ptsImage1)): 104 | 105 | color = tuple(np.random.randint(0,255,3).tolist()) 106 | 107 | # Calculate epilines on image 2 for keypoints on image1 108 | line2 = cv2.computeCorrespondEpilines(ptsImage1[i], 1, F) 109 | 110 | # Calculate epilines on image 1 for keypoints on image2 111 | line1 = cv2.computeCorrespondEpilines(ptsImage2[i], 2, F) 112 | 113 | # Compute 2 sample points on each line for plotting 114 | p1 = map(int , [0,-line1.ravel()[2]/line1.ravel()[1]]) 115 | p2 = map(int, [w, -(line1.ravel()[2]+line1.ravel()[0]*w)/line1.ravel()[1]]) 116 | p3 = map(int , [0,-line2.ravel()[2]/line2.ravel()[1]]) 117 | p4 = map(int, [w, -(line2.ravel()[2]+line2.ravel()[0]*w)/line2.ravel()[1]]) 118 | 119 | # Draw epilines on corresponding image 120 | image1EpipolarLines = cv2.line(image1, tuple(p1), tuple(p2), color,1) 121 | image2EpipolarLines = cv2.line(image2, tuple(p3), tuple(p4), color,1) 122 | 123 | # Draw keypoints on corresponding image 124 | image1Final = cv2.circle(image1EpipolarLines, tuple(ptsImage1[i].ravel()), 2, color,5) 125 | image2Final = cv2.circle(image2EpipolarLines, tuple(ptsImage2[i].ravel()), 2, color,5) 126 | 127 | print('Fundamental Matrix:') 128 | print(F) 129 | 130 | cv2.imwrite('Results/task2_epi_right.jpg',image2Final) 131 | cv2.imwrite('Results/task2_epi_left.jpg',image1Final) 132 | 133 | # Compute disparity between 2 images to create depth map 134 | stereo = cv2.StereoBM_create(numDisparities=64, blockSize=21) 135 | disparity = stereo.compute(cv2.cvtColor(image1,cv2.COLOR_BGR2GRAY),cv2.cvtColor(image2,cv2.COLOR_BGR2GRAY)) 136 | 137 | plt.imsave('Results/task2_disparity.jpg',disparity, cmap='gray') 138 | -------------------------------------------------------------------------------- /Panorama estimation with Image features and Homography/main.py: -------------------------------------------------------------------------------- 1 | 2 | # Setting up program 3 | import cv2 4 | import numpy as np 5 | import matplotlib.pyplot as plt 6 | import numpy as np 7 | from scipy.stats import multivariate_normal 8 | from matplotlib.patches import Ellipse 9 | 10 | # Setting seed for reproducibility 11 | UBIT = 'damirtha' 12 | np.random.seed(sum([ord(c) for c in UBIT])) 13 | 14 | 15 | # Function to apply SIFT to given image 16 | def applySIFT(image): 17 | 18 | # Creating SIFT object, which will be used for applying SIFT on images 19 | sift = cv2.xfeatures2d.SIFT_create() 20 | 21 | # Detecting keypoints and computing keypoint descriptors for the inout images 22 | keypointsImage, descriptorImage = sift.detectAndCompute(image,None) 23 | 24 | return keypointsImage, descriptorImage 25 | 26 | # Function to get good matches, given feature descriptors 27 | def getGoodMatches(descriptorImage1, descriptorImage2): 28 | 29 | # Applying Brute Force matcher for getting K nearest neighbours for 30 | # each keypoint using respective descriptors 31 | bf = cv2.BFMatcher() 32 | matches = bf.knnMatch(descriptorImage1, descriptorImage2, k=2) 33 | 34 | goodList = [] 35 | good = [] 36 | 37 | # Filtering good matches based on a distance of 0.75 between 38 | # keypoint pairs in 2 images 39 | for m,n in matches: 40 | if m.distance < 0.75*n.distance: 41 | goodList.append([m]) 42 | good.append(m) 43 | 44 | return goodList, good 45 | 46 | # Function to get Inliers after RANSAC, accepts mask returned 47 | def getInliers(mask, num=10): 48 | matchesMask = mask.ravel().tolist() 49 | indices = [] 50 | for ind in range(len(matchesMask)): 51 | if matchesMask[ind] == 1: 52 | indices.append(ind) 53 | matchesMask = [0]*len(matchesMask) 54 | np.random.shuffle(indices) 55 | indices = indices[:num] 56 | for ind in indices: 57 | matchesMask[ind] = 1 58 | return matchesMask 59 | 60 | 61 | # Function to get left most and top most edge points, to translate warped image 62 | def getExtremePoints(image1CornersPlane2): 63 | 64 | # Computing the left most point (point corr. to xmin) 65 | xMin = min(image1CornersPlane2[0][0], image1CornersPlane2[1][0]) 66 | 67 | # Computing the top most point (point corr. to ymin) 68 | yMin = min(image1CornersPlane2[0][1], image1CornersPlane2[3][1]) 69 | 70 | # Computing the right most point (point corr. to xmax) 71 | xMax = max(image1CornersPlane2[2][0], image1CornersPlane2[3][0]) 72 | 73 | # Computing the lowest point (point corr. to ymax) 74 | yMax = max(image1CornersPlane2[1][1], image1CornersPlane2[2][1]) 75 | return xMin, yMin, xMax, yMax 76 | 77 | 78 | # Reading images 79 | image1=cv2.imread('Images/mountain1.jpg') 80 | image2=cv2.imread('Images/mountain2.jpg') 81 | 82 | # Detecting keypoints and computing keypoint descriptors for the 2 inout images 83 | keypointsImage1, descriptorImage1 = applySIFT(image1) 84 | keypointsImage2, descriptorImage2 = applySIFT(image2) 85 | 86 | # Writing the matches detected in the 2 images to the filesystem 87 | Image1Keypoints=cv2.drawKeypoints(image1,keypointsImage1,None) 88 | cv2.imwrite('Results/task1_sift1.jpg',Image1Keypoints) 89 | Image2Keypoints=cv2.drawKeypoints(image2,keypointsImage2,None) 90 | cv2.imwrite('Results/task1_sift2.jpg',Image2Keypoints) 91 | 92 | # Get good matches using KNN algorithm between kepoint descriptors of 93 | # 2 input images 94 | goodList, good = getGoodMatches(descriptorImage1, descriptorImage2) 95 | 96 | # Plotting knn matches based on the keypoint distances computed 97 | # cv2.drawMatchesKnn expects list of lists as matkeypointsches 98 | imagePlot = cv2.drawMatchesKnn(image1,keypointsImage1,image2,keypointsImage2,goodList,None,flags=2) 99 | cv2.imwrite('Results/task1_matches_knn.jpg',imagePlot) 100 | 101 | # Getting keypoint locations as an array of (x,y) coordinates 102 | ptsImage1 = np.array([ keypointsImage1[m.queryIdx].pt for m in good]).reshape(-1,1,2) 103 | ptsImage2 = np.array([ keypointsImage2[m.trainIdx].pt for m in good]).reshape(-1,1,2) 104 | 105 | # Getting homography matrix after applying RANSAC on 106 | # well matched keypoints on both images with projection error <= 1 107 | H, mask = cv2.findHomography(ptsImage1, ptsImage2, cv2.RANSAC) 108 | print('Homography Matrix:') 109 | print(H) 110 | 111 | # Get 10 inlier matches after applying RANSAC 112 | matchesMask = getInliers(mask, 10) 113 | inlierImage = cv2.drawMatches(image1,keypointsImage1,image2,keypointsImage2, 114 | good,None,matchesMask = matchesMask,flags = 2) 115 | cv2.imwrite('Results/task1_matches.jpg',inlierImage) 116 | 117 | # Getting corners of image 1 in the 2nd plane 118 | h, w, d = image1.shape 119 | image1Corners = np.float32([[0, 0], [0, h-1], [w-1, h-1], [w-1, 0]]).reshape(-1, 1, 2) 120 | image1CornersPlane2 = np.squeeze(cv2.perspectiveTransform(image1Corners,H)) 121 | 122 | # The following function gives the max dimensions that image1 can 123 | # take in the second plane (for displaying all pixels) 124 | xMin, yMin, xMax, yMax = getExtremePoints(image1CornersPlane2) 125 | 126 | # Using the max dimensions of image1 and combinations of 127 | # image 1 and 2 to find shape of output image 128 | t1 = (xMax-xMin, yMax-yMin) 129 | t2 = (len(image2[0])-int(xMin), len(image2)-int(yMin)) 130 | finalImageShape = max(t1,t2) 131 | 132 | # Translation matrix, to translate image1 by dimensions which go out 133 | # of the image returned from perspective warp due to -ve locations 134 | if xMin < 0 and yMin < 0: 135 | translate = np.float32([[1,0, -xMin], [0,1, -yMin], [0,0,1]]) 136 | elif xMin < 0: 137 | translate = np.float32([[1,0, -xMin], [0,1,0], [0,0,1]]) 138 | elif xMin < 0: 139 | translate = np.float32([[1,0,0], [0,1, -yMin], [0,0,1]]) 140 | else: 141 | translate = np.float32([[1,0,0], [0,1,0], [0,0,1]]) 142 | 143 | # Applying homography to image1 to warp it to image2 with translation 144 | finalImage = cv2.warpPerspective(image1, np.matmul(translate,H), finalImageShape) 145 | 146 | # Slicing the image with warped image1 to place image2 as well 147 | finalImage[-int(yMin):-int(yMin)+len(image2), -int(xMin):-int(xMin)+len(image2[0])]=image2 148 | cv2.imwrite('Results/task1_pano.jpg',finalImage) 149 | 150 | -------------------------------------------------------------------------------- /KeyPoint Detection with SIFT/main.py: -------------------------------------------------------------------------------- 1 | 2 | # Setting up the program and reading input image 3 | import cv2 4 | import numpy as np 5 | image=cv2.imread('Images/img.jpg') 6 | grayImage = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) 7 | imageArray=np.asarray(grayImage) 8 | 9 | # Function to generate gaussian kernel given sigma and kernel width/height 10 | def generateGaussianKernel(sigma, oddSize): 11 | kernelRowIndex = [i for i in range(-(oddSize//2),oddSize//2+1)] 12 | kernelColIndex = [-1*i for i in range(-(oddSize//2),oddSize//2+1)] 13 | 14 | gaussianKernel=[] 15 | gaussianNormaliser=0 16 | 17 | for cIndex in kernelColIndex: 18 | gaussianKernelCol=[] 19 | 20 | for rIndex in kernelRowIndex: 21 | 22 | # Equation to generate values for gaussian at different intervals 23 | gaussianPixel = (1/(2*3.14159*(sigma**2)))*np.exp( 24 | -1*(((rIndex)**2+(cIndex)**2)/(2*(sigma**2)))) 25 | gaussianNormaliser+= gaussianPixel 26 | gaussianKernelCol.append(gaussianPixel) 27 | 28 | gaussianKernel.append(gaussianKernelCol) 29 | gaussianKernel=gaussianKernel/gaussianNormaliser 30 | return gaussianKernel 31 | 32 | # Function to compute and add zero pads to the input image, 33 | # based on the size of the Gaussian kernel 34 | def padImage(imageArray, gaussianKernel): 35 | 36 | paddedImage=[] 37 | imageHpad=[0 for i in range(len(imageArray[0])+(len(gaussianKernel)-1))] 38 | 39 | for ind in range(len(gaussianKernel)//2): 40 | paddedImage.append(imageHpad) 41 | 42 | for row in range(len(imageArray)): 43 | paddedImageRow=[] 44 | 45 | for ind in range(len(gaussianKernel)//2): 46 | paddedImageRow.append(0) 47 | 48 | for column in range(len(imageArray[0])): 49 | paddedImageRow.append(imageArray[row][column]) 50 | 51 | for ind in range(len(gaussianKernel)//2): 52 | paddedImageRow.append(0) 53 | paddedImage.append(paddedImageRow) 54 | 55 | for ind in range(len(gaussianKernel)//2): 56 | paddedImage.append(imageHpad) 57 | return paddedImage 58 | 59 | # Function to apply gaussian kernel to the input image 60 | def generateFilteredImage (imageArray, gaussianKernel): 61 | filterResult=[] 62 | halfKernelSize=len(gaussianKernel)//2 63 | windowIndex = [i for i in range(-(halfKernelSize),halfKernelSize+1)] 64 | 65 | for row in range(halfKernelSize,len(imageArray)-halfKernelSize): 66 | filterResultRow=[] 67 | 68 | for column in range(halfKernelSize,len(imageArray[0])-halfKernelSize): 69 | pixelResult=0 70 | 71 | for rIndex in windowIndex: 72 | for cIndex in windowIndex: 73 | pixelResult+=imageArray[row+rIndex][column+cIndex]*gaussianKernel[ 74 | rIndex+halfKernelSize][cIndex+halfKernelSize] 75 | 76 | filterResultRow.append(pixelResult) 77 | filterResult.append(filterResultRow) 78 | 79 | return filterResult 80 | 81 | # Function to generate 4 Octaves for the input image 82 | def generateOctaves(imageArray): 83 | NUM_OCTAVES = 4; 84 | octaves=[] 85 | 86 | for index in range(NUM_OCTAVES): 87 | resizedImage=[] 88 | 89 | for row in range(0,len(imageArray),2**(index)): 90 | resizedImageRow=[] 91 | for column in range(0,len(imageArray[0]),2**(index)): 92 | resizedImageRow.append(imageArray[row][column]) 93 | resizedImage.append(resizedImageRow) 94 | 95 | octaves.append(resizedImage) 96 | return octaves; 97 | 98 | # Function to generate 5 scales for each octave of the input image 99 | def generateScales(octaves): 100 | 101 | # Given values of sigma for each octave and scale 102 | sigmaArray=[[1/(2**0.5),1,2**0.5,2,2*(2**0.5)], 103 | [2**0.5,2,2*(2**0.5),4,4*(2**0.5)], 104 | [2*(2**0.5),4,4*(2**0.5),8,8*(2**0.5)], 105 | [4*(2**0.5),8,8*(2**0.5),16,16*(2**0.5)]] 106 | scaledOctave=[] 107 | 108 | for rIndex in range(len(sigmaArray)): 109 | scaledOctaveRow=[] 110 | for cIndex in range(len(sigmaArray[0])): 111 | 112 | # Call functions to generate gaussian, add zero pads to image and generate 113 | # gaussian blurs for each image in the scale space 114 | gaussianKernel = generateGaussianKernel(sigmaArray[rIndex][cIndex],7) 115 | paddedImage = padImage(octaves[rIndex],gaussianKernel) 116 | filteredImage=generateFilteredImage(paddedImage, gaussianKernel) 117 | 118 | scaledOctaveRow.append(filteredImage) 119 | scaledOctave.append(scaledOctaveRow) 120 | return scaledOctave 121 | 122 | # Function to get DoG images given the entire scale space 123 | def getDiffGaussian(scaledOctaves): 124 | diffGaussian=[] 125 | 126 | for rIndex in range(len(scaledOctaves)): 127 | diffGaussianRow=[] 128 | for cIndex in range(len(scaledOctaves[0])-1): 129 | diffImage=[] 130 | 131 | for row in range(len(scaledOctaves[rIndex][cIndex])): 132 | diffImageRow=[] 133 | for column in range(len(scaledOctaves[rIndex][cIndex][0])): 134 | 135 | diffPixel=scaledOctaves[rIndex][cIndex][row][column 136 | ]-scaledOctaves[rIndex][cIndex+1][row][column] 137 | diffImageRow.append((diffPixel)) 138 | 139 | diffImage.append(diffImageRow) 140 | diffGaussianRow.append(diffImage) 141 | 142 | diffGaussian.append(diffGaussianRow) 143 | return diffGaussian; 144 | 145 | # Function to detect extrema pixels (maxima and minima), 146 | # returns pixel locations of maxima and minima 147 | def keyPointDetection(diffGaussian): 148 | windowIndex=[-1,0,1] 149 | extremaPixel=[] 150 | NUM_PIXELS_COMPARED=26 151 | keyPoints=[] 152 | 153 | # Iterate over scale space of 4 octaves 154 | for rIndex in range(len(diffGaussian)): 155 | keyPointsOctave=[] 156 | for cIndex in range(1,len(diffGaussian[0])-1): 157 | 158 | keyPointsScale=[] 159 | indexedImage = diffGaussian[rIndex][cIndex] 160 | indexedImageAbove = diffGaussian[rIndex][cIndex+1] 161 | indexedImageBelow = diffGaussian[rIndex][cIndex-1] 162 | 163 | for row in range(1,len(indexedImage)-1): 164 | for column in range(1,len(indexedImage[0])-1): 165 | maxPixel=0 166 | minPixel=0 167 | 168 | for rWindowIndex in windowIndex: 169 | for cWindowIndex in windowIndex: 170 | 171 | # Compare value of pixel to neighbours 172 | if indexedImage[row][column] > indexedImageAbove[ 173 | row+rWindowIndex][column+cWindowIndex]: 174 | maxPixel+=1 175 | if indexedImage[row][column] < indexedImageAbove[ 176 | row+rWindowIndex][column+cWindowIndex]: 177 | minPixel+=1 178 | if indexedImage[row][column] > indexedImageBelow[ 179 | row+rWindowIndex][column+cWindowIndex]: 180 | maxPixel+=1 181 | if indexedImage[row][column] < indexedImageBelow[ 182 | row+rWindowIndex][column+cWindowIndex]: 183 | minPixel+=1 184 | if indexedImage[row][column] > indexedImage[ 185 | row+rWindowIndex][column+cWindowIndex]: 186 | maxPixel+=1 187 | if indexedImage[row][column] < indexedImage[ 188 | row+rWindowIndex][column+cWindowIndex]: 189 | minPixel+=1 190 | 191 | # Break if it cannot be maxima or minima 192 | if maxPixel>0 and minPixel>0: 193 | break 194 | if maxPixel>0 and minPixel>0: 195 | break 196 | 197 | # Check if pixel is greater than or lesser than 26 neighbours 198 | if maxPixel is NUM_PIXELS_COMPARED or minPixel is NUM_PIXELS_COMPARED: 199 | extremaPixel=(row,column) 200 | keyPointsScale.append(extremaPixel) 201 | 202 | # Collect keypoints 203 | keyPointsOctave.append(keyPointsScale) 204 | keyPoints.append(keyPointsOctave) 205 | return keyPoints 206 | 207 | # Plot keypoints on original image 208 | def finalKeypointImage(keyPoints): 209 | keypointsImage=[] 210 | resizedKeypoints=[] 211 | for octave in range(len(keyPoints)): 212 | keyImage=image+0; 213 | resizedKeypointsRow=[] 214 | for scale in range(len(keyPoints[0])): 215 | for i in keyPoints[octave][scale]: 216 | l=list(i) 217 | l[0]=l[0]*(2**octave) 218 | l[1]=l[1]*(2**octave) 219 | keyImage[tuple(l)]=255; 220 | resizedKeypointsRow.append(tuple(l)) 221 | resizedKeypoints.append(resizedKeypointsRow) 222 | keypointsImage.append(keyImage) 223 | return keypointsImage, resizedKeypoints 224 | 225 | # Call funtions to generate octaves, scale space, DoG and find keypoints 226 | octaves=generateOctaves(imageArray) 227 | scaledOctaves=generateScales(octaves) 228 | diffGaussian=getDiffGaussian(scaledOctaves) 229 | keyPoints=keyPointDetection(diffGaussian) 230 | keypointsImage, resizedKeypoints=finalKeypointImage(keyPoints) 231 | 232 | # Used in getting the left most keypoints in the image 233 | def compare(l): 234 | return l[1] 235 | 236 | # Save keypoints for each octave overlayed on the original image 237 | for i in range(len(keypointsImage)): 238 | cv2.imshow('Keypoints',np.asarray(keypointsImage[i])) 239 | cv2.imwrite('Results/Keypoints_Octave_'+str(i+1)+'.jpg',np.asarray(keypointsImage[i])) 240 | cv2.waitKey(0) 241 | cv2.destroyAllWindows() 242 | 243 | # Print the Left most points in an image 244 | for i in range(len(resizedKeypoints)): 245 | print("\n Left Most Keypoints in octave "+str(i+1)+": \n") 246 | resizedKeypoints[i].sort(key=compare) 247 | for j in range(10): 248 | try: 249 | print(resizedKeypoints[i][j]) 250 | except: 251 | None 252 | 253 | # Plot keypoints on black image, for better visualization 254 | blackSize=(len(imageArray),len(imageArray[0])) 255 | for octave in range(len(keyPoints)): 256 | black=np.zeros(blackSize); 257 | for scale in range(len(keyPoints[0])): 258 | for i in keyPoints[octave][scale]: 259 | l=list(i) 260 | l[0]=l[0]*(2**octave) 261 | l[1]=l[1]*(2**octave) 262 | black[tuple(l)]=255; 263 | cv2.imshow('BlackKeyPoints',np.asarray(black)) 264 | cv2.imwrite('Results/BlackKeypoints_Octave_'+str(octave+1)+'.jpg',np.asarray(black)) 265 | cv2.waitKey(0) 266 | cv2.destroyAllWindows() 267 | 268 | # Display Scale Space 269 | for i in range(len(scaledOctaves)): 270 | for j in range(len(scaledOctaves[0])): 271 | cv2.imshow('Scale Space',np.asarray(scaledOctaves[i][j])/255) 272 | cv2.imwrite('Results/Octave_'+str(i+1)+'_Scale_'+str(j+1)+ 273 | '.jpg',np.asarray(scaledOctaves[i][j])) 274 | cv2.waitKey(0) 275 | cv2.destroyAllWindows() 276 | 277 | # Display DoG images 278 | for i in range(len(diffGaussian)): 279 | for j in range(len(diffGaussian[0])): 280 | cv2.imshow('DoG',np.asarray(diffGaussian[i][j])) 281 | cv2.imwrite('Results/DoG_Octave_'+str(i+1)+'_Scale_'+str(j+1)+ 282 | '.jpg',np.asarray(diffGaussian[i][j])*255) 283 | cv2.waitKey(0) 284 | cv2.destroyAllWindows() --------------------------------------------------------------------------------