How do I reduce image brightness and increase image contrast?
Show older comments
I have images with small ROI that are overexposed. Is there any way I can run this image editing as part of the code?
Answers (1)
Sajad Sadeghkhani
on 5 Aug 2016
Edited: Sajad Sadeghkhani
on 5 Aug 2016
You should map it with a transform.
I2 = histeq(I);
imshow(I2) %contrast enhancing
to reduce brightness:
I=double(I);
a=min(min(I));
b=max(max(I));
t=150;
[m1,m2]=size(I);
I2=zeros(m1,m2);
for i=1:m1
for j=1:m2
I2(i,j)=(t/(b-a))*(I(i,j)-a);
end
end
I2=uint8(I2);
imshow(I2);
as you decrease 't', the output image will become darker.
1 Comment
Vishal Rajput
on 9 Mar 2020
Can you please tell us the name of this transform.
Categories
Find more on Image Filtering and Enhancement in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!