Turn from http://www.cnblogs.com/tiandsp/archive/2012/01/07/2316006.html thanks to DSP Tian
Clear
CLC
img = imread (' 124.jpg '); % Read image from graphics file
[m n T] = size (IMG); % Get pattern size
max = 0;
min = 256;
Avg = 0;
For I =1:1:m
for j = 1:1:n
If IMG (i,j) <min
Min = img (i,j);
End
If IMG (i,j) >max
Max = img (i,j);
End
AVG = AVG +double (img (i, j));
End
End
Avg = uint8 (avg/(m*n));
M
N
T
Max
Min
Avg
How to read and write image files in MATLAB and simple processing of images
The MATLAB image processing Toolbox supports four basic image types: Indexed images, grayscale images, binary images, and RGB images. MATLAB Direct Public image file read the image is an RGB image, it is stored in a three-dimensional array, the three-dimensional array has three faces, followed by Chonghong (Red), green (green), Blue (blue) Three colors, and the data in the polygon is the intensity of the three colors, The elements in the polygon correspond to the pixel points in the image. The resulting matrix is a three-dimensional matrix (256,256,3), A (:,:, 1) represents a 2-dimensional matrix of red color, A (:,:, 2) represents a 2-dimensional matrix of green color, A (:,:, 3) represents a 2-dimensional matrix of blue color.
Imread-Image Read instruction
Imshow-Image Display Instructions
RGB2IND-RGB format image into indexed format
IM2BW-indexed format changed to two-value image format
Ind2gray-index format changed to grayscale format
MATLAB Practice Program (to find the maximum gray level image, minimum gray, average gray)