MATLAB Answers


is it im2double() have the same result with double()?

Asked by budi agung on 4 Apr 2017
Latest activity Answered by Jan
on 4 Apr 2017
i read a image name it 'lena'
is it im2double(lena) == double(lena)?

  1 Comment

Sign in to comment.

2 Answers

Answer by Jan
on 4 Apr 2017

While double() converts the type of the data only, im2double() cares for the values also:
img = uint8([255, 127])
double(img) % >> [255, 127] as double
im2double(img) % >> [1, 0.498] as double
The values are scaled to the range [0.0, 1.0] as wanted.


Sign in to comment.

Answer by Spencer Chen on 4 Apr 2017

Try it and tell us.


it give different result what should i choose best for image processing ?

Sign in to comment.