필터 지우기
필터 지우기

Assign specific colors to labelmatrix objects

조회 수: 4 (최근 30일)
Veena Chatti
Veena Chatti 2020년 10월 6일
Hi,
Does anyone know how to use imshow() with a custom colormap linking labeled objects to RGB colors?
I have a series of images with 200-250 objects. I extracted a colormap from one image assigned to the labeled objects, and now want to apply the same color to each labeled object in the series of images.
Here's how I extracted the RGB colors and linked them to the labelmatrix:
colors = NaN(257,4);
for i = 1:max(LL(:)) % LL is my labelmatrix
[r,c] = find(LL==i,1)
colors(i,1) = i;
colors(i,2) = RGB(r,c,1) % RGB contains the colors generated by 'turbo' and 'shuffle'
colors(i,3) = RGB(r,c,2)
colors(i,4) = RGB(r,c,3)
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by