How to do standardization for the brightness and contrast of the image?

2 次查看(过去 30 天)
% Image Loading
a= imread('D01-1.jpg')
figure
imshow(a)
%Area definition
user_defined_ellipse = imellipse(gca, [10 10 275 275]);
wait(user_defined_ellipse);
MASK = double(user_defined_ellipse.createMask());
%mask
mask = uint8(MASK);
I = a.*mask;
figure
imshow(I)
title('comparison')
% Binary Image
Inew=im2double(I);
maxValue=max(Inew(:));
Inew(Inew == 0) = inf;
minValue = min(Inew(:));
Ibefore=im2double(I);
INew= imadjust(Ibefore, [minValue maxValue], [0 1]);
figure
imshow(INew)
title('adjusted')
INew2=im2uint8(INew)
figure
imshow(INew2)
title('adjusted2')
%Calculation
Bw1=I>0;
figure
imshow(Bw1)
title('Bond Area')
thresholdvalue=150;
Bw2=I>thresholdvalue;
figure
imshow(Bw2)
title('Intensity of IMC')
Bondarea = length(find(Bw1 == 1));
IMCArea = length(find(Bw2 == 1));
areaRatio = IMCArea/Bondarea*100;
fprintf('The area ratio is %0.2f%%\n', areaRatio) % %
As u can see here, i am using imadjust to adjust all my image from[min max] to [0 1] Then i use colour thresholding by selecting the value as 140 . Unfortunaly it does not work. Any way to adjust all the image to same contrast and brightness?

回答(0 个)

产品

Community Treasure Hunt

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

Start Hunting!

Translated by