the rang of unit 8 is 0-255 But im2double convert the range to [0, 1] instead of [0, 255]. please anyone explain it????

9 Ansichten (letzte 30 Tage)
the rang of unit 8 is 0-255 But im2double convert the range to [0, 1] instead of [0, 255]. please anyone explain it????

Akzeptierte Antwort

Stephen23
Stephen23 am 26 Mai 2015
Bearbeitet: Stephen23 am 26 Mai 2015
This is the expected (although not clearly explained) behavior of im2double: the function scales any integer image values to the range [0,1], as well as converting to class double.
If you want to simply convert an integer to the equivalent double value, then use double instead.
It is important to note that many MATLAB image processing functions use the normalized range of [0,1], and it would likely make your own life much easier if you stick with using the standard range of values.

Weitere Antworten (1)

David Young
David Young am 26 Mai 2015
It's very helpful to have a standard range of values for images. The convention used in MATLAB toolbox functions is that images represented as double should have values in the range 0 to 1. Then it doesn't matter whether the original image was uint8, uint16 or some other type.
im2double makes it easy to adopt the convention for images read in from a variety of sources. If you want to retain the range 0 to 255 for your images, just use double instead of im2double. However, I recommend that you stick with the 0 to 1 convention - it will be simpler in the end.

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by