logo
Loading...

為何這張圖就無法遮蔽chrome左邊的LOGO - Cupoy

import cv2import numpy as npimport pytesseract as ...

為何這張圖就無法遮蔽chrome左邊的LOGO

2020/03/03 04:46 AM
電腦視覺深度學習論壇
小陽
觀看數:0
回答數:1
收藏數:1

import cv2

import numpy as np

import pytesseract as pt


m1=cv2.imread("C:\\Users\\johnny-lin\\Desktop\\opencv_python_TEST20200213\\chrome.png",1)

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

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

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

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()



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


問題1:

為何這張圖(如下圖)就無法遮蔽chrome左邊的LOGO,這是為什麼?

要如何才有辦法遮蔽?