For gray image, we use the commands like adapthisteq, imadjust... How to increase the intensity for the color image.

답변 (1개)

Image Analyst
Image Analyst 2012년 8월 22일

0 개 추천

Convert to hsv color space with rgb2hsv(). Then do those same things on the v channel, then transform back to rgb color space with hsv2rgb().

댓글 수: 6

Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2012년 8월 22일
I=imread('fog1.bmp'); v=rgb2hsv(I); b=adapthisteq(v); g=hsv2rgb(b); figure,imshow(g) when i run the code, i am getting an error as 3 D images. Does my procedure follows your reply or i gone to a wrong approach
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2012년 8월 22일
I have a doubt on your reply...can you explain me little bit brief about the line...do those same things on the v channel indicates... Exactly it indicates what?
Jürgen
Jürgen 2012년 8월 22일
Siva,
take a look at http://en.wikipedia.org/wiki/HSL_and_HSV HSV is a colorspace like rgb , you have three channel , insted of R, G and B, you have H, S and V, a possibility is also to transform to gray scale regardsJ
Your v is the full 3D image with all the h, s, and v channels. Do this:
hsvImage = rgb2hsv(rgbImage);
% Extract individual color channels.
hChannel = hsvImage(:, :, 1);
sChannel = hsvImage(:, :, 2);
vChannel = hsvImage(:, :, 3);
% Do stuff to the v channel.
% Then, after that recombine the new v channel
% with the old, original h and s channels.
hsvImage2 = cat(3, hChannel, sChannel, vChannel);
% Convert back to rgb.
rgbImage2 = hsv2rgb(hsvImage2);
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2012년 8월 22일
Thanks Image Analyst.. Now, I got your point..
DGM
DGM 2023년 7월 2일
편집: DGM 2024년 5월 28일
FWIW, the synopsis for adapthisteq() has had an example of doing this in LAB. That said, it's written around very old conventions, so it can be simplified in contemporary versions. For comparison:
% inputs
inpict = imread('peppers.png');
cl = 0.005;
% adjust V in HSV
hsvpict = rgb2hsv(inpict);
hsvpict(:,:,3) = adapthisteq(hsvpict(:,:,3),'cliplimit',cl); % adjust
op1 = im2uint8(hsv2rgb(hsvpict));
% adjust L in LAB
labpict = rgb2lab(inpict);
labpict(:,:,1) = adapthisteq(labpict(:,:,1)/100,'cliplimit',cl)*100; % adjust
op2 = im2uint8(lab2rgb(labpict));
% display as a montage
outpict = [inpict; op1; op2];
imshow(outpict,'border','tight')
... either way, it might not look so great.
For what it's worth, MIMT has a convenience tool for applying histeq() and adapthisteq() to color images. It's simple to use, preserves the numeric class, and does not require IPT.
% inputs
inpict = imread('peppers.png');
cl = 0.005;
% CLAHE in RGB
op1 = histeqtool(inpict,'ahisteqrgb','cliplimit',cl);
% CLAHE on L in LCHab
op2 = histeqtool(inpict,'ahisteqlchab','cliplimit',cl);
% display as a montage
outpict = [inpict; op1; op2];
imshow(outpict,'border','tight')
Note the differences between the LCHab result using histeqtool() and that achieved using the prior approach using rgb2lab() (e.g. the yellow pepper and other regions near primary/secondary corners of the RGB cube). By default, histeqtool() does chroma truncation prior to conversion back to RGB. That prevents out-of-gamut colors from having their L and H altered when they move back to the gamut boundary. Consequently, the histogram equalization of L is actually preserved, whereas in the IPT-only approach, the histogram equalization of L is not preseved.

댓글을 달려면 로그인하십시오.

질문:

2012년 8월 22일

편집:

DGM
2024년 5월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by