Structured light encoding and decoding method and encoding and decoding device for depth detection

文档序号:5463 发布日期:2021-09-17 浏览:45次 中文

1. The structured light coding method for depth detection is characterized in that columnar graphs are adopted to respectively form a coding primitive and a phase primitive without gaps between the coding primitive and the phase primitive; the coding primitive and the phase primitive are both composed of A color and B color.

2. The structured light coding method for depth detection according to claim 1, wherein the encoded primitives are formed by dividing the column pattern into k parts and then arranging and combining [ k/2]]Filling the part area with color A and filling the rest area with color B to constructA coding primitive in which [ k/2]]Are integers.

3. The structured light encoding method for depth detection according to claim 2, wherein a histogram having the same size as the encoding primitive is used when forming the phase primitive in which the ratio of the a color to the B color is equal to ([ k/2]): (k [ k/2]) are different.

4. The structured light encoding method for depth detection according to claim 3,in a sequence of coded primitives and pseudo-randomThe code characters are in one-to-one correspondence, and the code primitives are arranged into a basic code structure according to the sequence of the corresponding characters in the pseudo-random sequence, wherein the window size of the pseudo-random sequence is M.

5. The structured light encoding method for depth detection according to claim 4, wherein phase primitives are inserted into the basic encoding structure in such a way that one phase primitive is inserted every M encoding primitives, thereby constructing the first k rows of the structured light encoding pattern.

6. The structured light coding device for depth detection is characterized by comprising

A coding unit determining module for equally dividing the columnar pattern into k parts and then arranging and combining [ k/2]]Filling the part area with color A and filling the rest area with color B to constructPlanting a coding primitive; and then, forming a phase primitive by adopting a columnar graph with the same size as the coding primitive, wherein the proportion of the color A to the color B in the phase primitive is equal to ([ k/2]]):(k-[k/2]) Different;

the coding sequence generation module is used for arranging the coding primitives into a basic coding structure according to the sequence of corresponding characters in the pseudo-random sequence, wherein the window size of the pseudo-random sequence is M;

the structured light coding module inserts phase primitives into the basic coding structure in a mode of inserting one phase primitive into every M coding primitives so as to construct the first k lines of the structured light coding pattern; copying and filling the structured light coding pattern of the first k lines into the lines from the n multiplied by k +1 to the (n +1) multiplied by k lines to construct a logic structure diagram of the coding pattern.

7. A structured light decoding method for depth detection, comprising the steps of: determining boundary points among different lines from a structured light pattern; determining the width of each line according to the positions of boundary points on two sides of each line; analyzing the front k lines and the n multiplied by k +1 to (n +1) multiplied by k lines of the structured light pattern according to the k lines arrayed along the Y-axis direction; and fourthly, analyzing the basic column codes corresponding to any adjacent M +1 basic coding units according to the repeated contents in the first k rows and the (n + k +1) th to (n +1) x k rows, and obtaining the coded sequence of the structured light according to the basic column codes.

8. The method of structured light decoding for depth detection according to claim 7, wherein the coding sequence that resolves the coding primitives and phase primitives from the base coding inserts a phase primitive for every M coding primitives.

9. The structured light decoding method for depth detection according to claim 8, wherein the encoded primitive and the phase primitive are parsed into bar graphs formed of a color and B color, respectively.

10. A structured light decoding apparatus for depth detection, comprising

The boundary point determining module is used for determining boundary points among different lines from the structured light pattern;

the line width determining module is used for determining the width of each line according to the positions of boundary points on two sides of each line;

the coding unit analysis module is used for analyzing the front k lines and the n multiplied by k +1 to the (n +1) multiplied by k lines of the structured light pattern according to the width change among the k lines arranged according to the set sequence;

and the coded sequence analysis module is used for analyzing basic column codes corresponding to any adjacent M +1 basic coding units according to contents which are repeated in the first k rows and the (n + k +1) th x k rows to obtain the coded sequence of the structured light according to the basic column codes.

Background

Structured light methods are one of the methods used in the field of machine vision to perform image processing and analysis. The nature of the structured light method is a geometric triangulation method, and the technical difficulty is how to complete image registration quickly and efficiently through one or more well-designed coding patterns. According to the difference of the number of the projected coding patterns in one depth of field measurement, the structured light three-dimensional measurement method can be divided into two categories, namely a multi-frame structured light measurement method and a single-frame structured light measurement method. The multi-frame structured light coding method sequentially projects a plurality of coding patterns, and image registration is completed through a binary search method, so that full-resolution depth of field measurement can be realized. However, the multi-frame structured light coding method requires that the scene cannot move when the depth of field is measured, so that the method is not suitable for dynamic scene measurement. The single-frame structured light measurement method only projects a single coding pattern, and image registration is completed through the coding information of each point neighborhood.

The structured light method is an active visual image registration method which is started in the last 80 th century, the method uses a projector as a reverse camera, the projector projects a pattern with special design, and a camera-projector system finishes image registration through the pattern projected by the projector. The ambiguity problem in image registration is well eliminated thanks to the active signal of the projector.

The classical structured light method is classified into a temporal coding method and a spatial coding method. A typical representative of the time coding method is Gray Code (Gray Code). Like Binary codes, gray codes project multiple well-designed Code patterns in sequence. At each time tiThe projector projects a coded image into the scene, the camera then takes a picture of the scene with the projected pattern, and the picture with the projected pattern is called coded image Ci. C is to be0To CNAfter the coded image is binarized, the brightness change sequence of each pixel point uniquely corresponds to a column serial number on the projector. Therefore, the coordinates of the matching points on the projector can be directly calculated through the brightness change sequence, and the image similarity comparison process with ambiguity is bypassed. The disadvantages of the temporal coding method are that multiple images need to be taken to be able to complete the image registration and that objects in the scene cannot move during the taking. Since it takes relatively long time to capture a plurality of images, the time coding method is generally applied to the occasions of workpiece scanning in reverse engineering, and the like. If the time coding method is used in human body three-dimensional scanning and other occasions, the scanned point cloud will appear ripple interference due to the micro motion of the human body.

The spatial coding method encodes the projector image using a pseudo-random sequence (De Bruijn sequence). The De Bruijn sequence is a string of characters, and a length N De Bruijn sequence is composed of K independent elements. In a De Bruijn sequence, all subcycles of length M do not repeat. The sub-loop sequence here includes a sequence of character tail-to-head concatenation.

The spatial coding based on color images uses different colors to represent independent elements, each column on a projector is endowed with one color, a window with a certain size is taken by taking each pixel as a center during decoding, then the colors of all sections in the window are identified, and the identified colors are sequentially converted into character strings with the length of M. And finally, searching the position of the character string in the whole De Bruijn sequence by using a character string searching method, and taking the position corresponding to the central point as the column coordinate of the matching point after the initial position of the character string is found.

The problems encountered with color image spatial coding methods are: the object surface is also colored, and when the colored stripes are irradiated on the colored object surface, the color of the reflected light changes, and the color change can cause the coded characters recognized by the camera to change, and finally cause the coordinate of the matching point to deviate. Some documents assume that the average color of the area covered by each stripe is white, based on the principle of white balance, and then recognize the code character using the average color of the entire stripe. Although the above assumption is true most of the time, when tracking a complete stripe according to a color change threshold, the stripe is required to be continuous on the surface of the object. If the surface of the object itself is not continuous or there is occlusion due to the viewing angle, the stripes found by the stripe continuity are incomplete, the white balance assumption is affected, and the average color finally recognized also has a deviation.

Besides the problem of color recognition, the classic method for encoding a single image color image has another problem: without the additional coding pattern (i.e., the decoding process can only identify the abscissa of the matching point), the camera-projector system cannot be calibrated by means of the coding pattern alone. To solve this problem, the academia has proposed an M-Array coding method. At a size of N1×N2In the M-Array coding pattern of (2), each M1×M2All sub-images of (1) are compared with other M1×M2The sub-images differ in size. Since each M is1×M2The sub-images are unique so that an algorithm can determine a window of appropriate size on the image taken by the camera, then calculate the color of each part in the window, and finally convert the color into coded characters. After the code characters in the window range are determined, the combination of the code characters can be searched in the M-Array code pattern, and the horizontal and vertical coordinates of the matching point can be determined according to the positions of the code characters. Since the decoder can determine the abscissa and ordinate of the matching point at the same time, the M-Array coding pattern can fully calibrate the camera-projector system without additional patterns.

The M-Array coding pattern may be generated by folding a pseudorandom sequence, if any, to a length ofCan generate a window size of M1·M2Image size n1·n2M-array coding pattern. Where n is n1·n2. The pseudo-random sequence is written along the main diagonal from the upper left corner during generation, and is continued from the other side when the boundary is reached. Since the M-array coding pattern has the cyclic property of a pseudo-random sequence, M needs to be supplemented before the right side21 column, and supplement front M below1-1 line. The main drawback of the M-Array approach is that the maximum resolution supported is relatively small due to the need for folding. In addition, since there is no support for the assumption of white balance, the M-Array coding method is easily affected by the color of the surface of the object. When the surface of the object has color, the recognition rate of the M-Array coding method is reduced.

In order to solve the problem that color coding is easily affected by the surface color of an object, part of scholars use a binarization pattern to replace coding color. Typically, in color coding methods, a relatively large solid color square needs to be projected to ensure that the color is correctly identified. The binarization pattern method replaces a large block of pure color area with the binarization pattern, and when the window size is suitable, the projected binarization pattern can be identified through a neural network or other methods. The binarization encoding method is generally used in the M-Array method, and the common binarization method inserts a black color interval (or other kind of interval) between each pattern to ensure that the pattern can be correctly divided. Because the maximum coding number supported by the M-Array coding method is limited, the academic community has less research on the high-resolution binary single-image coding method.

Recent studies have shown that the vertical stripe encoding method can completely calibrate the camera-projector system without additional calibration images. Under the condition that the vertical coordinate of the matching point cannot be obtained, the existing document establishes a plane or curved surface equation for each coding column by using a plane fitting method, and directly calls the corresponding curved surface equation in the process of three-dimensional reconstruction. The method of directly fitting the plane can obtain a good effect under the condition that the coding columns are sparse, but when the method is applied to a dense coding method such as stripe gray codes, certain coding columns may not be decoded in a calibration scene due to the black-white contrast of thin stripes, the inclination angle and the like. If a certain code column cannot be decoded in the calibration scene, the plane equation corresponding to the code column is missing, and even if the code columns are successfully decoded in the later application scene, the depths of the feature points on the code columns cannot be calculated. These missing plane equations can only be regenerated when the projector is calibrated using the pinhole model.

Compared with the existing common binocular stereo camera method, the structured light method has the advantages of stability, reliability and no influence by the texture characteristics of the surface of an object. Compared with a TOF (time of flight) mode, the structured light method has the advantages of high measurement accuracy and low possibility of being influenced by factors such as temperature and humidity.

Disclosure of Invention

The technical problem to be solved by the invention is to provide a structured light coding method for depth detection.

The basic scheme provided by the invention is as follows: the structured light coding method for depth detection adopts columnar figures to respectively form a coding graphic element and a phase graphic element without gaps between the two graphic elements; the coding primitive and the phase primitive are both composed of A color and B color.

The working principle and the advantages of the invention are as follows:

compared with the existing structured light coding method, the scheme only adopts two colors to respectively form the coding unit and the phase unit, can form a structured light coding and decoding method with binaryzation, pixel-by-pixel, single image and large coding amount support, and effectively overcomes the defects of the existing structured light coding method.

Further, when forming the coding primitive, the column graph is equally divided into k parts, and then [ k/2] is arranged and combined]Filling the part area with color A and filling the rest area with color B to constructA coding primitive in which [ k/2]]Are integers.

And the coding primitives are conveniently and quickly formed.

Further, when forming the phase primitive, a columnar pattern having the same size as the encoded primitive is used, and the phase primitive has a different ratio of A color to B color ([ k/2]) to (k [ k/2 ]).

The formed coding primitive and phase primitive are both block pixel diagrams composed of A color and B color, which is convenient for the following scene application.

Further, in the present invention,in a sequence of coded primitives and pseudo-randomThe code characters are in one-to-one correspondence, and the code primitives are arranged into a basic code structure according to the sequence of the corresponding characters in the pseudo-random sequence, wherein the window size of the pseudo-random sequence is M.

It is facilitated to form the basic coding structure by coding the primitives.

Further, phase primitives are inserted into the basic coding structure in a manner of inserting one phase primitive every M coding primitives, and then the first k rows of the structured light coding pattern are constructed.

It is convenient to form the coding structure of the first k rows and then fill the logical structure of the entire structured light coding pattern by subsequent replication.

The invention also provides a structured light coding device for depth detection, which comprises

A coding unit determining module for equally dividing the columnar pattern into k parts and then arranging and combining [ k/2]]Filling the part area with color A and filling the rest area with color B to constructPlanting a coding primitive; and then, forming a phase primitive by adopting a columnar graph with the same size as the coding primitive, wherein the proportion of the color A to the color B in the phase primitive is equal to ([ k/2]])∶(k-[k/2]) Different;

the coding sequence generation module is used for arranging the coding primitives into a basic coding structure according to the sequence of corresponding characters in the pseudo-random sequence, wherein the window size of the pseudo-random sequence is M;

the structured light coding module inserts phase primitives into the basic coding structure in a mode of inserting one phase primitive every M coding primitives so as to construct the first k lines of the structured light coding pattern; copying and filling the structured light coding pattern of the first k lines into the lines from the n multiplied by k +1 to the (n +1) multiplied by k lines to construct a logic structure diagram of the coding pattern.

The device has the advantages that:

the device can quickly form the structured light code, and compared with the existing coding device, the device adopts the colors A and B to form the binary property, and the cylindrical graph is divided to form the pixel-shaped structure of a square block, so that the structured light code can be quickly constructed and formed by binaryzation, pixel-by-pixel, single image and large-coding-quantity supporting method.

The invention also provides a structured light decoding method for depth detection, which comprises the following steps: determining boundary points among different lines from a structured light pattern; determining the width of each line according to the positions of boundary points on two sides of each line; analyzing the front k lines and the n multiplied by k +1 to (n +1) multiplied by k lines of the structured light pattern according to the k lines arrayed along the Y-axis direction; and fourthly, analyzing the basic column codes corresponding to any adjacent M +1 basic coding units according to the repeated contents in the first k rows and the (n + k +1) th to (n +1) x k rows, and obtaining the code sequence of the structured light according to the basic column codes.

The method has the advantages that:

by the method, the structured light code formed by the construction can be quickly decoded, and the method is suitable for being applied to different shooting scenes.

Furthermore, the encoding sequence of the encoding primitive and the phase primitive is analyzed according to the basic encoding, and a phase primitive is inserted into every M encoding primitives.

And analyzing the coding primitive and the phase primitive from the basic coding, wherein the phase primitive plays a role in positioning.

Further, the encoding primitive and the phase primitive are parsed into bar graphs formed of a color and B color, respectively.

It is convenient to parse a single encoding primitive and phase primitive.

The invention also provides a structured light decoding device for depth detection, which comprises

The boundary point determining module is used for determining boundary points among different lines from the structured light pattern;

the line width determining module is used for determining the width of each line according to the positions of boundary points on two sides of each line;

the coding unit analysis module is used for analyzing the front k lines and the n multiplied by k +1 to the (n +1) multiplied by k lines of the structured light pattern according to the width change among the k lines arranged according to the set sequence;

and the coded sequence analysis module is used for analyzing basic column codes corresponding to any adjacent M +1 basic coding units according to contents repeated in the first k rows and the (n + k +1) th x k rows to obtain the coded sequence of the structured light according to the basic column codes.

The device has the advantages that:

by adopting the device, the decoding operation can be rapidly carried out on the structured light code formed by the structure, and the device is convenient to apply and popularize to different shooting projection scenes.

Drawings

Fig. 1 is a schematic diagram of a structured light encoding pattern with grid lines according to a first embodiment of the present invention.

Fig. 2 shows a pattern used for actually projecting the structured light encoding pattern according to the first embodiment of the present invention.

Fig. 3 shows 11 basic graphic elements used in fig. 1 and 2.

FIG. 4 is a partial pattern of a structured light encoding pattern according to a first embodiment of the present invention.

FIG. 5 is a partial pattern of the structured light encoding pattern of FIG. 4 shifted down one unit.

FIG. 6 is a partial pattern of the structured light encoding pattern formed after the rightmost phase element of FIG. 3 is added to the left side of FIG. 4.

FIG. 7 is a partial pattern of the structured light encoding pattern of FIG. 6 shifted down one unit.

FIG. 8 is a partial pattern of the structured light encoding pattern of the extended window of FIG. 6.

FIG. 9 is a partial pattern of the structured light encoding pattern of the extended window of FIG. 7.

FIG. 10 is a schematic diagram of the second 5 rows of the coding pattern with grid lines according to the embodiment of the present invention.

Fig. 11 is a schematic view illustrating an installation and use of a structured light pattern according to a second embodiment of the present invention.

Detailed Description

The following is further detailed by the specific embodiments:

example one

An embodiment substantially as shown in figure 1: the embodiment provides a structured light coding and decoding method which is used for single image, binaryzation, high density, multiple coding columns and no need of extra calibration patterns.

In the structured light encoding method for depth detection in the embodiment, a columnar graph is adopted to respectively form an encoding primitive and a phase primitive without a gap therebetween; the coding primitive and the phase primitive are both composed of A color and B color. In this embodiment, the color a is black and the color B is white.

When forming coding graphic element, first equally dividing the columnar graph into k parts, then arranging and combining [ k/2]]Filling the part area with color A and filling the rest area with color B to constructA coding primitive in which [ k/2]]Is an integer. Symbol [ k/2]]Representing rounding of the number k/2, signIs a symbol representing the number of permutation combinations. In this example, k is 5, the bar graph is equally divided into 5 parts, each part occupies one row, [ k/2]]2 is given byAnd encoding the primitive.

When forming the phase primitive, a columnar pattern with the same size as the encoding primitive is used, and the ratio of the color a and the color B in the phase primitive is different from ([ k/2]): 3 are different.

In a sequence of coded primitives and pseudo-randomThe code characters are in one-to-one correspondence, and the code primitives are arranged into a basic code structure according to the sequence of the corresponding characters in the pseudo-random sequence, wherein the window size of the pseudo-random sequence is M. In the present embodiment, the first and second electrodes,in a sequence of coded primitives and pseudo-randomThe encoding characters are in one-to-one correspondence, and encoding primitives are arranged into a basic encoding structure according to the sequence of the corresponding characters in a pseudo-random sequence, wherein the window size of the pseudo-random sequence is M-5.

Phase primitives are inserted into the basic coding structure in such a way that one phase primitive is inserted every M-5 coding primitives, and the first 5 rows of the structured light coding pattern are constructed (where 5 corresponds to k-5).

The structured light coding device for depth detection obtained by the coding method can carry out structured light coding permanently. The structured light coding device for depth detection comprises a coding unit determining module, a coding sequence generating module and a structured light coding module.

A coding unit determining module for equally dividing the columnar pattern into k parts and then arranging and combining [ k/2]]Filling the part area with color A and filling the rest area with color B to constructPlanting a coding primitive; then, a columnar graph with the same size as the encoding graph element is adopted to form a phase graph element, and the proportion of the color A to the color B in the phase graph element is equal to ([ k/2]]):(k-[k/2]) Different;

the coding sequence generation module is used for arranging the coding primitives into a basic coding structure according to the sequence of corresponding characters in the pseudo-random sequence, wherein the window size of the pseudo-random sequence is M;

the structured light coding module inserts phase primitives into the basic coding structure in a mode of inserting one phase primitive every M coding primitives so as to construct the first k lines of the structured light coding pattern; copying and filling the structured light coding pattern of the first k lines into the lines from the n multiplied by k +1 to the (n +1) multiplied by k lines to construct a logic structure diagram of the coding pattern.

In this embodiment, k is selected to be 5 for encoding, and the first 5 lines of the structured light encoding are usedThe different binarization stripes with limited length are used as picture composition graphic elements of the coding pattern, and each binarization stripe is composed of two different colors. In the present embodiment, it is preferred that,has a calculation result of 10, i.e., the present embodiment usesAnd binary stripes with different finite lengths are taken as composition primitives of the coding pattern. In the embodiment, the two colors in the binary stripe are represented by the black color and the white colorIn the seed binary stripe, frontThe proportion of black color and white color of the seed stripe is the same, but the distribution positions of the black color and the white color in the stripe are different. Before the coding method is usedIn the binary stripe, the proportion of black color is as follows: [5/2]And 5, the proportion of white color is as follows: 1- [5/2]The encoding device uses a ratio of black color to white color of (2/5): (3/5) ═ 2:3, and the ratio of black color to white color in the last 1 stripes to be used in the encoding device is equal to that in the first stripeThe binary stripes are different. Front of the coding deviceThe two-valued stripe is used for coding the column number of the image, and the last two-valued stripe is used for coding the row phase of the image. The binary stripe of the coding patternThere is no gap between the substrings, the binarization stripes are arranged according to the order of the pseudorandom sequence, each substring with the length of M +1, in this embodiment, the substring with the length of 5+1, is unique, and each substring with the length of 5+1 includes a phase code symbol, that is, each substring includes a phase primitive. The code pattern is a pseudo-random pattern in the horizontal axis direction and a periodic pattern in the vertical axis direction, and the period size is an integral multiple of 5.

In this embodiment, the window size is 6 × 5, in this embodiment, M is just set to 5, and if M +1 is 6 pairs, the window size of the pseudorandom sequence is 6 × 5, the value of M is not necessarily linked to the value of k, and a part of the encoding patterns are shown in fig. 1 and fig. 2. Fig. 1 is a schematic diagram with grid lines, and fig. 2 is a pattern used in actual projection. In generating FIGS. 1 and 2, use is madeEach code character generates a deBruijn sequence (a pseudo-random sequence), the window size set at the time of generation is 5, and the length of the generated deBruijn sequence is 10000. Here, we set the window size M to 5 in order to make the decoding window as close to a square as possible, and the window size does not necessarily have to be combined with the permutation numberWherein k is 5. After the de bruijn sequence is generated, a phase code symbol is inserted into each code sequence in such a manner that a phase code symbol is inserted every 5 code characters (where "5" is the same as M ═ 5 set in the window size set previously). And after the code characters and the phase code characters are in one-to-one correspondence with the 11 bar patterns, the code patterns are formed in a replacement mode. One of the basic features of the coding pattern is: along the X-axis, the coding pattern is a pseudo-random coding pattern (achieved by a deBruijn sequence); along the Y-axis direction, the coding pattern is a periodic image, and the period size of the image is proportional to the coding window size of the deBruijn sequence; the phase-code pattern functions to locate the phase of the sub-image in the Y-axis. The window size of the new deBruijn sequence isM +1 equals 6, and the total length is 12000, 12000 code columns can be coded.

The structured light coding pattern shown in fig. 1 and 2 is a coding pattern with a window size of 6 × 5, the coding pattern comprisingBasic elements (composition primitives) of 1 type, each corresponding to an encoding character. Front sideThe seed code symbol is used as the code character of the de Bruijn sequence, the last code character is used as the phase code symbol, and the code symbol is inserted into the de Bruijn sequence after the de Bruijn sequence is generated. The 11 basic elements used in fig. 1 and 2 are shown in fig. 3. Fig. 3 contains 11 kinds of bar graphs, the gray part of the bar graph is white color in actual projection, and the reason why gray is used in the document is that: the background color of the document is a white color, and in order to enable normal display of the binarization pattern in the document, a gray color is used instead of a white color region in the binarization pattern.

In fig. 3, the white color portion of the remaining pattern is 60% except for the white color area of the last stripe which is 20%. The composition method of the first 10 cylindrical patterns (coding primitives) in fig. 3 is as follows: the column-shaped area is divided into 5 parts, 2 parts of the column-shaped area are selected to be black color by using a permutation and combination mode, and the rest part of the column-shaped area is white color. The composition mode of the last 1 cylindrical pattern (phase primitive) is as follows: the columnar areas were divided equally into 5 parts, and 3 consecutive parts were selected as black. In fig. 3, we choose to make the last 3 parts of the columnar area black, which is a natural way of choosing. In fig. 3, the first 10 columnar patterns correspond to the code characters of pseudo-random code (de bruijn sequence) one by one, and the 11 th pattern is inserted before the code pattern as a phase feature pattern in the Y direction in such a manner that one is inserted for every 5 code patterns.

The black-white pixel ratio is set in fig. 3 using a 2:3 approach, which is set for the reason: when the ratio of black and white pixels is about 50%, the brightness of the image is relatively uniform, and the ratio of black and white pixels is approximately equal. When the proportion of black and white in the image is approximately equal, the effect of using the OTSU algorithm to carry out image binarization is better, and the segmentation result is more stable. Since the phase map elements need to use different black-white pixel ratios, the ratio of black-white pixels is set in a 3:2 manner in fig. 3. If the columnar area is divided into 6 parts equally, the black-white pixel proportion of the coding primitive should be set in a 3:3 manner; if the column area is divided into 6 parts, the phase primitive should use different black and white pixel ratio, and in order to make the image brightness as uniform as possible, the column pattern corresponding to the phase code symbol can be constructed by using the black and white pixel ratio of 2:4 or 4: 2. In fig. 3, the proportions of black and white pixels are interchangeable and the brightness uniformity characteristic of the coding pattern is not affected.

Typically, we use odd (e.g., 3, 5, 7, etc.) window sizes in performing feature recognition. This is because, when feature recognition is performed based on the window center point, the odd-numbered windows extend from the center point to the left and right in equal sizes, which facilitates image recognition. In addition, when the stripes are divided into k parts, the shape of each part should be set as square as much as possible, so that the pattern has less variation when projected on a tilted or uneven surface, and is easy to identify. If the window size of the new de Bruijn sequence itself is not odd, one cell may be expanded to the right (or left), the window size changed to odd, and feature recognition performed. As the permutation and combination of continuous M +1 characters in the new de Bruijn sequence is unique, the permutation and combination of continuous M +2 characters is also unique, and the expansion window does not influence the characteristic identification process.

In our earlier design we did not add phase-code symbols to the de bruijn sequence at the outset, but when we replaced the code symbols in the de bruijn sequence with the first 10 primitives in fig. 3 we found: the coding pattern of fig. 5 can be obtained by shifting the pattern of fig. 4 downward by one unit (one unit refers to one black grid or one white grid in fig. 1), and the character string sequences corresponding to all the graphs of fig. 4 and 5 exist in the de bruijn sequence, and the positions of the character string sequences are different from the positions of the character string sequences corresponding to fig. 4. This means that: if no phase primitive is inserted for locating the Y-axis phase, then the code patterns identified on the different phases on the Y-axis will not be able to locate the same position in the de Bruijn sequence. To solve this problem we add the rightmost phase primitive of fig. 3 to the left side of fig. 4, resulting in the pattern of fig. 6. After the pattern of fig. 6 is shifted down by one unit, the pattern of fig. 7 can be obtained, and due to the existence of the phase identification pattern (phase primitive), the images of fig. 6 and 7 can be located at the same position in the de bruijn sequence after being successfully recognized. Of course, this actually requires adding some class numbers in the neural network classifier. Inserting a fixed extra character 5 apart in a de Bruijn string with a window size of 5 would result in the window size becoming 6. This is because in the new de Bruijn string, every 6 consecutive characters must contain 5 consecutive characters in the original de Bruijn string, and the 5 consecutive characters in the original de Bruijn string are unique, so that the consecutive 6 strings in the new de Bruijn string are unique, i.e., the window size of the new de Bruijn string is 6. In the new de Bruijn string, each sub-string of length 5+1 is unique, and each sub-string of length 5+1 contains a phase-code symbol.

Although the window size in fig. 6 and 7 is 6 × 5, we extend it to 7 × 5 windows (i.e., the odd window size we suggest) when we use neural networks for pattern recognition, and then recognize the pattern. As shown in fig. 8 and 9: after expanding the window by one unit to the right, the uniqueness of the pattern does not change, because if every 6 character combination is unique in a de Bruijn sequence, then the combination of 7 consecutive characters is unique. The purpose of the extended windows is to make the size of the whole sub-image block symmetrical left and right relative to the central point, so that the image is convenient to intercept for identification. If the window size itself is even when constructing the de Bruijn sequence, the window of the new de Bruijn sequence after adding the Y-axis phase-code symbol is odd, which makes it unnecessary to extend the window of the recognizer. We note that: in both cases (the new de Bruijn sequence window is odd or even), we can use the odd window we propose for feature recognition.

Since our encoding method is a periodic image on the Y-axis, the size of the texture period (in pixels) can be calculated periodically from the texture in the projection direction of the projector Y-axis on the image actually captured by the camera. Here, the projection directions of the X-axis and the Y-axis of the projector are intrinsic parameters of the camera-projector system, and the projection directions of the X-axis and the Y-axis of the projector can be determined in a geometric calibration process of the camera-projector system, which will be described in detail later. Since the image period size is proportional to the encoding window size, the input image required by the neural network recognizer can be determined directly by the periodicity of the texture. The specific process of calculating the periodicity of the texture is as follows: firstly, carrying out binarization on an image shot by a camera; translating pixel by pixel up and down along the projection direction of the Y axis of the projector, and then recording the absolute value of image difference during each translation; finding the trough of the image difference by using a findpeaks function in the signal processing tool box; and fourthly, calculating the period of the signal through the troughs of the image difference (the period is in pixel units). After the period of the signal is calculated, the input image size of the neural network recognizer is determined according to the relationship between the period and the coding pattern (i.e. how large an image needs to be cut out on the image taken by the camera as the input of the neural network recognizer). After the size of the input image is determined, the local image shot by the camera is corrected according to the projection directions of the X axis and the Y axis of the projector, then each pixel point on the image of the camera is taken as the center, the image is intercepted according to the size of the input image, and the corresponding position of the image in the coding pattern is identified.

The proposed structured light codec method requires the use of a digital projector when constructing the decoder, but after the decoder construction is completed, the digital projector is no longer required. After the decoder construction is complete, a film-type projection device can be used instead of a digital projector. The method we propose can be deployed on printed clear PVC media, clear glass media or other media. The proposed structured light codec method constructs the decoder as follows: firstly, constructing horizontal and longitudinal gray code coding patterns with proper sizes according to the resolution ratio of a projector; projecting the constructed horizontal and longitudinal Gray code coding patterns into a scene by a projector in sequence, and shooting the scene after the patterns are projected by a camera in sequence; the projector projects the structured light pattern proposed by us, as shown in fig. 2, and then the camera shoots the scene behind the projected pattern; fourthly, calculating the relation of the matching points on the images of the camera and the projector by using a decoding method of the Gray code; for the structured light pattern, calculating the image period in the Y-axis direction by using the period detection method, and calculating the window size required for decoding the actually shot image according to the image period; sixthly, taking the position of the matching point calculated by the Gray code method as a correct classification result, and training the neural network classifier by using the window size calculated by the fifth step. After the neural network classifier is constructed, the coordinates of the matching points of each point on the image of the camera can be calculated by looking up the table according to the classification result of the neural network classifier (only the horizontal coordinates of the matching points need to be calculated). As long as a neural network classifier that is sufficiently trained on a camera-projector system is available, the classifier can be used to identify the coding pattern of a camera-projector system having a similar structure. This is because the neural network recognizer scales the input image to a uniform size and then classifies it. Therefore, when the coding and decoding method proposed by us is deployed on an actual system, a relative rotation axis of a camera-projector system of a final system is designed, then a camera-projector system with a rotation axis close to the final system is constructed based on a digital projector, and a neural network decoder is manufactured based on the digital projector. Since the neural network decoder will zoom the input image to a certain fixed size, the translation of the projector-camera system has no influence on the manufacture of the neural network decoder, and in addition, when the difference between the horizontal and longitudinal focal lengths of the camera is not large and the difference between the horizontal and longitudinal focal lengths of the projector is not large, the internal parameters of the camera and the projector have no influence on the manufacture of the decoder.

After the decoder is manufactured, the final camera-projector system can be calibrated. The Calibration algorithm can be referred to a paper A Pattern and Calibration Method for Single Pattern Structured Light System which we have published before. In this paper, we systematically describe how to calibrate the camera-projector system when only the vertical stripe codes are available. In this paper, we propose a single image structured light coding method based on color images, and have successfully deployed and tested on a prototype system based on film projectors. Unlike the method in this paper, we now propose a method that is based on a binary image encoding method, and we successfully encode the window size into the structured light pattern. We consider that: the success rate of recognition can be improved, the system cost can be reduced, and the applicability of the coding method can be improved by coding through the binary image. In our previous paper, we calculated the window size required to classify each encoded point by a series of map segmentation thresholds. In our present coding pattern, the window size is calculated from the longitudinal periodicity of the image. Our encoding patterns now have a higher encoding density than the encoding patterns in this paper. Theoretically, our present coding pattern is capable of coding at most every pixel on the projector image, whereas the coding pattern in this paper is theoretically capable of coding at most only 1/3 pixels on the projector image.

We trained the neural network recognizer with a digital projector and then calibrated the camera-projector system using a checkerboard based structured light system calibration method. And identifying the column number corresponding to each pixel point in the coding pattern on the image shot by the camera by using the trained neural network identifier. And finally, calculating a depth map through the calibration parameters of the structured light system and the identified column numbers.

Example two

In this embodiment, the value of the window size M is 3, and the value of k is 5, in which case the input pattern of the neural network recognizer is square, so that the information content of the structured light code constructed by the method is more appropriate.

When k is 5, the structure can be constructed by the methodThe method comprises the following steps of encoding primitives and constructing 1 phase primitive, wherein each columnar primitive occupies 5 pixels, and 11 constructed primitives are shown in FIG. 3. When M is 3 and the number of coding primitives is 10, the length of the de bruijn sequence (i.e. the pseudo-random sequence in claim 4) constructed by the existing algorithm is 1000. After generating the pseudo-random sequence, a basic coding structure is constructed according to the method of claim 4 and phase map elements are inserted into the basic coding structure according to the method of claim 5. In this embodiment, the window size M of the pseudorandom sequence is 3, so when inserting a phase primitive, one phase primitive is inserted every 3 coding primitives. After the phase primitives are inserted, the first 5 rows of the structured light encoded pattern are constructed. A schematic diagram of the first 5 rows of the structured light encoding pattern constructed in this embodiment is shown in fig. 10. Fig. 10 is only a part of the schematic diagram of the first 5 lines in this embodiment, and the full size of the image of the first 5 lines in this embodiment is 1333 × 5.

Starting from line 6 of the structured light image, the structured light coding pattern of the first 5 lines is copied and filled into lines 6 to 10, lines 11 to 15, lines 16 to 20, … according to the method of claim 6 until the filling of the last line of the structured light image is completed. Thus, the structured light encoding pattern is constructed.

As shown in fig. 11, the structured light coding pattern is printed on a transparent PVC medium, the PVC medium is pasted on a transparent plastic sheet, and then the transparent plastic sheet with the coding pattern pasted is installed in a projection device of the structured light system.

After the coding pattern is installed in the projection device, the coding pattern is projected onto the surface of the object by the built-in light source of the projection device, and then an image of the entire scene is taken by the camera in the structured light system. After shooting is completed, a depth map of the whole scene can be calculated by using a software algorithm. When the depth map is calculated, firstly, the image shot by the camera is binarized by using an OTSU algorithm, then, the image is translated up and down pixel by pixel along the projection direction of the Y axis of the projector, and the absolute value of the image difference in each translation is recorded. Then the findpeaks function in the signal processing toolbox is used to find the valleys of the image difference, and the period of the signal is calculated by the valleys of the image difference (the period is in pixels). After the period of the signal is calculated, the input image size of the neural network recognizer is determined according to the relationship between the period and the coding pattern (i.e. how large an image needs to be cut on the image taken by the camera as the input of the neural network recognizer). After the size of the input image is determined, the local image shot by the camera is corrected according to the projection directions of the X axis and the Y axis of the projector, then each pixel point on the image of the camera is taken as the center, the image is intercepted according to the size of the input image, and the corresponding position of the image in the coding pattern is identified. After the corresponding position of each pixel point on the image shot by the camera in the coding pattern is determined, the depth map of the position can be calculated through the calibration parameters of the structured light system. Calibration parameters for Structured Light systems were calculated by the methods and procedures described in the paper A Pattern and Calibration Method for Single Pattern Structured Light System.

The foregoing is merely an example of the present invention, and common general knowledge in the field of known specific structures and characteristics of the embodiments has not been described in detail, so that a person of ordinary skill in the art can understand all the common technical knowledge in the field of the invention before the application date or the priority date, can know all the prior art in the field, and have the ability to apply routine experimentation before the application date. It should be noted that, for those skilled in the art, without departing from the structure of the present invention, several changes and modifications can be made, which should also be regarded as the protection scope of the present invention, and these will not affect the effect of the implementation of the present invention and the practicability of the patent. The scope of the claims of the present application shall be determined by the contents of the claims, and the description of the embodiments and the like in the specification shall be used to explain the contents of the claims.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种集成共焦法与三角法的探路式测头装置及其测量方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!