How to selectively apply colors using label2rgb to a watershed segmentation
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi everyone,
I have a question regarding watershed and using bwlabel. From what it shows at the example (Please check the link below), it seems that for visualization, the label2rgb is used in a shuffle configuration.
The question I have is, if anyone has had a situation where they have had to apply color for a range of bins pixel values. Essentially, I'm trying to selectively apply colors to regions identified by the watershed segmentation (ranges with the same pixel intensity), as opposed to having them applied shuffled.
There is a nice tutorial at the examples and webinars at: http://www.mathworks.com/products/image/demos.html?file=/products/demos/shipping/images/ipexwatershed.html
Any help would be much appreciated and happy Festivus!
댓글 수: 1
Sean de Wolski
2011년 12월 23일
So what you want is to be able to select certain regions in the label image and give them the same color?
답변 (2개)
Image Analyst
2011년 12월 24일
You won't find regions that have the same pixel intensity in the original image by looking at the labeled image only. Just look how it assigns labels - upper left of the image, going down columns, working its way over to the lower right of the image. This scheme has nothing whatsoever to do with what the intensities in the original image were. It has only to do with the positions of the binary blobs in the binary image that got labeled. That said, you can call regionprops and figure out what binary blob has what original intensity and then, knowing that, you can create a custom colormap to apply to the labeled image instead of the default colormap. If you want to do that, then post your image somewhere (like tinypic.com) along with your code that makes the binary image, and what your scheme is for applying what colors to what intensities, and we'll see what we can do.
댓글 수: 0
Veena Chatti
2020년 10월 6일
I have a similar situation. I'm trying to use label2rgb to label the same specific objects tracked in multiple images with the same color.
How can I use imshow with a specific custom colormap linking labels to RGB colors? Here is my code linking the labels to the RGB values to create the colormap.
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 Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!