Open In App

Balance Contrast Enhancement Technique in MATLAB

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:



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

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



Example 1:

% 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

Article Tags :