'imread return None even though the image exists in the given path

images = glob.glob('../catkin_ws/src/project1/images/*.jpg')
print(images)

When I print the variable images I get all the image file like this in an array.

['../catkin_ws/src/project1/images/img1.jpg', '../catkin_ws/src/project1/images/img2.jpg', '../catkin_ws/src/project1/images/img3.jpg']

But when I try to load the images using cv2.imread it returns None.

for fname in images:
    img = cv2.imread(fname) 
    print(img) #gets None


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source