How to selectively apply colors using label2rgb to a watershed segmentation
4 次查看(过去 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 中查找有关 Modify Image Colors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!