Created
March 23, 2019 09:49
-
-
Save saurabhpal97/2ec2367ad15beb0b64a41ec0689d8cd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#importing the required libraries | |
import numpy as np | |
import cv2 | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
image = cv2.imread('index.png') | |
#using the averaging kernel for image smoothening | |
averaging_kernel = np.ones((3,3),np.float32)/9 | |
filtered_image = cv2.filter2D(image,-1,kernel) | |
plt.imshow(dst) | |
#get a one dimensional Gaussian Kernel | |
gaussian_kernel_x = cv2.getGaussianKernel(5,1) | |
gaussian_kernel_y = cv2.getGaussianKernel(5,1) | |
#converting to two dimensional kernel using matrix multiplication | |
gaussian_kernel = gaussian_kernel_x * gaussian_kernel_y.T | |
#you can also use cv2.GaussianBLurring(image,(shape of kernel),standard deviation) instead of cv2.filter2D | |
filtered_image = cv2.filter2D(image,-1,gaussian_kernel) | |
plt.imshow() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment