Merging different color channels
4 次查看(过去 30 天)
显示 更早的评论
Hi, is it possible to merge color channels from different color spaces to sort of form a new 3-dimensional image for the purpose of analysis?
For example, I am trying to extract channels L, G, and V from CIELAB, RGB, and HSV respectively and merge them before proceeding to perform further manipulations to the image. Is that possible? If not, what is the closest I can get to that?
0 个评论
回答(1 个)
Bjorn Gustavsson
2021-8-17
Sure, they are after all nothing but 2-D arrays representing different aspects of an image. Just combine them any which way you see fit. Make sure that you have the different channels in compatible types such that you don't lose precision (convert to double etc).
2 个评论
Bjorn Gustavsson
2021-8-17
That's the problem I hinted at with my caution about "compatible types" - it seems like your HSV-image are in double format normalized to the 0 - 1 range while the others are uint8 in the range 0 - 255. Simply cast the L and G channels to doubles and scale them to 0 - 1:
L = double(L);
L = (L - min(L(:)))/(max(L(:))-min(L(:)));
% or simpler:
L = normalize(L,'range'); % I'm too old to remember this function
Then you can do the same for G, typically also check the data-type using whos and the range of the intensities using max and min.
另请参阅
类别
在 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!