im2double scales the RGB image from a 0-255 range into a 0-1 range, which is needed by the conversion equations.
Also, the image should be in double format, rather than uint8, so that precision is not lost during calculation. If the image was not double, the result would be rounded and would be less accurate.