0
votes

Traceback (most recent call last): File "D:/01_GRL/DCM/OCR_CNN_Test.py", line 31, in img = cv2.resize(img,(32,32)) TypeError: Expected Ptr for argument 'src'

I couldn't install the "Pickle" package. Is this error related to the "Pickle" package? How can I fix it? Please help me.

1
Could you show your code snippet? How are you loading your image? - Scott

1 Answers

0
votes

In OpenCV you can resize an image in two ways:

-defining the destination size

img_resized = cv2.resize(img,(700,512),interpolation=cv2.INTER_CUBIC)

-defining the percentage of your destination image. (In the example below I want to obtain an image with x and y axes' sizes 75% of the original ones)

img_resized = cv2.resize(img,None,fx=0.75,fy=0.75)

Be sure that the image you are passing exists (sometimes a path error can occur providing a wrong path!). So try to print it with

print(img)

If it returns None then the path to your image is wrong.