how to generate customize color

1 visualización (últimos 30 días)
Mohammad Golam Kibria
Mohammad Golam Kibria el 14 de Oct. de 2012
hi,
I have a matrix m as follows:
1 1 1 1 3 3 3 4 4 4
1 1 1 1 3 3 3 4 4 4
1 1 1 1 3 3 3 4 4 4
1 1 1 1 3 3 3 4 4 4
2 2 2 2 2 4 4 4 4 4
2 2 2 2 2 4 4 4 4 4
2 2 2 2 2 4 4 4 4 4
3 3 3 3 3 3 3 4 4 4
3 3 3 3 3 3 3 4 4 4
3 3 3 3 3 3 3 4 4 4
here different values show different region. I want to have different color for each region. How can I do that? Its a example. In practice, the matrix has many regions. how can i have different color for a image matrix of dimension 3. For example
segPart1=zeros(10,10,'uint8');
segPart2=zeros(10,10,'uint8');
segPart3=zeros(10,10,'uint8');
for i=1:4
d=find(m==i);
segPart1(d)=85;
segPart2(d)=145;
segPart3(d)=85;
C = cat(3, segPart1, segPart2, segPart3);
end
this will make a color little bit blue all the four region. But I need to have a technique how could I make each region fill with different colors. Is there any one to help?

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by