Machine vision Algorithms and applications reading notes (algorithms)

Source: Internet
Author: User

1. Data structure 2. Image Enhancement 1. Grayscale Value Transformation 2. Radiation Calibration 3. Image Smoothing 1. Time domain Denoising Method 2. Spatial domain Denoising method
  1. Mean-value Filter
    Recursive linear filter: Bring the last computed value into the next value
    Cons: Noise is not completely eliminated
  2. Gaussian filter
    Gaussian filter

    4. Fourier transform

    Shift the function h (x) from the spatial domain to the frequency domain
    is a reversible transformation

    3. Geometric transformations 1. Affine transformations

    Transformation between two-dimensional to two-dimensional
    Correction of the size of the object in the image (translation and rotation angle correction)
    Typically there is a 2x2 linear part and a translation part

    2. Projection transformation

    Transformation between high-dimensional to two-dimensional
    Affine transformations (special projection transformations)
    Requires eight parameters (4 points)

    3. Image Transformation 1. Nearest interpolation:

    The x of the converted coordinates is located between the center stores of four pixels, which is a non-integer position, rounding the non-integer position to find the nearest one in the center of the four pixels adjacent to this coordinate, and then treats the grayscale value of the pixel at the nearest point in the input image as the grayscale value of the corresponding pixel in the output image.
    Easy to cause jagged appearance

    2. bilinear interpolation:

    First, the vertical and horizontal distances of the converted coordinates to the center point of the four neighboring pixels are computed respectively, and the results of bilinear interpolation are obtained by calculating the weights of different gray values based on the distance value (0-1).

    4. Polar Coordinate transformation:

    It is often used to correct a circular object in an image or an object that is contained in a ring.

    4. Image segmentation: 1. Threshold segmentation

    A good threshold corresponds to the minimum value between the two peaks in the histogram.
    But the gray histogram of the random fluctuations, so the need for robust method selection, the histogram must be smoothed to the histogram and a Gaussian filter convolution to complete the smoothing process. In order to select a suitable value for the Gaussian filter, a good strategy is to gradually increase and smooth the histogram until a unique maximum value and a unique minimum between them can be obtained from the smoothed histogram.

    Dynamic Threshold Segmentation:

    With the mean, Gaussian, or median filter, the average grayscale value (the background value) within the window centered on the current pixel can be calculated with smoothing.
    The comparison between the image and the local background is called dynamic threshold segmentation.
    Dynamic threshold segmentation for bright objects:
    Image value-Background value
    Threshold segmentation for Dark objects:
    Background Value-Image value
    The size of the smoothing filter determines the size of the object that can be divided. (The size of the filter should be greater than the size of the extracted object)
    Dynamic threshold segmentation can be used to detect anomalies:
    Object value to be measured-image object value > a threshold value
    premise : The image of the object to be measured and the reference image must be precisely aligned,

    Anomaly Detection: Deviation model method

    Using the average of n training images to model the reference image, the deviation of the reference image is modeled using the standard deviation of the N-amplitude training image. (When the deviation is too small to apply, an absolute threshold should be added at this time)

    2. Extracting connected areas how to define pixel connectivity:
  3. Two pixels with a common edge
  4. Include the diagonal line as well.
    The front and rear view must use different connectivity definitions
    Calculate the connected area on the area described by the stroke notation, you can use the depth-first search

    3. Sub-pixel precision threshold segmentation

    It is impossible to extract a polygon, which should be a sub-pixel-precision contour, representing the boundary between two areas of the image.
    Represents these two boundaries, the discrete representation of the image must be converted to a continuous function

    5. Feature extraction 1. Regional characteristics 1. Moment-based features

    Area is a special case in the generalized characteristic of the moment called the region.
    \[M_{P,Q} = \sum_{(r,c) \in R} r^pc^q\]
    \ (m_{0,0}\) is the area of the region
    When \ (p+q\ge1\) . Moment divided by area to get normalized moment
    The normalized moment is determined by the position of the image. It is often useful to make features that do not change depending on the location of the area in the image. These center moments are implemented by the following formula at \ ((p+q\ge2) \) :
    \[\mu_{p,q}=\frac{1}{a}\sum (r-n_{1,0}) ^p (c-n_{0,1}) ^q\]
    The second-order center distance \ ((p+q=2) \) is particularly noteworthy, and it can be used to define the area's azimuth and area range.

    2. Based on external geometry primitives (Rectangle, circle)

    width, height, aspect ratio can be calculated
    The method of calculating the circumscribed circle of any azimuth is based on the convex hull of the area first computed
    A convex hull based on this area can define another useful feature: Convexity
    Convexity is defined as the ratio of the area of an area to the area of the convex hull of the area, which is used to measure the degree of compactness of the area
    Outline length of the area

    2. Grayscale value characteristics

    The mean and standard deviations measured in a reference area can also be used to create a linear grayscale value transformation that compensates for changes in brightness.

    6. Morphology 1. Regional morphology

    All regional morphological processes can be defined according to six very simple operations: the set, intersection, difference set, complement, Pan, and transpose.
    Expansion, corrosion, open operation, closed operation
    Expansion and corrosion are also known as the maximum filter and the minimum value filter
    Morphological gradient operators:
    Expansion-Corrosion

    2. Morphology of gray values 7. Edge Extraction 1. Edge definition in one and two dimensions
  5. One-dimensional
    \[|f^{\prime}|\gg 0\]
    There are usually a lot of points that are connected to this condition, because the background grayscale value to the foreground grayscale value is too smooth. So in order to obtain the unique edge position, we must add the additional requirement that the absolute value of the one-dimensional derivative \ (|f ' (x) |\) is the local maximum. This is non-maximum suppression
    \[f^{\prime\prime}=0\]
    \[f^{\prime}f^{\prime\prime\prime} < 0\]
    \[f^{\prime}>0 is positive edge \]
    \[f^{\prime}< 0 is negative edge \]

  6. Two-dimensional
    \[\bigtriangledown F = \bigtriangledown f (r,c) = (\frac{\vartheta{f (r,c)}}{\vartheta{r}},\frac{\vartheta{f (r,c)}}{\ Vartheta{c}}) = (f_r, f_c) \]
    \[|| \triangledown| | _2=\sqrt{f_r^2+f_c^2}\]
    Equivalent to the absolute value of the first-order derivative in one dimension \ (|f^{\prime} (x) |\)
    Gradient direction:
    \[\phi=-arctan (f_r/f_c) \]
    Note \ (\phi\) increases along the positive direction of the arithmetic (counterclockwise direction) starting from the horizontal axis
    Laplace operator:
    \[\triangle F = \triangle f (r,c) = (\frac{\vartheta^2{f (r,c)}}{\vartheta{r^2}},\frac{\vartheta^2{f (r,c)}}{\vartheta{ C^2}}) = (F_{rr}, F_{CC}) \]
    The edges can be calculated by the Laplace operator over 0:
    \[\triangle f (r,c) =0\]
    Only at the straight edge is the local gradient maximum and the Laplace operator returns a value, the gradient value local maximum to define the edge always falls in the associative corner, the Laplace operator over zero defined edge always falls outside the ideal corner

    2. One-dimensional edge extraction

    The speed is often used to determine the position and size of an object.

    First question: How to calculate the derivative of a discrete one-dimensional grayscale value profile? First Order reciprocal
    \[f ' _{i}=\frac{1}{2} (F_{i+1}-f_{i-1}) \]
    Second derivative
    \[f ' _{i}=\frac{1}{2} (F_{i+1}-2f_i+f_{i-1}) \]
    That is, the following convolution mask:
    \[\frac{1}{2}[1,0,-1] and \frac{1}{2}[1,-2,1]\]
    When you calculate a section on a slash, circle, or ellipse, you generate several lines that are perpendicular to the surface of the gray value we get. The points on the line usually do not fall on the center of the pixel, and interpolation is required.
    Because noise tends to cause too many second-order reciprocal zeros, it is not easy to extract obvious edges using second-order derivatives.
    In order to suppress noise, it is possible to have a proper average of gray values in the vertical direction of the line in the Grayscale section, but it cannot be suppressed when the detected object has a very large number of textures, or if enough pixels cannot be selected for averaging.
    At this point we are smoothing the grayscale profile so that we need two convolution to extract the edges on the section, and we can synthesize the two convolution into a convolution-edge filter
    Canny guidelines (how to calculate a good edge detector):
  7. Low probability of error checking and missing an edge point
  8. Pull out the edges as close as possible to the real edges
  9. Returns only the unique edge for each true edge (maximizes the distance between the extracted edge positions)
    Canny that the best edge filter is the first derivative of the Gaussian filter.
    Deriche proposes an improved canny algorithm that proposes two filters that can be implemented recursively:
    \[d ' _{\alpha} (x) =-{\alpha}^2xe^{-\alpha|x|} \]
    \[e ' _\alpha (x) =-2\alpha sin (\alpha x) e^{-\alpha|x|} \]
    The corresponding smoothing filter:
    \[d_\alpha (x) =\frac{1}{4}\alpha (\alpha|x|+1) e^{-\alpha|x|} \]
    \[e_\alpha (x) =\frac{1}{2}\alpha[sin (\alpha|x|) +cos (\alpha|x|)] E^{-\alpha|x|} \]
    Sub-cell edge extraction
    Use the three points around the maximum edge amplitude to fit the parabolic line, and then calculate the maximum value of the parabola

    3. Two-D edge extraction

    \[f{r;i,j}=\frac{1}{2} (F{i+1,j}-f_{i-1,j}) \]

\[f_{c;i,j}=\frac{1}{2} (F_{i+1,j}-f_{i-1,j}) \]
\[\left[\begin{matrix} 1 & 0 & 1 \ A & 0 &-a \ 1 & 0 &-1 \end{matrix}\right]\tag{1}\]
Note that the filter mask is mirrored when convolution:
\[\left[\begin{matrix} 1 & A & 1 \ 0 & 0 & 0 \-1 & A &-1 \end{matrix}\right]\tag{1}\]
When\ (a=1 \), we get\ (prewitt\)filter, vertical and to derivative direction filtering
When\ (a=\sqrt{2}\)When we got the\ (frei\)Filter
When\ (a=2 \), we got a\ (sobel\)Filter, perpendicular to the direction of the derivative is approximate to Gaussian smoothing filter.
When\ (a=2.435101\)When we got the\ (ando\)Filtering
Because the 2-norm takes too much time, it is often used
1-Norm (4-connected):
\[|| \triangledown{f}| | _1 = |f_r|+|f_c|\]
or maximum norm (8 connectivity):
\[|| \triangledown{f}| | _{\infty}=\max (|f_r|,|f_c|) \]
Because\ (3x3\)Poor robustness
So use the canny two-dimensional form:
\[g_r=\sqrt{2\pi}{\sigma}g ' _{\sigma} (r) G_{\sigma} (c) \]
And
\[g_c=\sqrt{2\pi}{\sigma}g ' _{\sigma} (c) G_{\sigma} (r) \]
Canny operator of edge detection
Non-maximal value suppression

8. Segmentation and fitting of geometric primitives 1. Line Fitting

How to express a line: Black plug paradigm
\[{\alpha}r+{\beta}c+{\gamma}=0\]
\[{\alpha}^2+{\beta}^2=1\]
Fit a straight line even if the distance from the point to the line is minimized:
\[{\varepsilon}^2 = \sum_{i=1}^n ({\alpha}r_i+{\beta}c_i+{\gamma}) ^2-\lambda ({\alpha}^2+{\beta}^2-1) n\]
This method is used to obtain\ ((\alpha,\beta) \), which is both the normal vector of the line and the short axis obtained from the ellipse parameter of the point set.
Weights can be added to reduce the effect of distance points.
Then the process of minimization becomes:
\[{\varepsilon}^2 ={\omega}_i \sum_{i=1}^n ({\alpha}r_i+{\beta}c_i+{\gamma}) ^2-\lambda ({\alpha}^2+{\beta}^2-1 ) n\]
Method of determining weights: multiple iterations.
weight function:
Huber Law:
\[\omega (\sigma) = (x) =\left\{\begin{aligned}1 && |\sigma|\leqslant R \r/|\sigma|&& |\sigma|> r \end{aligned}\right.\]
Tukey method:
\[\omega (\sigma) = (x) =\left\{\begin{aligned}\lbrack1-(\SIGMA/R) ^2\rbrack^2 && |\sigma|\leqslant R && |\sigma|> r\end{aligned}\right.\]
which\ (r\)is a clipping function, manually set, typically\ (r=2{\sigma}_\delta\)
\[{\sigma}_\delta=\frac{media|\sigma_i|} {0.6745}\]
\ (Ransac algorithm \)
The outliers are discarded successively, and a solution is constructed by randomly selecting the minimum number of points.

2. Round Fitting

\[{\varepsilon}^2 = \sum_{i=1}^n (\sqrt{(R_i-\alpha) ^2 (C_i-\beta) ^2}-\rho\]
You can also add weights, and use \ (Ransac algorithm \)

3. Ellipse Fitting

An implicit equation for an ellipse:
\[{\alpha}r^2+{\beta}rc+{\gamma}c^2+{\delta}r+{\zeta}c+\eta=0\]
\[{\beta}^2-4{\alpha}{\gamma}=-1\]

4. Split the contour into lines, circles, and ellipses

Line fitting:
The rammer algorithm recursively subdivides the contour until the maximum distance between the resulting segments and the corresponding contour segments is less than the threshold value set by the user.
Practical application:
The edges are extracted by subpixel accuracy, and then the rammer algorithm is used to approximate the extracted edges by polygon.
The algorithm for dividing outlines into lines and circles is divided into two categories:
1. Identify the breakpoints on the contour that corresponds to the explicit entity
2. Start by dividing the contour into straight lines, and the second step is to check if the over-segmented segments can be merged into a circle or ellipse.

9. Camera calibration 10. Stereoscopic Reconstruction 11. Template Matching

Template Matching
Application:
1. Integrity detection 2. Object Recognition 3. Determine the position and posture of the target object

1. Template matching based on gray values 2. Use a graphical pyramid to match 3. Subpixel precision matching based on gray values 4. Template matching with rotation and scaling

Discretization of search space: Creating templates in multiple directions
Larger templates use smaller stride, smaller templates use larger stride

5. Reliable Template Matching algorithm

The edges of the image are rarely affected by the change in light, but there is a problem with how to choose the right threshold for edge extraction, which is why the matching algorithm is reliable enough to handle occlusion and clutter.
Edge Matching Policy:
1, we can use the original edge point in the match, or add some characteristics of each point.
2. Divide the edge into multiple geometric primitives, and then match the resulting geometric primitives in the image
3, Edge-based segmentation, we can get the edge of the mutation point and then match these mutation points.
Categories of edge matching algorithms:
1, based on the template edge and image edge distance
2, based on similar measures
Geometric Hash method

Machine vision Algorithms and applications reading notes (algorithms)

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.