## 3 Methodology
### SIFT--Scale-Invariant Feature Transform
SIFT utilizes a cascade filtering approach to identify keypoints, which are distinctive and descriptive features that can be used for matching or identification purposes. The first step in keypoint detection using SIFT is to locate blobs, which are patches with local appearance, and their scale. To locate blobs, SIFT uses a function, \(L(i,j,\sigma)\), which convolves with a varying Gaussian, \(G(i,j,\sigma)\), and an input image, \(I(i,j)\), to identify blob locations over multiple scales. The varying Gaussian serves as a filter to detect blobs at different scales, while the input image is the image being analyzed for keypoints. By convolving these two elements, SIFT is able to detect blobs and their scale, which are important for keypoint detection:  
\[L(i,i,\sigma)=G(i,j,\sigma)*I(i,j) \tag{1}\]  
Here, \(*\) denotes the process of convolution on image \(I(i,j)\) in \(i\) and \(j\), and \(G(i,j,\sigma)\) is the following:  
\[G(i,j,\sigma)=\frac{1}{2\pi\sigma^{2}}e^{-\frac{(\hat{i}^{2}+\hat{j}^{2})}{2 \sigma^{2}}} \tag{2}\]  
A scale space is created using three-octave stages while continuously blurring out the input image and dividing its size by each octave; the scale space is defined by the function in (1). Overall, the SIFT algorithm is effective in detecting keypoints, which are distinctive and descriptive features that can be used for matching and identification purposes. Its cascade filtering approach allows for the detection of blobs and their scale, which are  
Figure 8: (**a**) Originally detected muzzle image of a horse far away from the camera, (**b**) a grayscale image with some keypoints detected by SIFT before processing, (**c**) unique, descriptive features detected by SIFT after processing, and (**d**) region of interest highlighted, where unique keypoints are detected. important elements in keypoint detection. This makes SIFT a useful tool for identifying keypoints in images or video for a variety of computer vision applications. This function is seen in action in Figure 9a-c are in the first octave, where blobs with larger scales are located; then, Figure 9d-f in the second octave for blobs of medium size are located, and, lastly, Figure 9g-i in the third octave for blobs of small magnification are located. With this scale space generated, SIFT now can detect blobs, but in order to detect rich keypoints, SIFT uses the extrema of this scale space by applying convolution between difference-of-Gaussian \(D(x,y,\sigma)\) with the image. SIFT achieves this by taking the difference of nearby scales, as in Figure 10, having a difference of \(k\), which is a constant multiple:  
\[D(i,j,\sigma)=(G(i,j,k\sigma)-G(i,j,\sigma))*I(i,j)\]  
\[D(i,j,\sigma)=L(i,j,k\sigma)-L(i,j,\sigma) \tag{3}\]  
Figure 9: Scale-space generation using scale-invariant feature transform algorithm. The blobs that either have local minima or local maxima values after passing from difference of Gaussian are considered keypoints by SIFT. SIFT finds these key-points by performing a comparison of each pixel from the image to a total of 26 neighbors, which include eight pixels present at the same scale level, nine from the scale below, and nine from the scale above; see Figure 12.  
Figure 11: Image pyramid after applying difference of Gaussian or DoG. Figure 7:0 Difference of Gaussian for the detection of rich keypoints. The resulting images after passing through the difference-of-Gaussian function are shown in Figure 11, which shows the pyramid of the difference-of-Gaussian function. After the detection of local minima and maxima, SIFT discards blobs that are located along the edges as the edges are not considered rich keypoints. This leaves SIFT with feature-rich keypoints localized by minima and maxima; next, SIFT assigns these points an orientation by weight of the gradient magnitude of the keypoint and then adds to a histogram with a Gaussian window with a constant scale of keypoints, and then by \(argmax\) of that histogram.