Assignment 4: Canny Edge Detection
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** ...
Comments
Post a Comment