Increasing exposure of an image

33 visualizzazioni (ultimi 30 giorni)
Michelle
Michelle il 15 Nov 2020
Modificato: DGM il 22 Mar 2022
I have to increase the exposure of photo 2 so that it looks like it "whited out". How would I do this? The code I have below is on converting an image to grayscale.
The photos are also included in the zip file.
% Read the image 1
img1 = imread('photo1.jpg');
% Convert it to double
img1Double = im2double(img1);
% Convert from RGB to grayscale
img1Gray = rgb2gray(img1);
figure
imshowpair(img1, img1Gray, 'montage')
% Read the image 2
img2 = imread('photo2.jpg');
% Convert it to double
img2Double = im2double(img2);
% Convert from RGB to grayscale
img2Gray = rgb2gray(img2);
figure
imshowpair(img2, img2Gray, 'montage')

Risposte (2)

Subhadeep Koley
Subhadeep Koley il 15 Nov 2020
A simple approach could be adding a constant value to the entire image. Like below,
% Load the image
img = imread('photo1.jpg');
% Add a constant value to the image
overExposedImg = imadd(img, 100);
% Visualize them
figure
imshowpair(img, overExposedImg, 'montage')
  2 Commenti
Image Analyst
Image Analyst il 22 Mar 2022
That (addition) would produce a whiteout image, but a true overexposure like you'd get from increasing the exposure time on the camera would be closer to a multiplication by some factor. I think even that is not theoretically perfect because of a gamma that could be applied.
DGM
DGM il 22 Mar 2022
Modificato: DGM il 22 Mar 2022
If it's assumed that the gamma correction is a simple power function, then the cheap solution would be to just apply the gamma to the multiplication factor instead of eating the cost of fractional exponentiation of the entire array.
A = imread('peppers.png');
k = 1.5; % intensity scaling
g = 2.4; % assumed gamma
A = im2double(A);
B = A*(k^(1/g));
B = im2uint8(B);
imshow(B)
Otherwise I suppose you could do the whole thing.
A = imread('peppers.png');
k = 1.5;
A = im2double(A);
B = lin2rgb(rgb2lin(A)*k);
B = im2uint8(B);
imshow(B)

Accedi per commentare.


DGM
DGM il 22 Mar 2022

Categorie

Scopri di più su Convert Image Type in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by