Closed AkshadaShinde closed 4 years ago
The error could literally be at any place where you are attempting to treat an entity as a list / numpy.array etc. when in fact it is None.
Would you mind sharing the traceback that Python printed to your screen (output device)?
yeah sure.
Traceback (most recent call last):
File "crop2.py", line 41, in
It seems, and I'm diagnosing without reproducing the issue, that the image was never successfully read in the line:
img = cv2.imread(os.path.join(folder,file_name))
A simple check would be to add the line:
if img is None:
print("did not read image")
return
right after attempting to read the image.
coords[i] does not fetch an integer value. You have to do an int(coords[i]) for feeding into cv2.
import cv2 import os
def load_Text_Files_from_folder(folder,ext_img,ext_txt): count=0 for filename in os.listdir(folder): file_name=filename img = cv2.imread(os.path.join(folder,file_name))
if name == 'main': folder='tmp/out_images/' ext_img=('jpeg','jpg','png','tif') ext_txt=('txt')
I write this code but found typeerror that none object is not subscritable. can you please tell me where i m wrong? @argman please help me.