10 lectures on VC Digital Image Processing Programming

Source: Internet
Author: User

Analysis of geometric characteristics of images

I. Object Boundary Calculation and recording

(1) joining and Connection

As one of the basic Geometric Properties of an image, the relationship between a pixel or a target object composed of a pixel is studied. for digital images, we must first understand the structure of the Image array. next we will discuss the analysis based on the square array.

1. neighboring points

For a point in the image, the top, bottom, and left points are 4-adjacent points. if the four endpoints of the two diagonal lines are added (top left, top right, bottom left, and bottom right), these eight points are the points defined by the neighboring points. See Figure 8-6-1.


Figure 8-6-1 concept

2. Adjacent

Set A and B as the two subsets of the image. If a has at least one vertex in B, it is called a and B adjacent. Obviously, there are two concepts: Eight-neighbor. The two subsets are 8-Adjacent Vertex joining, not necessarily 4-Adjacent Vertex joining. 8-6-2.


Figure 8-6-2 8-neighbor vertex joining while 4-neighbor vertex not joining example

3. Path (Road)

A path from point to point is a sequence of points that meet the following relationship. The two neighboring points are adjacent to each other. Is the length of the path. There are also 4-neighbor and 8-neighbor paths. 8-6-3


Figure 8-6-3 path example

4. Connectivity

If the vertex and the vertex are in the image subset and there is a path completely composed of the midpoint from the to, it is called and connected. For any point in, all sets connected to its midpoint are called the connected component in. If there is only one connected component, it is called connected. Obviously there are also differences between 4-neighbor and 8-neighbor. See Figure 8-6-4.


Figure 8-6-4 connection example

5. Background and holes

Any connected component that is connected to the edge of the image belongs to the same connected component. This component is called Background B. And all other components in it are called holes. If no holes exist, this is a single connection. Note that using different neighboring points in and to define the connectivity can avoid unreasonable phenomena. For example, in a pattern, two 1 pairs on the diagonal corner are connected, while the other 0 pairs on the diagonal corner cannot be connected, and vice versa. However, if we connect to 1 and 0, that is, the two are connected by eight-adjacent points, which leads to a conflict. Therefore, it is necessary to analyze and study the connectivity characteristics of different neighboring points.

6. surrounded

Set and be two non-overlapping subsets of the image. If any path from any point to the edge of the image must meet each other, it is called surrounded, or inside.

(2) Calculation of boundaries and Boundaries

The boundary refers to a set with neighboring vertices. The set of the remaining vertices removed in is called internal, that is, the difference set. There are also two defining methods for border research: 4-neighbor and 8-neighbor.

1. Parallel Computing of boundaries

(1) A set of images can be found in 8-6-5 (a). The set of 1 represents an object. Perform a logic non-operation on the image to obtain Figure 8-6-5 (B ).

(2) Move Figure 8-6-5 (B) to the position of a point in the top, bottom, left, and right directions to obtain four images in Figure 8-6-5 (c. (For the definition of 8-adjacent points, we need to move the four corners four times to get 8 images ).

(3) perform logical or operations on the four images in Figure 8-6-5 (c) to obtain Figure 8-6-5 (d ).

(4) perform logic and operations on Fig 8-6-5 (d) and fig 8-6-5 (a) to obtain the boundary of an object. See Figure 8-6-5 (e ).


Figure 8-6-5 boundary parallel computing example

2. Border Tracking Algorithm

The border tracking algorithm introduced here is much simpler than the method used for Border Tracking by scanning in image segmentation. This is mainly a binary image. The purpose of obtaining the boundary is to express the boundary in the form of a simple chaincode as needed for practical application.

It is a connected component of an object, and the boundary of it is a set of neighboring midpoint. It is now agreed that 8-adjacent points are connected, and 4-adjacent points are connected. Given a pair of initial points ,. In, in. The steps of the Border Tracking Algorithm (BF) are as follows:

(1) Change the sum to 3 and 2, respectively.

(2) Use a vertex as the first adjacent vertex of the vertex, and search for all neighboring vertices clockwise ,,........., . Once the neighboring points are 1, 3, and 4, they are stopped. And remember this.

① During the search process, if, for, 3 is 4, 2 is 0, and the result ends.

② Otherwise, (set the midpoint value to 1) as the new value and change the value to 4. Repeat Step (2) as the new one.

(3) When the BF algorithm ends, the set of all vertices with 4 values in the graph is the boundary of sum.

Follow these steps to track and detect all the boundary points of a given subset in an image by using BF algorithm:

(1) Use a television grating to scan an image. If 1 or 2 appears on the right side of 0, or 1 or 2 appears on the leftmost side of a row, then this point must be a non-tracked boundary point (for example, a boundary) assumed as a point.

(2) Use the BF algorithm to track this boundary and mark them according to the following conventions.

① If the vertices they have are left neighbors, These vertices are changed to 3 (originally 1 or 2)

② If the vertices they do not have are left adjacent points, they are changed to these points (originally 1)

③ If the original logo is 3.

(3) After the BF algorithm is completed, return to the vertex and continue to scan down, and then use the BF algorithm. After the scan is complete, all boundaries are marked as 2 or 3.

Note the following:

First, if it is a single connection, you can use only one flag 3. However, if it is a re-connection (with holes in it) with only one sign, the hole will be lost. 8-6-6 (0 at the unlabeled value)

Figure 8-6-6 S is a reconnected boundary tracking algorithm.

If only one sign 3 is used, the result of figure 8-6-6 (B) is obtained as the boundary point of the hole (the point in Figure 8-6-6 (B) it will never be discovered. As defined in step 1 of tracking and detection, 0 must be on the left side of the system to be detected. However, if two signs are used, the result of figure 8-6-6 (c) is obtained after the background boundary is tracked. When scanning to the 2 point with the "*" symbol, you can stop scanning and carry out the BF algorithm, to find the boundary point of this hole (hole h only has this point on the H boundary, not on the background boundary ).

Secondly, after the tracking detection algorithm is slightly improved, it can be used for unsegmented gray images. You only need to know which points in the image are of interest and which do not.

Thirdly, if the BF algorithm is used to track and detect the arc and curve, some improvements should be made based on the situation. If the improvement is too complicated, the possibility and effectiveness of the actual application should be taken into account.

(3) Calibration and counting of the target object

In practical application, each component of the image subset is often processed as a single target object. Therefore, in addition to giving them different marks, they must be able to correctly count, the basic method to achieve this goal is search Extension Method and scan method.

1. Search Extension Method

Set the point of each component after the image is split to 1. For system scanning and search, if 1 is met, 1 is changed to a sign that has not been used, for example. In this way, all the vertices in the neighboring points are changed to signs, so that the whole component is extended. In this way, all the components are marked. So far, the full Graph Search extension is complete, and different components will be given different marks. Obviously, this is very time-consuming.

2. Scanning Method

There are many methods to apply the scanning method to the target object mark in the image. A simple method is introduced.

Set the points in each component after the image is split to 1. First, scan the image. If there is a segment or different segment 1 in a line, different signs will be given first ,,....... Next, scan a row. If 1 is encountered, if the 1 is the same as the uplink adjacent segment, as shown in. If this 1 is adjacent to several upstream segments, they are all switched to the unified flag. If it is not adjacent to the previous line, give unused signs, such as, and so on, sweep the entire graph.

3. Count

Here we only introduce the tracing method, the simplest counting method. That is, write down the number of segments that appear not adjacent to 1 in the row that begins to output 1. In the following row-by-row calculation, if there is a segment of 1, if it is not adjacent to the segment of 1 in the previous line, the total number is added to 1. If it is adjacent to the previous segment, the total number is subtracted. The total number after scanning is the number of components. Of course, the number of this component includes single-connection and re-connection (that is, the connected component with holes ).

Ii. Calculation of size and distance

(1) Area Calculation

Defines the area of a subset of a digital image as the number of points (like prime number ). The area calculation of the visible image subset is very simple. In this example, There is a component in the image ,,,......, ,......, .

Set counters respectively and ,,......, Correspondingly, when the scan encounters 1, determine the component, that is, add 1 to the counter. After the scan is completed, the counter content is the corresponding component area. There are also many ways to calculate the image area, which can be determined based on the image features, application requirements, and your computer capabilities. For example, for images with connected components already divided, you can use a single scan to calculate the starting area. The procedure is as follows:

(1) When scanning the first row of the number of segments with 1, store the number of segments with 1 in the corresponding counter and create a corresponding pointer (such as an address ).

(2) perform the following judgments and operations in case of a segment containing 1 during the scanning of the following rows.

① If the segment is not connected to the segment of 1 in the previous line, create a new counter and calculate the length (including 1) into this counter.

② If the segment is connected to the middle segment of the previous line, the length is counted into the counter and the pointer is moved from.

③ If the segment and the previous line have several segments ,,......, Connected. Then ,,......, Add the number and length of the counter to the counter, and move the pointer from.

(3) scan the memory in the full graph counter, that is, the corresponding component area.

The accuracy of image area calculation depends on the sampling interval during the digitization process. Obviously, the smaller the sampling interval, the closer the calculated digital area is to the actual area. In addition, the area calculation is also related to the noise size. In order to reduce noise impact, it is often solved by setting an area threshold. A few of the following areas are not included in the area of the connected component.

(2) perimeter Calculation

The perimeter definition of a subset of a digital image has different concepts, so the calculation method is different. There are usually three methods:

(1) perimeter Definition 1: Sum of the "crack" length separated by the points, that is, the logarithm of the points. (, Adjacent, in, in)

(2) perimeter Definition 2: Number of steps of the BF boundary algorithm.

(3) perimeter Definition 3: the area of the border, that is, the number of points.

The precision of calculating the perimeter of a subset of a digital image is more serious due to the influence of sampling interval and noise, which usually increases exponentially with the decrease of sampling interval. Pay special attention to this feature in practical applications.

Example 8-5 Calculate the perimeter of the following subset (Figure 8-6-7)


Figure 8-6-7 perimeter calculation example

According to different perimeter definitions, the calculation results are shown in the table 8-6-1.

  A B C
Define a perimeter 8 10 16
Define the second perimeter 4 6 6
Define three perimeter 4 4 4

Table 8-6-1 computation results

(3) distance definition and calculation method

1. Distance Definition

Set to a function that is not negative for each vertex. If all the point-to-point and function forms that meet the following conditions can be defined as distance.

① When and only when

There are three commonly used distance definitions:

Figure 8-6-8 distance Definition

(1) Euclidean distance, expressed in. See Figure 8-6-8 ()

  

The diagonal distance of a digital image.

(2) The street distance in the city, as shown in Figure 8-6-8 (B ).

  

For a digital image, the diagonal distance is represented because the distance from the vertex is 1 point, which is a 4-Adjacent Vertex defined domain.

(3) The Board distance, as shown in Figure 8-6-8 (c)

  

For a digital image, the diagonal distance is also the same as the distance from a point to a point that is 8-adjacent points.

2. Distance Calculation

Distance algorithms include the following types:

(1) distance parallel algorithms (PD)

(2) distance Sequential Algorithm

(4) symmetric central axis (skeleton) and contraction expansion and reduction (refinement) Operations

1. symmetric central axis

In general, the "symmetric central axis" refers to the set of points with the largest distance from an object to a local place. It can also be referred to as "central axis" or "symmetric axis ". It is like the Central skeleton of an object, so it is often called a "skeleton" directly ". If the distance between the symmetric central axis of an object and its vertices above is given. Then we can reconstruct this object. Therefore, you can use it to describe objects. However, it is often not used to describe objects with boundaries to save more bits and be sensitive to noise, which may also be affected by connectivity. Therefore, it is only applicable in some special cases.

If it is the symmetric central axis of an object, the distance from the center is the largest point set. That is, if and only if the following formula is met:

  

Vertices in the formula.

From this formula, we can see that the distance between any point of the symmetric center axis is greater than the distance between all neighboring points of the point.

2. expansion and contraction

For any image subset, the distance between the points within the range can be obtained by extending. The solution is: if there are 0 and 1 neighboring points in the midpoint, change all the 0 in these neighboring points to 1, and repeat the times to obtain them. The result is represented. Likewise, a point set with a distance not within can be obtained from shrinkage. The method is as follows: if there are 0 and 1 neighbors in the preceding vertex, all the neighboring vertices are changed to 0 and can be obtained after repeated times. The result is recorded. Pay attention to the following points during the computation of contraction extension:

(1) the definitions of "neighboring points" and "distance" must be consistent during the contraction and expansion process, that is, 4-neighbor points should be defined, and 8-neighbor points should be defined.

(2) contraction is equivalent to expansion. Scaling is equivalent to shrinking. In addition, the contraction and expansion operations can be combined, for example, the result of first expansion and then contraction. However, they are not necessarily the same as the three. See Figure 8-6-13. It is defined with 8-neighbor points.


Figure 8-6-9 contraction and expansion operations

Normally

  

For a constant, the following formula is true.

  

(3) contraction and expansion operations can be effectively performed in parallel computers. Contraction and expansion operations can be used in many image technologies. For example, the symmetric central axis (skeleton) of the image subset can be obtained through contraction expansion ). This method seems to set fire around a dry lawn, and the fire continuously burns toward the center. Finally, the FireWire is called the Symmetric Middle axis, so some people call it the "fire grass" method. It can also be used to detect whether some parts of the image are isolated or clustered, because these parts have been extended several times and then shrunk several times, and the isolated parts will remain unchanged, the aggregated parts will be merged into blocks. It can also be used to fill in the discontinuous and incomplete regions of the boundary. In some cases, first shrinking in expansion can also remove noise .. It should be noted that contraction is very useful for analyzing the topological nature of the image. For example, it is very convenient for counting operations to contract the connected component. The concept of topological properties of an image is to place the image on an eraser. When the eraser is deformed, some of the unchangeable Geometric Properties of the image are displayed. Such as adjacent, connected, cross, and surrounded. Is the topological nature of the image. The angle, area, and perimeter are not the topological properties of the image.

3. Thinning (refinement)

Contraction can narrow down an object, but it cannot maintain its shape. Therefore, the following shape analysis uses a refinement algorithm to keep the object in its curve shape. The refinement algorithm and contraction algorithm are basically the same. Only those pixels with at least two adjacent ones are eliminated during the operation. Therefore, the endpoint of an object is not eliminated, thus retaining the curve shape. The refined operation can be divided into two steps: first, left, right, and then up and down. Of course, it is also possible to go up and down first and then left and right.

Iii. Object Shape Analysis

Using the shape of a subset of images to describe objects can be closer to people's visual habits. However, the concept of shape itself is very complicated. It does not refer to a single nature of a subset, but to the synthesis of a family nature. It is not only multidimensional but also related to people's visual psychology. Therefore, we cannot make a definite analysis and research at present. We can only analyze some of its aspects as a primary application in some occasions.

(1) curve analysis

1. Some Basic Concepts

Curve and arc. If an image subset has only two adjacent points, it is called a arc or a curve. These vertices are called General vertices on a curve, in the range of 8-6-10.

Figure 8-6-10 related curve concepts

Curve endpoint: a point with only one adjacent point in the top, which is called an endpoint, 8-6-10.

The pivot of a curve: a point with more than two adjacent points, called the pivot. 8-6-10.

Simple curve (ARC): A curve (ARC) with an endpoint without a pivot point is called a simple arc. 8-6-10 (B ).

Simple closed curve: the arc with no Endpoint or pivot is called a simple closed curve. 8-6-10 (c ).

All of the above concepts have two different definition methods: 4-neighbor and 8-neighbor. When using chaincodes to represent curves, 4-adjacent points are defined with 4-oriented chaincodes, and 8-adjacent points are defined with 8-oriented chaincodes.

2. Curve Length (arc length) slope and curvature

The length, slope, and curvature of a curve can be defined based on the continuous curve length in the geometry. The concept of slope and curvature is defined based on the characteristics of the digital curve. For example, the length of the curve in Figure 8-6-11. It is obviously a set of points, that is.

Figure 8-6-11 curve s and eight-direction chaincode

See Figure 8-6-11. The arc length between the defined and defined is

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.