MATLAB Practice Program (to find the maximum gray level image, minimum gray, average gray)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.