[Dip] Digital Image Processing ch03

Source: Internet
Author: User

--- 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

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.