MATLAB 求图像的极大值极小值,平均值

I=imread('c:/lena.jpg');
imshow(I);
[m n]=size(I);
min=256;
max=0;

avg=0;
for i=1:m
    for j=1:n
        if I(i,j)<min
            min=I(i,j);
        end
        if I(i,j)>max
            max=I(i,j);
        end
        avg=avg+double(I(i,j));
    end
end
mean(mean(I))
avg=avg/(m*n)

你可能感兴趣的:(MATLAB 求图像的极大值极小值,平均值)