フィルターのクリア

Hi, how can i scale the image data to 0 and 1

6 ビュー (過去 30 日間)
Hafeez
Hafeez 2017 年 3 月 28 日
編集済み: Stephen23 2017 年 3 月 29 日
i am working on greyscale images, i have to scale the data between 0 and 1, and but dividing the image data on 255 gives only 0 or 1, how can i get the actual vale after division.

採用された回答

Jan
Jan 2017 年 3 月 29 日
編集済み: Stephen23 2017 年 3 月 29 日
If you divide an uint8, you get an uint8. Therefore either convert the matrix to double at first:
gray_d = double(gray) / 255;
But for productive work and if you have the image processing toolbox, use Thorsten's suggestion. im2double checks the type of the input and considers, if the input is a uint16 or double already.

その他の回答 (1 件)

Thorsten
Thorsten 2017 年 3 月 29 日
  1 件のコメント
Jan
Jan 2017 年 3 月 29 日
+1. This is the best solution.

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

カテゴリ

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