1 cl; 2 img=imread('15.bmp'); 3 %imshow(img); 4 [m n]=size(img); 5 max=0; 6 min=256; 7 avg=0; 8 for i=1:1:m 9 for j=1:1:n 10 if img(i,j)<min 11 min=img(i,j); 12 end 13 if img(i,j)>max 14 max=img(i,j); 15 end 16 avg=avg+double(img(i,j)); 17 end 18 end 19 20 %avg=mean(mean(img)); 21 avg=uint8(avg/(m*n)); 22 max 23 min 24 avg