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('GRA
CIE数字色彩原理颜色恒常性的算法实现(matlab)
最新推荐文章于 2024-06-11 23:12:38 发布