Brody_Brody
Brody_Brody

Reputation: 315

AttributeError: 'NoneType' object has no attribute 'shape' on jupyter notebook

So I have this problem where I am trying to load an image data into jupyter notebook. I have no problem loading imgA as when I check the image using print(imgA) the matrices is displayed, while imgB keeps on giving me a notype attribute error even though both the image is saved in the same folder.

Here are my codes:

imgA = cv2.imread("C:\\Users\\Dzaky Ligarwaly-R\\Documents\\pattern recognition\\Biomedical_Image.jpg")
imgB = cv2.imread("C:\\Users\\Dzaky Ligarwaly-R\\Documents\\pattern recognition\\pano.jpg")

Here are my codes with the resize:

scale_percent = 60 # percentage of original size
# imgA
width = int(imgA.shape[1] * scale_percent / 100)
height = int(imgA.shape[0] * scale_percent / 100)
dimA = (width, height)
# imgB
width = int(imgB.shape[1] * scale_percent / 100)
height = int(imgB.shape[0] * scale_percent / 100)
dimB = (width, height)

Upvotes: 1

Views: 670

Answers (1)

daxter roads
daxter roads

Reputation: 26

I think the problem is that you have the wrong path. Maybe try to look out for your file path or name as this is a recurring mistake when trying to load an image.

Upvotes: 1

Related Questions