logo
Loading...

m2=cv2.erode(m1, np.ones((40,40)))?code這當中的40,40代表甚麼意思? - Cupoy

import cv2import numpy as npimport pytesseract as ...

m2=cv2.erode(m1, np.ones((40,40)))?code這當中的40,40代表甚麼意思?

2020/02/27 10:47 AM
電腦視覺深度學習論壇
小陽
觀看數:0
回答數:4
收藏數:0

import cv2

import numpy as np

import pytesseract as pt

#

#m1=cv2.imread("C:\\Users\\user\\Desktop\\opencv_python_TEST20200213\\123.png",1)

#cv2.imshow("Image 1",m1)

#t=pt.image_to_string(m1,"eng")

#print(t)

#

#cv2.waitKey(0)

#cv2.destroyAllWindows()



m1=cv2.imread("C:\\Users\\user\\Desktop\\opencv_python_TEST20200213\\123.png",1)

m2=cv2.erode(m1, np.ones((40,40)))

m2=cv2.cvtColor(m2,cv2.COLOR_BGR2GRAY)

t, m2=cv2.threshold(m2, 240, 255, cv2.THRESH_BINARY)

##m2=cv2.bitwise_not(m2)

p,t=cv2.findContours(m2,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)

for d in p:

   x, y, w, h =cv2.boundingRect(d)

   if w>h:

       m2=m1[y:y+h,x:x+w].copy()

       m1[:,:]=255

       m1[y:y+h,x:x+w]=m2


cv2.imshow("Image 1",m1)

t=pt.image_to_string(m1,"eng")

print(t)


cv2.waitKey(0)

cv2.destroyAllWindows()



------------------------------------------------------------------


問題:

m2=cv2.erode(m1, np.ones((40,40)))


code這當中的40,40代表甚麼意思?