MATLAB Answers

Robert
0

How could I add colors to regions in a global map?

Asked by Robert
on 21 Oct 2018
Latest activity Answered by Image Analyst
on 21 Oct 2018
Hi,
Wondering if is an easy and quick way to add colors to regions in a global map (matrix)?
Like this...(attached figure).
I would like to make a "mask map" with different numbers for the regions (colors) (e.g. South Pacific = 1, North Pacific = 2, etc) and then extract from a global map (matrix) the values for South Pacific = 1, North Pacific =2, etc.
In this case, the global map is a matrix with ocean temperature data.

  1 Comment

If you can define polygons for the different regions, then yes. You can probably find free shapefiles online.

Sign in to comment.

1 Answer

Answer by Image Analyst
on 21 Oct 2018
 Accepted Answer

If you have an image where each region is separated by solid black lines, you can identify each region with bwlabel(), then use label2rgb() to make a colored image
labeledImage = bwlabel(binaryImage);
rgbImage = label2rgb(labeledImage, yourColorMap);

  0 Comments

Sign in to comment.