Previously, when we used MATLAB for image processing, we used the functions to check the functions. We never summarized them systematically, but we had to check them again. Therefore, it is necessary to summarize them ~
For convenience, only the function names and basic usage are listed here. Unless otherwise specified, the parameters are not described in detail.
HelpAnd
DocStrive for continuous updates ~ ****** ******************************* Image reading
Requirement |
Function |
Description |
Read images from a specific path |
F =Imread(Filename) |
By default, the current search path includes the current path. Files Not in the search path must be specified.
|
Open dialog box select image file and read |
[Filename, pathname, filterindex] =Uigetfile({'*. JPG ;*. TIF ;*. PNG ;*. GIF ', 'all image files ';'*. * ', 'all files'}, 'dialogtitle ','. \ '); F =Imread([Pathname, filename]); or F =Imread(Fullfile(Pathname, filename )); |
See the documentation on the left. Note that you can splice the path and file name and determine whether a file is selected, for example, if isequal (filename, 0) |
View image information
Requirement |
Function |
Description |
Image Size |
Ans =Size(F) |
Ans as vector |
Image Size, size, and Data Type |
WhosF |
None |
Show more information |
Iminfo('Bird.jpg ') |
None |
Image Display
Requirement |
Function |
Description |
Most common image display |
Display image:Imshow(F) G: imshow (f, g) Specify the gray level range: imshow (F, [low, high]) Automatic Adjustment: imshow (F, []) |
Imshow (F, []) compresses the double type to [0, 1 ], |
Histogram |
Imhist (F, bins) |
None |
Figure display |
Figure,Subplot(M, n, p), imshow (f) |
M * n blocks, position P |
Color Map |
Colormap |
For more information, see help. |
Color Bar |
Colorbar |
For more information, see help. |
Other displays (not commonly used) |
Imscr Image |
For more information, see help. |
Image Storage
Save the image as a file |
Imwrite(F, 'filename ') Imwrite (F, 'filename', 'ext ') Imwrite (F, 'filename', 'qc ', q) |
Q indicates the image quality, from 0 to 100. The smaller the Q, the larger the compression degree. |
Save figure as an image |
Saveas(Figure_handle, filename, fileformat) Print(Figure_handle, filename, fileformat) |
Fileformat is the storage format |
Common functions
Normalization, etc. |
G =Mat2gray(F) G =Im2uint8(Mat2gray(F )) |
Mat2gray maps F to the [0, 1], double type |
Reshape |
G =Reshape(F, m, n) |
The number of elements in the matrix is not changed, and the size is changed with column priority. |
Generate coordinates |
[C, R] =Meshgrid(C, R) |
Generate a matrix coordinate Array |
Copy and splice a Matrix |
B =Repmat(A, sz1, sz2,... szn) |
None |
Apply function to each cell in CELL ARRAY |
[A1,..., am] =Cellfun(Func, C1,..., CN, name, value) |
My favorite !! See Doc |
Generate random number |
Random Number Generation ControlRNG Uniform Distribution r =Rand(Size) Even distribution (integer) r =Randi(100,1, 5) Normal Distribution r =Randn(Size) Random NumberRandom |
See Doc |
Functions to complete specific image processing tasks ;......
Common basic functions of MATLAB Image Processing