This is my code:

# loading image from folder
folders = glob.glob('path to folder ')

imagenames_list = []

for folder in folders:
    for f in glob.glob(folder+'/*.jpg'):

read_images = []        

for image in imagenames_list:
    read_images.append(cv2.imread(image, cv2.IMREAD_GRAYSCALE))

re_size = cv2.resize(read_images, (50,50), interpolation=cv2.INTER_LINEAR)

I get this error

Expected Ptr<cv::UMat> for argument '%s'

What does this mean and how can I fix it?


I changed the data type from float16 to float32, solving the problem:

  • $\begingroup$ not working for me.. $\endgroup$ – Shark Deng Jul 10 '20 at 15:22

I think your problem is because you are feeding a list instead of numpy array of image to cv2.resize.

re_size = [cv2.resize(img, (50,50), interpolation=cv2.INTER_LINEAR) for img in read_images] 

should fix that for you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.