Please Login in order to post a comment
import numpy as np import cv2
a = np.array([[0,0,0,0,0,0,0,0,0,0],[0,1,1,1,1,1,1,1,0,0],[0,0,0,0,1,1,1,1,0,0], [0,0,0,0,1,1,1,1,0,0], [0,0,0,1,1,1,1,1,0,0], [0,0,0,0,1,1,1,1,0,0], [0,0,0,1,1,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0] ],np.uint8)
s = np.array([ [1,1,1], [1,1,1], [1,1,1]],np.uint8) img_dilation = cv2.erode(a, s, iterations=1)
print(np.count_nonzero(img_dilation))
import numpy as np import matplotlib.pyplot as plt from skimage.io import imread, imshow from skimage.draw import disk from skimage.morphology import (erosion, dilation, closing, opening, area_closing, area_opening) from skimage.color import rgb2gray a = np.array([ [0,0,0,0,0,0,0,0,0,0], [0,1,1,1,1,1,1,1,0,0], [0,0,0,0,1,1,1,1,0,0], [0,0,0,0,1,1,1,1,0,0], [0,0,0,1,1,1,1,1,0,0], [0,0,0,0,1,1,1,1,0,0], [0,0,0,1,1,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0] ]) s = np.array([ [1,1,1], [1,1,1], [1,1,1]]) unique, freq = np.unique(erosion(a,s), return_counts=True) print(freq[1]) unique, freq = np.unique(erosion(a,s), return_counts=True) print(freq[1])
Anyone know how to set the input?
http://users.utcluj.ro/~raluca/ip_2014/ipl_07e.pdf To learn about erosion, refer this link!
No more comments
Seems like cookies are disabled on this browser, please enable them to open this website
import numpy as np import cv2
a = np.array([[0,0,0,0,0,0,0,0,0,0],[0,1,1,1,1,1,1,1,0,0],[0,0,0,0,1,1,1,1,0,0], [0,0,0,0,1,1,1,1,0,0], [0,0,0,1,1,1,1,1,0,0], [0,0,0,0,1,1,1,1,0,0], [0,0,0,1,1,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0] ],np.uint8)
s = np.array([ [1,1,1], [1,1,1], [1,1,1]],np.uint8) img_dilation = cv2.erode(a, s, iterations=1)
unique, freq = np.unique(dilation(a,s), return_counts=True)
print(freq[1])
print(np.count_nonzero(img_dilation))
Anyone know how to set the input?
Anyone know how to set the input?
http://users.utcluj.ro/~raluca/ip_2014/ipl_07e.pdf To learn about erosion, refer this link!