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 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modify Image Colors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!