opencv use simple convolution

CV CV2 AS Import 

Import numpy AS NP

IMG = cv.imread ( 'learn.jpg', cv.IMREAD_GRAYSCALE)

cv.imshow ( 'First Image', IMG)
img_size = img.shape
Print (img_size)

imgkernel np.array = ( [[-2, -1,0],
[-1, 1,1],
[0, 1,2]]
)

Print (imgkernel)
# CV using the convolution kernel convolved image

dst = cv.filter2D (img , -1, imgkernel)
cv.imshow ( 'filter IMG', DST)
Print (dst.shape) # arrays can view has not changed, as the same manner described convolution

img_dst np.hstack = ((IMG, DST))

CV. imshow ( 'Merge IMG', img_dst)

cv.waitKey ()
cv.destroyAllWindows ()

 




Guess you like

Origin www.cnblogs.com/tangjunjun/p/11243361.html