Merging different color channels

조회 수: 15 (최근 30일)
Mustapha Seidu
Mustapha Seidu 2021년 8월 17일
댓글: Bjorn Gustavsson 2021년 8월 17일
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?

답변 (1개)

Bjorn Gustavsson
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
Mustapha Seidu
Mustapha Seidu 2021년 8월 17일
Thank you very much @Bjorn Gustavsson.
I tried using cat(3,channel1,channel2,channe3) but it seems to be inacccurately merged since Value(V) from HSV ranges from 0 to 1 while the others range from 0 to 256.
After merging and viewing the individual channels from the merged image, the V happens to be totally dark unlike its original form before merging.
Bjorn Gustavsson
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 CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by