matlab练习程序(白平衡<灰度世界算法>)

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);

参考:

http://www.ilovematlab.cn/thread-109633-1-1.html

posted @ 2012-04-29 16:06  Dsp Tian  阅读(2637)  评论(0编辑  收藏  举报