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

8 次查看(过去 30 天)
the rang of unit 8 is 0-255 But im2double convert the range to [0, 1] instead of [0, 255]. please anyone explain it????

采纳的回答

Stephen23
Stephen23 2015-5-26
编辑:Stephen23 2015-5-26
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.

更多回答(1 个)

David Young
David Young 2015-5-26
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.

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by