Pil - Typeerror: Src Is Not A Numpy Array, Neither A Scalar
from PIL import Image import pytesseract import argparse import cv2 import os image = Image.open('C:/Users/NB/Desktop/Scan/Arti818.jpg') #image = 'C:/Users/NB/Desktop/Scan/Arti8
Solution 1:
Read the docs. It clearly says:
PIL
.Image
.open
(fp, mode='r'
)Opens and identifies the given image file. Returns: An
Image
object.
The object returned is of Image
type, not a numpy.ndarray
. If you want an array, convert image
to one:
gray = cv2.cvtColor(np.asarray(image), cv2.COLOR_BGR2GRAY)
Post a Comment for "Pil - Typeerror: Src Is Not A Numpy Array, Neither A Scalar"