MATLAB: When to use Double data type for an image in matlab

imageimage processingMATLAB

I am trying to find out focus score of an image for which i need to get both the mean and variance. i m getting some Values for both these parameters if i convert the image into data type double. But the image, after changing its data to double, appears like a few spots on the screen, nothing else. I could be wrong in judging it as loss of information of the image. So Please guide me….. i hope this data type conversion has no effect on the information content of the image and using it wont effect my end result to find focus score of the image.

Best Answer

How do you convert to double:
  • im2double(img) ?
  • just double(img) ?
  • double(img) / max(img(:)) ?
  • something else ?
In any case, no, you're not losing information. The issue is with how you display it. Try:
imshow(img, []);