Jedes Bild ist ein Numpy-Array innerhalb dieser Matrixdatei. Was ich also tun möchte, ist, einige cv2-Funktionen auf jedes Numpy-Array-Bild innerhalb dieser Matrix anzuwenden. aber ich konnte nicht. Das Problem ist, dass cv2 nur Dateipfade
akzeptiert. Ich könnte aber das Bild herunterladen und dann cv2-Funktionen darauf anwenden Diese Methode ist nicht anwendbar und führt zu einer schlechten Leistung.
Wie kann ich ein Numpy-Array-Bild in cv2 eingeben?
Dies ist ein einfacher Teil von mir Code
Code: Select all
img=cv2.imread('/content/download.png')
img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
#thresholding to remove background
thr = cv2.threshold(img, 0, 255, cv2.THRESH_OTSU)[1]
Code: Select all
arr = np.asarray(bytearray(some_pic_image), dtype=np.uint8)
img = cv2.imdecode(arr, -1) # 'Load it as it is'
img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
Wie kann ich das machen?