clc
clear
close all
input_image=double(imread('str.jpg'));
figure(1);
imshow(uint8(input_image));
title('input image');
p=6;
R=input_image(:,:,1);
G=input_image(:,:,2);
B=input_image(:,:,3);
%maxRGB
white_R=max(R(:));
white_G=max(G(:));
white_B=max(B(:));
output_image=input_image;
output_image(:,:,1)=output_image(:,:,1)*white_G/white_R;
output_image(:,:,2)=output_image(:,:,2)*white_G/white_G;
output_image(:,:,3)=output_image(:,:,3)*white_G/white_B;
figure(2);
imshow(uint8(output_image));
title('maxRGB');
%GRAY WORLD
white_R1 = mean(R(:));
white_G1 = mean(G(:));
white_B1 = mean(B(:));
output_image1 = input_image;
output_image1(:,:,1) = output_image1(:,:,1)*white_G1/white_R1;
output_image1(:,:,2) = output_image1(:,:,2)*white_G1/white_G1;
output_image1(:,:,3) = output_image1(:,:,3)*white_G1/white_B1;
figure(3);
imshow(uint8(output_image1));
title('GRAY WORLD');
%SOG
white_R2 = (mean(R(:).^p))^(1/p)
white_G2 = (mean(G(:).^p))^(1/p)
white_B2 = (mean(B(:).^p))^(1/p)
output_image2 = input_image;
output_image2(:,:,1) = output_image2(:,:,1)*white_G2/white_R2;
output_image2(:,:,2) = output_image2(:,:,2)*white_G2/white_G2;
output_image2(:,:,3) = output_image2(:,:,3)*white_G2/white_B2;
figure(4);
imshow(uint8(output_image2));
title('SOG');clc
clear
close all
input_image=double(imread('