GammaCorrection/ White balance

8 Ansichten (letzte 30 Tage)
azarm
azarm am 16 Apr. 2012
Beantwortet: DGM am 2 Okt. 2023
hey everybody,
i have an RGB image, which needs a white balance. As i make it linear, overexposure happens (especially in the sky area)! anybody knows how can i make a logarithmic correction considering the gamma?! tnx in advance,
cheers, Azarm

Antworten (3)

Image Analyst
Image Analyst am 16 Apr. 2012
Use the "Curves" tool in Photoshop. Or, I really like the highlights and shadows tool.
Or, you can do trial and error by multiplying your image by the gamma function ( http://en.wikipedia.org/wiki/Gamma_correction). Be sure to adjust the amplitude to take into account that the different channels have different values for the white region. For example what you want to be white is (230, 200, 170) and so the gamma function will need to be different if you want to end up with white at (245,245,245) or whatever. I wouldn't go all the way to 255 because otherwise there may be some pixels that get saturated.
Or you can do it the best, but most difficult, way and that is to take a picture of a Color Checker chart ( http://en.wikipedia.org/wiki/ColorChecker) and derive the transform to map your input color image into the desired color image. The math is too involved to post here, but I've done it in MATLAB.
  3 Kommentare
Image Analyst
Image Analyst am 25 Mai 2017
Start a new question, and try to explain it better. It makes little sense to make it such that all the gray chips will have the same RGB value. In that case, the entire image will have the same RGB value, and what good is that?
zouhair jimmouh
zouhair jimmouh am 25 Mai 2017
Dear Image Analyst ! thank you for taking the time to answer me.
here is my question.

Melden Sie sich an, um zu kommentieren.


Mahmoud Afifi
Mahmoud Afifi am 12 Aug. 2019

DGM
DGM am 2 Okt. 2023
Considering that we're talking about the Photoshop curves tool, imadjust() does simple power-law gamma adjustment without the need for reinventing wheels or dealing with class-dependent data scale.
% perhaps this is a bit excessive for sake of emphasis,
% the white page background is unhelpful
inpict = imread('tire.tif'); % since we're talking about wheels
outpict = imadjust(inpict,[0 1],[0 1],0.5);
% compare the two images
combined = [inpict outpict];
imshow(combined,'border','tight')
Of course, the PS curves tool can do more than just a simple power-law gamma curve. MIMT imlnc() offers some more options to shape the curve. We can bend the curve back toward linear at the top end to try to retain some highlight contrast.
outpict = imlnc(inpict,'in',[0 1],'g',0.6,'k',0.8);
For an arbitrary curve, you'd use imcurves() (or interp1() and a bunch of ancillary stuff).
% a similar curve
x = [0 0.065 0.15 0.40 0.80 1];
y = [0 0.23 0.35 0.55 0.85 1];
outpict = imcurves(inpict,x,y); % spline interpolation by default
For an interactive adjustment, MIMT immodify() provides a graphical front-end for imlnc().

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by