Effacer les filtres
Effacer les filtres

Increasing exposure of an image

60 vues (au cours des 30 derniers jours)
Michelle
Michelle le 15 Nov 2020
Modifié(e) : DGM le 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')

Réponses (2)

Subhadeep Koley
Subhadeep Koley le 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 commentaires
Image Analyst
Image Analyst le 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 le 22 Mar 2022
Modifié(e) : DGM le 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)

Connectez-vous pour commenter.


DGM
DGM le 22 Mar 2022

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by