フィルターのクリア

how to convert matrix to graysclae image?

1 回表示 (過去 30 日間)
jiji hr
jiji hr 2016 年 5 月 23 日
コメント済み: jiji hr 2016 年 5 月 25 日
Hi, I have a matrix that i have extacted using spin images descriptor, it is of size 15x15 :
I want to display it in gray scale but it doesn't work. I tried to use imshow() like this :
imshow(uint8(spinImages(1,1).spinIm),'DisplayRange',[0 255])
imshow(255-uint8(spinImages(1,1).spinIm),'DisplayRange',[0 255])
and also i used imagesc :
imagesc(255-uint8(spinImages(1,1).spinIm), [0 255])
imagesc(1-uint8(spinImages(1,1).spinIm), [0 255])
imagesc(uint8(spinImages(1,1).spinIm), [0 255])
but worthless. pleaz could you help me.
  6 件のコメント
Adam
Adam 2016 年 5 月 25 日
編集済み: Adam 2016 年 5 月 25 日
imagesc( spinImages(1,1).spinIm );
colormap( flipud(gray) );
will give you a white background and high values as black if that is what you want visually.
Obviously you can also inverse the data itself - it depends if you want the data inverted for other purposes than visualisation too.
jiji hr
jiji hr 2016 年 5 月 25 日
that is great it works for me. thak you so much.

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

採用された回答

Guillaume
Guillaume 2016 年 5 月 23 日
編集済み: Guillaume 2016 年 5 月 23 日
" but it doesn't work". In what way?
What you've showed will display the image, possibly not the way you want, but it will display it.
I'll note that the intensity range in your screenshot is up to 3906. Because of the call to uint8, any intensity above 255 will be set to 255. I'm not sure that's what you want.
There's certainly no reason to convert to uint8 if you're going to restrict the display range to [0 255] anyway.
Possibly, you meant:
imshow(spinImages(1,1).spinIm, [])
  3 件のコメント
Guillaume
Guillaume 2016 年 5 月 25 日
If you want to inverse the image:
imshow( max(spinImages(1, 1).spinIm(:)) - spinImages(1,1).spinIm, [])
would be better than the completely unnecessary conversion to uint8.
jiji hr
jiji hr 2016 年 5 月 25 日
Your answer works well too for me thank you fo help.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by