GammaCorrection/ White balance

조회 수: 7 (최근 30일)
azarm
azarm 2012년 4월 16일
답변: DGM 2023년 10월 2일
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

답변 (3개)

Image Analyst
Image Analyst 2012년 4월 16일
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
Image Analyst
Image Analyst 2017년 5월 25일
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 2017년 5월 25일
Dear Image Analyst ! thank you for taking the time to answer me.
here is my question.

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


Mahmoud Afifi
Mahmoud Afifi 2019년 8월 12일

DGM
DGM 2023년 10월 2일
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().

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by