-
-
Save Praveen76/24a96af95938258b23dcfd4c602a1414 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
import cv2 as cv | |
import numpy as np | |
img=cv.imread('D:/img.JPG') | |
cv.imshow('img','img) | |
kernel=np.ones((5,5),np.uint8) | |
erosion=cv.erode(img,kernel,iterations=1) | |
dilation=cv.dilate(img,kernel,iterations=1) | |
opening=cv.morphologyEx(img,cv.MORPH_OPEN,kernel) | |
closing=cv.morphologyEx(img,cv.MORPH_CLOSE,kernel) | |
gradient=cv.morphologyEx(img,cv.MORPH_GRADIENT,kernel) | |
cv.imshow('erosion',erosion) | |
cv.imshow('dilation',dilation) | |
cv.imshow('opening',opening) | |
cv.imshow('closing',closing) | |
cv.imshow('gradient',gradient) | |
cv.waitKey(0) | |
cv.destroyAllWindows() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment