Freeman chaincode

【Introduction】

  Chain code (also known as freeman code) is a method of describing a curve or boundary with the coordinates of the starting point of the curve and the direction code of the boundary point. It is often used to represent curves and regions in the fields of image processing, computer graphics, pattern recognition, etc. boundary. It is a boundary coding representation, and uses the boundary direction as the coding basis. In order to simplify the description of the boundary, the boundary point set is generally described . It takes a linear feature or area boundary, by a starting point and a series of unit vectors in the cardinal directions, giving each subsequent point a direction-encoded representation relative to its predecessor. (Baidu Encyclopedia)

【Original chain code】

  Commonly used chain codes are divided into 4-connected chain codes and 8-connected chain codes according to the number of adjacent directions of central pixels. The 4-connected chain code has 4 adjacent points, which are above, below, left and right of the center point. Compared with the 4-connected chain code, the 8-connected chain code increases 4 oblique directions, because there are 8 adjacent points around any pixel, and the 8-connected chain code is exactly in line with the actual situation of the pixel, and can accurately describe the center pixel and its relationship. information about neighbors. Therefore, the use of 8-connected chain codes is relatively more.

  First, the definition and description of Freeman coding are given: choose any pixel point (usually performed on a thinned image) as a reference point, and its adjacent pixels are in 8 different positions, and give them a direction value of 0 to 7 (As shown in Figure 1), it is called the chain code direction value of 0-7 bits. A line can use the code value string of Freeman chain code to represent the chain code called the line pattern. As shown in Figure 2, a 9 × 9 dot matrix diagram is given, in which a line segment, S is the starting point, E is the end point, this line segment can be expressed as L = 43322100000066.

【Normalized chain code】

  The original chain code has translation invariance (the pointer does not change during translation), but when the starting point S is changed, a different chain code representation will be obtained, that is, it is not unique. For this purpose, a normalized chain code can be introduced. The method is as follows: for a closed boundary, choose a point S to obtain the original chain code, regard the chain code as an n-bit natural number composed of numbers in each direction, and circulate the code in one direction. , so that the n-bit natural number formed by it is the smallest. At this time, a chain code with a unique starting point is formed, which is called a normalized chain code, also called a normalized chain code. That is to find the minimum value that can be represented by a closed chain code. As can be seen from the figure below, the minimum is when the starting point is 0, which is pointed by the arrow.

【Differential code】

  In order to obtain a chain code with rotation invariance, we can define a so-called differential code. The differential code corresponding to the chain code is defined as: adding m to the unrotated pointer and then modulo 4 (four-chain code) or 8 (eight-chain code).

Modulo operation:

  Use the first-order difference of the chain code to reconstruct a sequence (a new sequence representing the direction change between the segments of the original chain code). This difference can be obtained by subtracting two adjacent direction numbers.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324972860&siteId=291194637