I have made some changes, that can be useful for people working on image processing.
image.load_img()
Gave me TypeError for loading bytes image, corrected the function to read an image from the path and BytesIO object.
image.array_to_img()
Used to fail on grayscale images because their ndim was less than 3, now added an optional flag is_grayscale to add single channel to grayscale image array with ndim = 2
image.img_to_array()
Replaced np.asarray() with np.array(), can be useful with cv2 functions, earlier np.asarray processed images gave different output when used with cv2 functions because array used to be modified. Now a copy of array is processed for use with cv2
Related Issues
PR Overview
[x] This PR requires new unit tests [y/n] (make sure tests are included)
[x] This PR requires to update the documentation [y/n] (make sure the docs are up-to-date)
[x] This PR is backwards compatible [y/n]
[x] This PR changes the current API [y/n] (all API changes need to be approved by fchollet)
Summary
I have made some changes, that can be useful for people working on image processing.
image.load_img() Gave me TypeError for loading bytes image, corrected the function to read an image from the path and BytesIO object.
image.array_to_img() Used to fail on grayscale images because their ndim was less than 3, now added an optional flag is_grayscale to add single channel to grayscale image array with ndim = 2
image.img_to_array() Replaced np.asarray() with np.array(), can be useful with cv2 functions, earlier np.asarray processed images gave different output when used with cv2 functions because array used to be modified. Now a copy of array is processed for use with cv2
Related Issues
PR Overview