Kernal implementaion Exp-7
import numpy as np import cv2 import matplotlib . pyplot as plt img = cv2 .imread( 'butterfly.jpg' ) gray = cv2 .cvtColor( img , cv2 .COLOR_BGR2GRAY) blur = cv2 .GaussianBlur( gray , ( 5 , 5 ), 0 ) # Robert Edge Detection kernelxx = np .array([[ 1 , 0 ], [ 0 , - 1 ]]) kernelyy = np .array([[ 0 , 1 ], [- 1 , 0 ]]) img_robertx = cv2 .filter2D( img , - 1 , kernelxx ) img_roberty = cv2 .filter2D( img , - 1 , kernelyy ) grad = cv2 .addWeighted( img_robertx , 0.5 , img_roberty , 0.5 , 0 ) plt . imshow ( grad , cmap = 'gray' ) plt . title ( "Robert Edge Detection" ) plt . axis ( 'off' ) # Laplacian laplacian = cv2 .Laplacian( img , cv2 .CV_64F) sobelx = cv2 .Sobel( src = blur , ddepth = cv2 .CV_64F, dx = 1 , dy = 0 , ksize = 3 ) sobely = cv2 .Sobel( src = blur , ddepth = cv2 .CV_64F, dx = 0 , dy = 1 , ksize = 3 ) fig , axs = plt . subplots ( 2 , 2 ) titles = [ 'Original' , 'Sobel along X-axis' , 'Sobel along Y-axis...