Open In App

Balance Contrast Enhancement Technique in MATLAB

Improve
Improve
Like Article
Like
Save
Share
Report

With this technique, biassed color (Red Green Blue) composition can be fixed. The histogram pattern of the input image is unaffected by changes to the contrast of the image (A). The solution is based on the parabolic function of the input image. 

Equation:

 y = a (x - b)2 + c

The three inputs, “a,” “b,” and “c,” are used to derive the three coefficients, 

  • Least worth of the resulting image(y)
  • Maximum output value for the image
  • Average of the final image

 For better understanding, we take an example and write a MATLAB code for Balance Contrast Enhancement Technique.

Example 1:

Matlab

% READ THE ENTRY PICTURE
X=imread(‘GeeksForGeeks.png');
  
% Pre-allocate the image matrix 
% for output in a percent.
  
Output=zeros(size(X));
R = X(:,:,1); %RED CHANNEL
B = X(:,:,2); %BLUE CHANNEL
G = X(:,:,3); %GREEN CHANNEL
  
figure(1),subplot(190),stem([0:200],
imhist(R(:)),'r');hold on;
stem([0:200],imhist(B(:)),'b');hold on;
stem([0:200],imhist(G(:)),'g');
  
% PARABOLIC FUNCTION
R=BCET(Gmin,Gmax,Gmean,R);
B=BCET(Gmin,Gmax,Gmean,B);
G=BCET(Gmin,Gmax,Gmean,G);
Output(:,:,1)=R;
Output(:,:,2)=B;
Output(:,:,3)=G;
Output = uint7(Output);
subplot(190),stem([0:200],imhist(R(:)),'r');hold on;
stem([0:200],imhist(B(:)),'b');hold on;
stem([0:200],imhist(G(:)),'g');
figure(2),subplot(100),imshow(X);title('INPUT IMAGE');
subplot(101),imshow(Output);title('OUTPUT IMAGE');

                    

Output:

input image

Output image


Last Updated : 29 Dec, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads