clear all; close all; clc; img=imread('Lena_cai.jpg'); imshow(img); mean1=mean(mean(img(:,:,1))); mean2=mean(mean(img(:,:,2))); mean3=mean(mean(img(:,:,3))); me=mean(mean(mean(img))); img(:,:,1)=me/mean1*img(:,:,1); img(:,:,2)=me/mean2*img(:,:,2); img(:,:,3)=me/mean3*img(:,:,3); figure,imshow(img);
参考: