Merging different color channels
조회 수: 9 (최근 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!