Increasing exposure of an image

조회 수: 92 (최근 30일)
Michelle
Michelle 2020년 11월 15일
편집: DGM 2022년 3월 22일
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')

답변 (2개)

Subhadeep Koley
Subhadeep Koley 2020년 11월 15일
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
Image Analyst
Image Analyst 2022년 3월 22일
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 2022년 3월 22일
편집: DGM 2022년 3월 22일
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)

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


DGM
DGM 2022년 3월 22일

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by