How can I plot an image in matlab. This is giving me a Black png image!

98 ビュー (過去 30 日間)
Rafael Freire
Rafael Freire 2013 年 12 月 4 日
回答済み: barbara anderson 2020 年 4 月 15 日
URL ='http://structures.wishartlab.com/molecules/HMDB00126/image.png'
filename='test.png'
urlwrite(URL,filename)
[y,z]=imread(filename,'png');
figure, imshow(y);
colormap(z)
This is giving me a Black image! How can i Plot it without getting all black?
  2 件のコメント
sixwwwwww
sixwwwwww 2013 年 12 月 4 日
I am getting this image from your code. Is it correct?
Rafael Freire
Rafael Freire 2013 年 12 月 4 日
Yes its look like this but the correct one must be like this http://structures.wishartlab.com/molecules/HMDB00126/image.png

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

採用された回答

sixwwwwww
sixwwwwww 2013 年 12 月 5 日
編集済み: sixwwwwww 2013 年 12 月 5 日
you can do it as follows:
URL ='http://structures.wishartlab.com/molecules/HMDB00126/image.png'
filename = 'test.png'
urlwrite(URL,filename)
y = imread(filename, 'BackgroundColor', [1 1 1]);
figure, imshow(y);
The problem here was to replace transparent pixels with some specific color. If we don't choose any specific color then MATLAB gives it black color
  1 件のコメント
Tejas Waje
Tejas Waje 2017 年 1 月 10 日
If I have a background image and I need to use a foreground image with some part transparent , what should I do?

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

その他の回答 (1 件)

barbara anderson
barbara anderson 2020 年 4 月 15 日
Convert it into greyscale image and plot it.

Community Treasure Hunt

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

Start Hunting!

Translated by