フィルターのクリア

Imshow

2 ビュー (過去 30 日間)
John
John 2012 年 1 月 31 日
Hi,
I need to plot a set of png images using imagesc as a method of stitching them together.
I am curious about the colormap command.
Why does this set of commands:
[I,map] = imread('test.png','png');
imshow(I,map)
Not produce the same as:
[I,map] = imread('test.png','png');
imshow(I)
colormap(map)
This is really baffling me, as I would like to load the png image using imagesc, which doesn't ask for a colormap argument when you load the image, meaning that I have to set the colormap each time, which isn't correct at all.
Thank you in advance.

回答 (1 件)

Image Analyst
Image Analyst 2012 年 1 月 31 日
If it is an gray scale image and has a colormap stored in the file with it (making it an "indexed" image) then in one case you're using the map to pseudocolor it as intended by the person who saved the image, and in the second case you're using no color map so it shoudl show up as gray. imagesc() applied some weird colormap by default, even though you don't explicitly give one in its argument list - probably not what you want. You probably want either no colormap or the one it was stored with. So overall it seems like your best option is to use imshow with a colormap.
  4 件のコメント
Image Analyst
Image Analyst 2012 年 1 月 31 日
You can just do [a;b] or [a,b] to stitch together two arrays. Of course the dimensions along the seam have to match.
John
John 2012 年 3 月 9 日
Sorry I didn't see this until now, knowing this (which actually seems pretty obvious now you've pointed it out!) will help me tremendously in speeding up my program. Much appreciated.

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

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by