# Read image in grayscale mode
img = cv2.imread(inp_pic,0)
# Median Blur and Gaussian Blur to remove Noise
img = cv2.medianBlur(img,3)
img = cv2.GaussianBlur(img, (5, 5), 0)
print(img)
# Adaptive Threshold for handling lightning
im_th = cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY_INV,11,5)
print(im_th)
功能自適應閾值這裏將返回一個空矩陣,但傳遞的圖像(IMG)是不是空矩陣(我檢查用print語句)爲什麼會這樣呢?cv2.adaptiveThreshold()返回空矩陣
你可以在這裏找到源代碼: https://github.com/tanmay-edgelord/HandwrittenDigitRecognition/blob/master/performRecognition.ipynb
你可以發佈圖片嗎? –
已添加到存倉庫 –
您是否將'[0 0 0 ...,0 0 0]'指定爲空矩陣? – ZdaR