Mathematical Modelling (3)--Image processing

Source: Internet
Author: User
Initial image Processing Basic Graphing function
Name of function Notes
Plot Draw continuous waveforms
Stem Plotting discrete waveforms
Axis Defining the X, Y axis scale
Subplot Split graphics window
Hold Keep Current curve
Grid Draw grid Lines
Title Add a caption to a graphic
Xlable Axis label for x-axis
Ylable Axis Marking for y-axis
Text Add a text description to the diagram
Gtext Use the mouse to add text on the diagram to explain

The image type enables the relationship between the array value and the pixel color, which is different from the image format concept, there are five types of images in the MATLAB image Processing toolbox, where binary images and grayscale image binary images are briefly introduced.

In a binary image, each pixel will go to one of two discrete values (0 or 1), which, in essence, represents the state "on" or "off", respectively. Grayscale values Image

Grayscale images are usually described by an array of unit8, unit16, or mounted precision types, essentially a data matrix in which the data army represents a range of grayscale levels, each element corresponds to a pixel of the image, usually 0 for black, 1, 255, or 65. 535 (for different storage types) represents white. conversion between image types

I = Rgb2gray (RGB)

Rgb2gray is a function that converts a true color image to grayscale

BW = IM2BW (i,level)
bw = IM2BW (rgb,level)

Convert grayscale images and RGB images to two-value images by setting brightness thresholds
The output of the two-value image in the input image all brightness is less than the given value (the level value range is "0,1" pixels at 0, the other is 1), where the determination of level can be considered specified, you can also use the maximum class value difference method to automatically determine levels
That is: level = Graythresh (I)

I=mat2gray (X,[xmin,xmax])

The data matrix X is converted to grayscale image I by the specified zone to interval [Xmin,xmax], the xmin corresponds to a grayscale value of 0 (darkest is black), and the xmax corresponds to grayscale 1 (the brightest is white). If you do not specify a range, Matlab automatically sets the minimum value in the X matrix to xmin, and zooms in on the image that is roughly set to Xmax.

b = Imresize (a,m,method)
B = imresize (a,[mrows,mcols],method)
B = imresize (a,m,method,n)
B = Imresize (A , m,method,h)

A is an image, M is the magnification reduction multiplier, method is interpolation, the optional value is ' nearest (nearest neighbor interpolation) ' bilinear (bilinear interpolation) ' Bicubic (bicubic interpolation) ', the above Method 2 returns a Mrows row, mcols column of the image
When using the bilinear and Bicubic methods to reduce the image, the imresize uses a front-end smoothing filter to eliminate the introduced high-frequency component, the default 11*11, or the n designation
The fourth method is to use the user-designed interpolation core H interpolation, H can be seen as a two-dimensional FIR filter image rotation

B=imrotate (A,angle,method, ' crop ')

Cut the rotated image by specifying the crop parameter (take the middle part of the image), rotate the image angle angle, and return to the middle part of the same size

-Image Clipping

I2=imcrop (I)
Rgb2=imcrop (RGB1)

Interactively cropping grayscale and true-color images, displaying images, allowing you to specify a clipping rectangle with the mouse

I2=imcrop (I,rect)
Rgb2=imcrop (Rgb1,rect)

Non-interactive cropping, rect is a four element vector "Xmin,ymin,width,height", representing the upper-left coordinate of the matrix, width and length image analysis

Figure
Imcontour (I)% display contour of image
Imhist (i,n)  % display grayscale distribution in grayscale, n for specified gray level
Edge of grayscale Image: Edge function
BW = Edge (i,method)
bw = Edge (I,method,thresh)
bw = Edge (i,method,thresh,direction)
bw = Edge (I, ' log ', T HRESH,SIGMA)

The EDGD function returns the same binary as I size to the bw, where element 1 is the edge of Discovery I,
The method parameter list is:
' Sobel ' defaults, with the derivative's sobel approximation to detect edges, those gradient maximum points back to the edge
' Prewitt ' uses the derivative's Prewitt approximation to detect the edges, those gradients the maximum point back to the edge
' Roberts ' uses the derivative's Roberts approximation to detect the edges, those gradients the maximum point back to the edge
' Log ' uses the Laplace operation of the Gaussian filter to filter I, by looking for 0 intersection detection Edge
' Zerocross ' uses the specified filter to filter on I, looking for 0 intersection detection Edge
Specifies the sensitivity threshold with thresh, and all edges that are not stronger than this value are ignored
Specify direction direction for ' Sobel ' and ' Prewitt ': ' Horizontal (horizontal) ' Vertical (vertical) ' Both (default) '
Specify standard deviation image smoothing with Sigma
1. Adding noise to the image

J=imnoise (i, ' Gaussian ', m,v)
j=imnoise (i, ' salt&pepper ', D)
j=imnoise (i, ' speckle ', V)

Method 1: Add a Gaussian white noise with a mean of M and a V variance to the image, and the default value: 0,0.01
Method 2: Add a "tree salt" with a strength of D to black and white pixels in the image, default value: 0.05
Method 3: Using the formula J=i+n*i, add multiplicative noise to the image, where n is the mean value of 0 and the variance value is v evenly distributed random noise, default value: 0.04
2, two-dimensional median filter

B=MEDFILT2 (A,[m,n])

A two-dimensional median filter for matrix A is performed. Each output pixel contains the median of the m*n neighborhood of the corresponding pixel period in the input image. Adds 0 to the edge of the image, so the edges within the "m,n"/2 May distort, default: "3,3"

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.