Loaded Image Doesn't Retain Separate Colors

6 次查看(过去 30 天)
I have an image of a map loaded in MATLAB.
BEFORE the map is loaded into MATLAB the appearance is:
US Continent: Green
Ocean: Blue
Canada: Yellow
AFTER I load the map it is displaying:
Canada and the US as one color BUT I need to separate them by colors.
My code is:
im = double(imread('US.png'))
figure;
colormap summer;
...
Thanks,
Amanda

采纳的回答

Walter Roberson
Walter Roberson 2012-8-30
Try
fig = figure;
ax = axes('Parent', fig);
[im, cmap] = imread('US.png');
if isempty(cmap)
im = im2double(im);
cmap = summer;
end
image(im, 'Parent', ax);
colormap(cmap);
  3 个评论
Amanda
Amanda 2012-8-30
编辑:Amanda 2012-8-30
Walter -- I really appreciate it. Only a few people are plotting and imaging experts.
Image Analyst
Image Analyst 2012-8-31
You're right, though it is the most used toolbox, according to the list at the left.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Modify Image Colors 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by