Here's an easy way, assuming that your start image is indeed a binary image (i.e a 2D matrix with values 0 or 1):
map = [0 0 1; ...
0 1 0];
colouredimage = map(binaryimage + 1 + cat(3, 0, 2, 4));
imshow(colouredimage);
edit: Actually an even easier way, and certainly easier to understand, is with
map = [0 0 1; ...
0 1 0];
colouredimage = label2rgb(binaryimage + 1, map);
assuming you have the image processing toolbox.
0 Comments
Sign in to comment.