Why do we transfer the image into double?

1 回表示 (過去 30 日間)
Muhamed Sewidan
Muhamed Sewidan 2020 年 4 月 5 日
コメント済み: Paul Hoffrichter 2020 年 12 月 4 日
I saw a lot of image processing examples and before conducting any analysis the image is transfered into double. Is it essential? and what is the benefit from doing so?

採用された回答

Image Analyst
Image Analyst 2020 年 4 月 5 日
No, it's usually not. But sometimes it is, like if you want to use conv2(). It has to do with how MATLAB likes to multiply variables of different classes.
  2 件のコメント
Muhamed Sewidan
Muhamed Sewidan 2020 年 4 月 5 日
Could you please give me some cases in which I should transfer the image into double before carrying out any processes?
Image Analyst
Image Analyst 2020 年 4 月 5 日
Other than conv2(), I can't think of any off the top of my head. But you obviously must have had some cases in mind because you're the one who brought up the question. Care to share those cases?

サインインしてコメントする。

その他の回答 (1 件)

Paul Hoffrichter
Paul Hoffrichter 2020 年 12 月 4 日
MATLAB when using mixed mode arithmetic, will try to save memory.
250 + 10 = 260, right?
>> x =double(250) + uint8(10);
>> x
x =
uint8
255
In other languages, like C/C++, the rule is to maximize precision. Avoid mixed mode arithmetic unless you need it. There is no error or warning provided, by default, in the above code.
  4 件のコメント
Muhamed Sewidan
Muhamed Sewidan 2020 年 12 月 4 日
thank you
Paul Hoffrichter
Paul Hoffrichter 2020 年 12 月 4 日
Glad to help.

サインインしてコメントする。

カテゴリ

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