Merging different color channels
4 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Bjorn Gustavsson
on 17 Aug 2021
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 Comments
Bjorn Gustavsson
on 17 Aug 2021
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.
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!