I have a ".jpg" image and I can't read it using cv2.imread():
img=cv2.imread(file_path)
print(img.shape)
AttributeError: 'NoneType' object has no attribute 'shape'
Even if I try :
img=cv2.imread(file_path,cv2.IMREAD_UNCHANGED)
print(img.shape)
AttributeError: 'NoneType' object has no attribute 'shape'
However, if I try :
img=plt.imread(file_path)
print(img.shape)
It works successfully:
(3300, 2550, 3)
However, I want to work with cv2.imread()
, so why its not working here ?
Update: The file basename in the file path contains arabic letters, when I change the base name to english letters, the cv2.imread() works and read the image, but I need to pass it using its original name, so I have tried :
img=cv2.imread(u'{}'.format(file_path))
But still it doesnt work.