how to generate customize color
조회 수: 1 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!