Reputation: 1108
The source description
Load an image converting from grayscale or alpha as needed.
Parameters
----------
filename : string
color : boolean
flag for color format. True (default) loads as RGB while False
loads as intensity (if image is already grayscale).
Returns
-------
image : an image with type np.float32 in range [0, 1]
of size (H x W x 3) in RGB or
of size (H x W x 1) in grayscale.
And this is an example of how to use it
input_image = 255 * caffe.io.load_image(IMAGE_FILE)
My question is if the IMAGE_FILE is RGB color with each channel 0-255 values and the return value caffe.io.load_image(IMAGE_FILE)
is in range [0,1], multiplying 255, the range of each channel is still 0-255.
So what's the point to do this step?
Upvotes: 2
Views: 414
Reputation: 114796
The reasons for reading an image to float type in range [0..1] are:
uint
to floating point (see, e.g., Matlab's im2double
, im2single
). Upvotes: 1