Assignment 4: Canny Edge Detection
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXTTXYQb7AInRhWEKuNHWlTbYN9l-FlSMjMbbPbk-MDeinBQSskYOeXRnqHgg9PzJuat01ChdE3bAUcPW7tGsLwoSfhK-rF0s2wLLM6jlfCmIhYcsI57YG9sWQSsdvJi5SXoiUjl_0UfTtHi7vIzttmSGmKme0_cTCVCAIAW9wS6FFd4FiZqVsdTu_/w437-h325/Picture1.png)
Image Link: https://drive.google.com/drive/folders/1USa7N0JCIeGGhZhkKP18-QuziOzh8riX?usp=share_link Canny Edge Detection Algorithm Basic Code: import cv2 import matplotlib.pyplot as plt import numpy as np imPth = r ' c m.jpg' img = plt.imread(imPth) plt.imshow(img, cmap = 'gray' ) E = cv2.Canny(img, 150 , 250 ) plt.subplot( 121 ) plt.imshow(img, cmap = 'gray' ) plt.axis( 'off' ) plt.subplot( 122 ) plt.imshow(E, cmap = 'gray' ) plt.axis( 'off' ) plt.show() Gaussian filter x = 0 y = - 1 sigma = 1 v = ( 1 /( 2 *np.pi*(sigma** 2 )))*np.exp(-(x** 2 + y** 2 )/( 2 *(sigma** 2 ))) v def f_getGaussianFilter ( s , sigma ): maxX = s// 2 minX = -maxX minY = minX maxY = maxX G = np.zeros((s,s)) for x in range (minX,maxX+ 1 ): for y in range (minY,maxY+ 1 ): v = ( 1 /( 2 *np.pi*(sigma** 2 )))*np.exp(-(x** 2 + y** 2 )/( 2 *(sigma** 2 ))) G[x-minX,y-minY] = v return G G = f_getGaus