how to convert a matrix given in range 5 to 1000 into matrix 0 to 255

1 回表示 (過去 30 日間)
studentambitious
studentambitious 2016 年 9 月 20 日
コメント済み: Walter Roberson 2016 年 9 月 21 日
I have a matrix whose values lies in range from 5 to 1000. I want to convert it into he range of 0 to 255. please mention how to revert back to same range of 5 to 1000. please help
  1 件のコメント
studentambitious
studentambitious 2016 年 9 月 21 日
please reply, can we convert it back to the same matrix range of 5 to 1000...

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

採用された回答

Walter Roberson
Walter Roberson 2016 年 9 月 20 日
round( (Matrix - 5) / (1000-5) * 255 )
  2 件のコメント
studentambitious
studentambitious 2016 年 9 月 21 日
Thanx for the answer it's perfectly ok ,but how can we convert this new matrix back into its original range of 5 to 1000
Walter Roberson
Walter Roberson 2016 年 9 月 21 日
Restored = double(Scaled_Matrix) * (1000-5)/255 + 5;
Note that you lose resolution when you do this: you will not be able to restore to exactly the same as the original.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by