Increase exposure of an image by a certain number of stops (EV)

33 views (last 30 days)
gbos
gbos on 9 Jan 2020
Commented: DGM on 22 Mar 2022
Hello,
I need to post-process some images with MatLab and I'd like to be able to increase the exposure of the image. I know I can just add some constant value to the matrix representing the image, but I need to know how many stops I'm increasing this brightness, like in Lightroom or Photoshop. Any help?

Accepted Answer

gbos
gbos on 15 Jan 2020
Well I solved the problem, the answer was pretty straightforward actually: obviosuly if you want to over expose by 1 stop (EV) the amount of light that will be recorded on a picture will be double. So to do this in MatLab you just have to double every pixel value. If the stops are 2, you have to quadruple the values, if it's just half a stop, then you have to multiply by 1.5 (50% more light in). Obviously pixels with a value will keep a value of and they'll be the clipped pixels.
This process doesn't take into account the camera response function but it's ok since the RAW file should have a linear response anyway.

More Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 9 Jan 2020
Edited: KALYAN ACHARJYA on 9 Jan 2020
Still I feel the question is quite subjective, One way: the issue is how to get the contrast of an image? If done, you may look for imadjust function also with repeated iteration (loop).
Second way: As you mentioned about contrast enhancemnet, I suggest to go for repeated histogram equalization and see the dynamaic ranges. During the loop iterration, when you achieve disired dynamic range (contrast), you may consider a break statement.
  8 Comments
DGM
DGM on 22 Mar 2022
I would assume that a multiplicative correction would make sense.
As far as I know, the common method of using adjustment layers in Photoshop with the "Exposure" adjustment is just a simple three-term calculation - an "exposure" term, an "offset" term, and a "gamma term.
inpict = imread('peppers.png');
k = 1.1; % scaling factor (null is 1)
os = 0.1; % output offset (null is 0)
g = 1; % gamma (null is 1)
outpict = os + (im2double(inpict)*k).^g;
imshow(outpict)
Of course, there are more complicated ways of doing it with masking, etc. I don't use Photoshop, so I'm in no position to experimentally verify that this is the exact math. It makes sense though.
Legacy GIMP (pre-2.9) doesn't have anything that claims to be "exposure" adjustment (at least not the base tools). There is a basic brightness & contrast adjustment tool, a levels adjustment tool, and a curves adjustment tool. I explain how the GIMP brightness/contrast tool works here:
The levels and curves tools are just simple multipoint intensity interpolation. Think of the "levels" method as a simplified three-point case of "curves". The same can be done with interp1().
Consider also imadjust() and its 5-term calculation. I just look at these various methods as different ways to define a curve that maps the input values to the output values. Sometimes it's more convenient to think about the process in terms of the locations of the endpoints of a line (as in imadjust()). Sometimes it's more convenient to think about it in terms of slope (as in the PS "exposure" term).

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!