--- Slowly go through the dip and the MATLAB, and write down some fragmented knowledge points for yourself to review later.
Dip ch03 brightness transformation and Spatial Filtering
Matrix A = [1, 2, 3; 4, 5, 6]
Sum (A, 1) sums the first dimension of A, sum (A, 2) sums the second dimension of;
Prod (A, n), max (A, n), min (A, n), mean (A, n) are similar, respectively for the product of the nth dimension of, maximum value, minimum value, and average value;
The default value is n = 1. Therefore, to sum all elements of matrix A, sum (a) is equivalent to sum (A, 1), 2 ), of course, you can also directly sum ((:));
[Val, idx] = max (A (:)) returns the maximum value and position of a, similar to min;
STD (a) is used to calculate the standard deviation. STD (A, flag, dim) is equivalent to the N mentioned in the front. The default flag is 0. When the standard deviation is calculated, mean Squared removal with N-1 (n is the number of samples), flag = 1, mean squared removal with N;
Brightness Conversion
G = imadjust (F, [low_in, high_in], [low_out, high_out], gamma) --- gamma is 1 by default, indicating linear ing. Note that the input and output are between 0 and 1, high_out can be smaller than low_out, indicating brightness inversion;
G = imcomplement (f) --- brightness inversion;
Histogram
H = imhist (f) --- histogram display, and other display settings;
G = histeq (F, 256) --- histogram equalization. The second parameter is the maximum number of possible gray level values. The default value is 64. We usually set this parameter to 256 (8-bit ), G is the image after histogram equalization. Use imhist (g) to view the effect;
--- Numel (f) is the total number of f elements (F indicates the total number of pixels in the image );
--- Hnorm = imhist (f)./numel (f) to obtain the normalized histogram (occurrence frequency of each brightness) and vector;
--- CDF = cumsum (hnorm), cumsum () accumulates the elements of vector implementation, that is, CDF (n) = sum (hnorm (1: n )), in this way, the brightness conversion function can be obtained;
G = histeq (F, hspec) --- histogram normalization/Histogram Matching, where heat map is the specified histogram and row vector;
Linear Spatial Filtering
W = fspecial ('type', paras) --- build a mask. Common types include average, Gaussian, Laplacian, Prewitt, and soble, while paras is the set parameter, you can set the mask size and distribution parameters;
G = imfilter (F, W, '**') --- filter image f using mask W. ** it is a boundary processing method. Common methods include replicate, duplicate Ric, the default value is 0;
Nonlinear Spatial Filtering
G = medfilt2 (f) --- median filter;
[Dip] Digital Image Processing ch03