Thursday, 25 February 2021

CV2.imread() Python image not loading and no error displayed

In my python flask program hosted on Ubuntu using Apache2, the program I wrote usually is able to use imread to compress and process an image. The code now is not being able to access the image even though the file path are correct and it is an existing file and does not return any error message. This seems to occur with any type of image not depending on the type of file and the code sometimes returns a none type is not subscript able if that is related to this issue. Thanks for any help in advance! The code:

img = cv2.imread(file_path)
height, width, _ = img.shape
roi = img[0: height, 0: width]
_, compressedimage = cv2.imencode(".jpg", roi, [1, 90])
file_bytes = io.BytesIO(compressedimage)


from CV2.imread() Python image not loading and no error displayed

No comments:

Post a Comment