Convert image file to float array in Python
You can convert the list of the integers to list of floats as [float(i) for i in values] with list comprehension.
An other option is to convert the img variable as numpy.ndarray to an other numpy.ndarray which contains float values:
img = img.astype(float)
After this assignment the results will contain float values.
How can I convert an image to an array of float numbers?
img = cv2.imread('img.png')
and now convert img to float so I get for
print(img[0,0]) something like "[ 4.0 2.0 0.0] instead of [4 2 0]
Do you have an idea? Thank you very much!