Raster structured light sensor coding method

With the improvement of the level of production automation, people have higher and higher requirements for the monitoring level of production links. The visual inspection system can meet the real-time requirements for production line testing, and has a certain degree of flexibility, moderate accuracy, and therefore has been widely application. In general, visual inspection systems include structured light sensors, multi-line structured light sensors, and binocular vision sensors. This article mainly discusses multi-line structured light sensors, namely grating-type structured light sensors.

1 grating structure of the principle of optical sensors

The grating-type structured light sensor is a vision sensor based on an active trigonometry. A series of light planes are projected by the light projector in space. Each light plane passes through the camera to establish a perspective correspondence with the image plane. The geometric structure is shown in FIG. 1.

Fig. 1 grating structure light sensor structure

The orthogonal coordinate system O(K)Lx(K)Ly(K)L is established with O(K)L as the origin on the Kth light plane, and the rest is the camera model structure. The relationship between the coordinates of the image plane and its coordinates in the light plane [1] is as follows:

(1)

It can be seen that if the required light plane coordinates must know which light plane the point belongs to. Therefore, grating-type structured light sensors have the problem of identifying light bars. This problem can be solved by light bar coding.

2 structured light encoding

2.1 Overview of Structured Optical Coding Since wire-structured light sensors acquire less information (only position information in one light plane can be obtained), people have developed grating-type structured light sensors and mesh-format structured light sensors accordingly. However, the matching of points also appeared accordingly.
In order to solve the point correspondence problem, people encode the projected light. Altschulter [2] and Posdamer [3] used laser shutter coding technology. The 128×128 laser grid is projected onto the surface of the object through a programmable spatial light modulator to generate a lattice model on the image plane. The programmable spatial light modulator [4] can be programmed to pass certain laser beams while certain laser beams are blocked. By corresponding to a series of images of different laser beams, the correspondence of the points can be solved. Literature [5] proposed a time series coding scheme using gray codes. For the usual three-dimensional static objects, these two methods can well complete the point correspondence, but for the dynamic real-time problems, these methods obviously cannot be used.
For dynamic real-time problems, we hope to have a solution that can solve the matching of points through a single image. Boyer and Kav [6] use a colored light bar to encode the color of adjacent bars. Vysteke and Oosterlinck [6] project a square template onto an object that is encoded by binarization. Minarv [6] et al. proposed an encoding method based on a three-level gray scale network structure structured light.
From the above discussion, it can be seen that the net-format structured light can be encoded using two-dimensional information, and there are many available information, so the encoding problem is relatively easy to solve. However, mesh-structured light sensors cannot accurately measure feature points. In order to achieve accurate measurement of feature points, we use a grating-type structured light sensor. Therefore, it is necessary to study the coding scheme of the grating-type structured light sensor.

2.2 The feasibility of width coding For grating structured light sensors, we use the width of the light bar to encode. To use the width of the light bar for encoding. It must be ensured that the equal width of the light bar projected on the image plane is equal to or close to one. According to the principle of perspective transformation, it can be known from the analysis that, for a lens with f=25 mm, the widths of adjacent two light strips do not vary greatly when the working distance is 400 mm, so it is feasible to encode according to the width of the light strip projection. Figure 2 is the ratio of the width of the wide and narrow light bar 2:1, projected on a flat screen, the camera receives the image, in the image surface to obtain a wide strip width of about 20 to 25 pixels, a narrow width of about 11 to 15 pixels. It can be seen that the wide and narrow light bars can be easily separated.

Figure 2 binary coded light bar image

3 binary encoding method

3.1 n-bit binary encoding method Figure 3 shows the principle of the structured light projector. The pattern pattern of the projector template basically determines the light bar pattern after the light plane intersects with the object surface. The encoder of the grating-type structured light sensor is realized by coding the pattern pattern on the template.

Fig. 3 Principle of light projection of grating structure

A series of patterns composed of two lines of different widths and widths are engraved on the template. The pattern formed by projecting the plane of light of the template and the object after intersection is a series of light bars of different widths and widths. The pattern is coded in binary on the template. Use "0" for narrow bars and "1" for wide bars. All light strips are grouped in order, each group corresponds to a serial number, and a binary code is used to represent the serial number of each group. The binary code corresponds to the pattern of the group. For example, a three-bit binary code is used to represent the sequence number of each group, and a group with a sequence number 4 is represented by a binary code "100", and the corresponding line patterns are "width", "narrow", and "narrow". Assuming that the n-bit binary code represents each group's corresponding serial number, there are 2n groups of line patterns, so that at most n. 2n light bars can be encoded. Figure 4 shows a three-bit binary coded template pattern.

Figure 4 Three-bit binary coding pattern

It is easy to identify binary-coded light planes. First, the light bar received by the camera is processed, and the light bar is translated into a sequence composed of binary codes according to the width of the light bar. Then, the resulting sequence is decomposed into groups according to encoding rules, and finally each specific light plane is identified. . It should be pointed out that due to the surface size of the measured object and the limitation of the camera field of view, the number of light beams obtained by the camera is generally smaller than the number of light planes projected by the projector.
For example, using a two-bit binary code to process the light bar received by the camera to obtain "001101" and grouping the sequence by two bits, there may only be two results: "00" "11" "01" and "0 "01", "10", and "1." The former corresponds to the grouping sequence number 0, 1, 3, which obviously contradicts the coding rule. The latter corresponds to the packet sequence number unknown, 1, 2 unknown, which is in line with the coding rules. Based on this, the second unknown light bar is grouped into 0, and the unknown light bar behind is the first light bar of grouping 3. It can be seen that each light bar in the field of view can be effectively identified.
For objects whose surface normals are basically unchanged or whose variation is very small, it can be known from the literature [1] that the ratio of widths of wide and narrow strips can be set to 2:1, which means that it is very effective to distinguish between wide and narrow strips. Remember threshold1=1.5, threshold2=0.6. If Δ1/Δ2>threshold1=1.5, it can be judged that 1 is a wide light bar and 2 is a narrow light bar; if Δ1/Δ2

3.2 Pseudo-random sequence encoding method The n-bit binary encoding method described earlier can encode n.n2 light bars. As n increases, the number of light bars that can be coded increases rapidly. However, the main criterion for measuring the merits of a coding method is the amount of information required for decoding, and the less information required for decoding, the better.
In n-bit binary coding, at least 3n-1 consecutive light bars are required to ensure correct decoding. For n=4, 64 light bars can be encoded. But to decode correctly, you need to receive at least 11 consecutive bars. The question we need to consider now is whether we can minimize the number of light bars required for decoding. The study found that: M sequence [7] can reduce the information needed for decoding.
The composition of the M sequence will be described below. The following relationship exists between the elements of an infinite binary sequence:

Xi=a1Xi-1 a2Xi-2 ... apXi-p (2)

Where: i=p+1, p+2,..., coefficients a1, a2,..., ap-1 take a value of 0 or 1, and the sum of coefficients ap is 1. Represents the sum of modulo-2.
By properly selecting the coefficients a1, a2, ..., ap, the sequence can be cycled with the longest period of (2p-1) bits. This longest period binary sequence is called an M sequence.
Take X4=1, X3=0, X2=1, X1=0,
Let Xi = Xi-3 Xi-4 can get X15, X14, ... X1 as follows. We find that for any four consecutive x, the binary values ​​are not the same, so as long as we know any four consecutive x, we can know the position of the group x in the sequence, so as to effectively decode.
The information required for decoding the M sequence is less than the n-bit binary code. When p=6, 63 light bars can be encoded. In this case, only 6 continuous bars can be translated in the field of view. Code; For n-bit binary encoding If you encode 64 light bars, 11 light bars are required for decoding.
Use the two-dimensional array a[15][4] to store the number of each adjacent bar. For example, if the 12th, 11th, 10th, and 9th light bars have a binary representation of 1000, a[8]={12,11,10,9}; the eighth, seventh, sixth, and fifth light bars have a binary representation. 1001, then a[9]={8,7,6,5}. Assume that we have obtained four consecutive light bars with a binary representation of 1001. Then, by looking at the 9th line of the array a, the serial numbers of the 4 light bars are 8, 7, 6, and 5, respectively.
It can be seen that the identification of the light bar is solved to a certain extent by encoding of the grating-type structured light sensor, and the use range of the sensor is improved. If the surface of the object is slightly changed in terms of method, the ratio of the wide strips to the narrow strips must be made large in accordance with the above method, and in order to ensure the accuracy of the narrow stripe, the narrow strips cannot be made too narrow, if only Increasing the ratio of wide and narrow light bars will inevitably lead to a drastic reduction in the light bars in the field of view. Since there are very few places where the normal change is very severe, the area where the width of the light bar is locally reversed can be corrected by the error correction coding technique, so that the problem can be solved.