different color for different region of image

Hi I have an image, I wonder how to assign different color for different region in the image? For example how can I choose one colormap for blue rectangle and one colormap for green rectangle and the rest of figure uses different colormap.

 Risposta accettata

Image Analyst
Image Analyst il 31 Ago 2014
That's precisely what my demo does. It's attached below the image. I have a freehand region version (also attached) if you're interested.

4 Commenti

So these demos will take care of the rectangular part what about the remaining part how to make it different customized color, for example I was thinking of starting with whatever colormap I like then change only the colormap of these rectangular parts. But I do not know is there any better method
Look at the code:
% Make them color images.
% Use the jet colormap
rgbCroppedImage =uint8(255 * ind2rgb(croppedImage, jet));
I used jet, but you are free to use your own custom colormap.
chess
chess il 1 Set 2014
Modificato: chess il 1 Set 2014
Another problem I have is when I do it for one part using imfreehand how can I hold an image to do it for another region because if I redo the script again it will overwrite the previous one?
Well don't run that part of the script again - the part that reads in the original image. Just run the part that asks for the region and colorizes it. Put it in a for or while loop if you want.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by