0
votes

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;
...
1
Does removing colormap summer not fix this?mathematician1975
Nope. On a gray scale it makes Canada and US white.Minimalist
Did you check the actual values of im once loaded? Do these correspond to the three (pure) color values you see before loading (red, green, blue)? Do they give 3 distinct values after rgb2gray? If yes, then maybe your problem is with scaling the displayed image.gevang

1 Answers

0
votes

As a rough guess, I'm assuming you are not properly scaling your intensity (color) values, i.e. not in [0, 1], so any value above 1 is mapped by the colormap (any color or grayscale) to the same value.

As long as length(unique(im))==3 (three distinct indices for the three gray-scale values that you see before loading), then both of the following should scale your visual output:

imshow(im, []); colormap summer;
imshow(im./max(im(:))); colormap summer;