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 Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by