The goal of this project was to create my own mathematical functions for doing edge detection. I started with the functions that were built into Matlab which I later replaced with my own versions. I chose a picture from the internet t use for testing my functions.
Gradient Function
The first function was the gradient function. This function creates two arrays the same size as the original image. It then iterates over the original image and finds the derivative of the image with respect to x and y. The derivatives are placed into the newly created arrays.
Three different methods are used for finding the derivative of the photo. Most of the values are calculated using the central difference technique. This works for the middle values but applying it to the first and last value would go out of bounds. This is fixed by using the forward difference and backward difference for these values.
Kernel Function
The second function we needed to create is a kernel function. This function creates different types of kernels for the filtering process. Our function needed to be able to create Gaussian, Prewitt, Sobel, and Roberts filters.
Conclusion
The resulting functions were able to achieve the same output as the original Matlab functions. The original paper for this assignment can be found here. Pictures of the different functions and effects on the chosen image can be seen below.