how to enhance a color image ?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
For gray image, we use the commands like adapthisteq, imadjust... How to increase the intensity for the color image.
0 Kommentare
Antworten (1)
Image Analyst
am 22 Aug. 2012
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 Kommentare
DGM
am 2 Jul. 2023
Bearbeitet: DGM
am 28 Mai 2024
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.
Siehe auch
Kategorien
Mehr zu Image Filtering and Enhancement finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!