Filter löschen
Filter löschen

イメージの行列の計算について

2 Ansichten (letzte 30 Tage)
朋貴 熊田
朋貴 熊田 am 30 Sep. 2021
Kommentiert: 朋貴 熊田 am 30 Sep. 2021
画像を読み込み、読み込んだ画像の行列の値を255で割りたいです。しかし、小数点以下が切り捨てられてしまいます。
小数点以下が欲しいです
img=imread('[co480,ro640]分割_N_MAP');
inshow(img)
divimg=img./255
この様に実行したのですが。うまく行きませんでした。
ご教授お願いいたします。

Akzeptierte Antwort

Akira Agata
Akira Agata am 30 Sep. 2021
小数点以下が切り捨てられてしまうのは、読み込んだ画像が uint8 型の配列としてワークスペースに取り込まれるためです。いったん double 型の配列に変換したうえで 255 で割る、ということもできますが、0~1 の範囲にスケーリングしたいということでしたら im2double 関数をお勧めします。
I1 = imread('[co480,ro640]分割_N_MAP.bmp');
I2 = im2double(I1);
  1 Kommentar
朋貴 熊田
朋貴 熊田 am 30 Sep. 2021
ご回答ありがとうございます。早速試して見ます。

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!