A three-dimensional measurement method based on a modified gray code pattern
By improving the Gray code pattern generation method, the problems of long measurement time and low accuracy in traditional structured light 3D measurement in high dynamic range scenarios are solved, and high-speed, high-precision 3D measurement is realized.
Patent Information
- Application Number
- CN202310261665.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-16
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-03-16
AI Technical Summary
Traditional structured light 3D measurement technology is prone to camera image saturation or underexposure in high dynamic range scenarios, especially in areas with large reflectivity variations. This results in excessively long measurement times and low accuracy, making it difficult to meet the needs of high-speed measurement.
A modified Gray code pattern is used. By generating a Gray code sequence with the narrowest stripe width greater than a set threshold, and combining it with a structured light projection device for projection and image acquisition, the three-dimensional coordinates are calculated using the triangulation principle.
It enables high-speed, high-dynamic-range 3D measurement, reduces the risk of decoding errors, and improves measurement accuracy and speed.
Smart Images

Figure CN116295115B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of structured light three-dimensional measurement technology, and particularly to a three-dimensional measurement method based on improved Gray code patterns. BACKGROUND
[0002] As a high-precision optical three-dimensional measurement technology, structured light three-dimensional measurement technology is widely used in industrial manufacturing, medical treatment, entertainment, cultural relic protection and other fields due to its non-contact, full-field scanning, high resolution and other advantages. The basic principle is to project controllable light spots, light bars or fringe patterns onto the surface of the measured object by a structured light projection device, and to collect images by an image sensor (such as an industrial camera), and to calculate the three-dimensional coordinates of the object surface by using the geometric relationship of the system and the principle of triangle.
[0003] However, when measuring some high dynamic range scenes, the reflectivity of the measured object surface changes greatly, and the technology still faces problems, such as the connecting piece of the battery shell cover, which includes an aluminum alloy base area with high reflectivity and a black plastic connecting piece area with low reflectivity. When the image is collected, the aluminum alloy base area is too bright to cause the camera image to be saturated, and the black plastic connecting piece area is too dark to cause the camera to be unable to image.
[0004] In view of this problem, patent CN101694375A discloses a method of combining bright and dark fringe projection with multi-exposure time image collection to synthesize high dynamic range fringe images, which can realize three-dimensional measurement of strong reflection surfaces such as metals. However, this method using multiple exposure times needs to project and collect a large number of fringe patterns, which will result in too much time consumption for measurement. Because the traditional structured light three-dimensional measurement technology uses sinusoidal fringe patterns to solve the phase, assuming that a typical 4-step phase shift method and 3-frequency heterodyne are used, a total of 4 steps * 3 frequencies = 12 sinusoidal fringe patterns are required. In addition, for high dynamic range scenes, assuming that 4 exposure times are used, a total of 12 * 4 = 48 sinusoidal fringe patterns are required. Most of the existing structured light pattern projection devices are based on DMD (Digital Micromirror Device) chips of Texas Instruments, and for example, the maximum refresh rate of an 8-bit sinusoidal fringe pattern projected by a commonly used DLP4500 chip is 120Hz. Therefore, the total time required for projecting 48 sinusoidal fringe patterns is 1 / 120*48 = 400ms, that is, the time required for projecting the fringe pattern during measurement is 400ms. In addition to the time required for fringe image collection, phase calculation and three-dimensional coordinate calculation, the measurement time will be difficult to meet the demand of high-speed three-dimensional measurement.
[0005] It is noted that the refresh rate of the DMD chip projecting a 1-bit (black and white, 2 gray levels) pattern is much higher than that of an 8-bit (256 gray levels) sinusoidal fringe pattern, for example, the maximum refresh rate of the DLP4500 chip projecting a 1-bit pattern is as high as 4225Hz, which is 35.2 times that of an 8-bit sinusoidal fringe pattern. If a binary pattern is used for projection in a structured light three-dimensional measurement system, the time-consuming of the measurement can be greatly reduced. Moreover, since a binary pattern only uses two gray values (0 and 255) to represent digital 0 and 1, it has better noise robustness for high dynamic range measurement scenes compared with a sinusoidal fringe pattern. Gray code is a kind of cyclic binary code, and its Hamming distance is 1, so it has better noise resistance than binary code; in addition, the width of the narrowest stripe of the black and white stripe pattern encoded by the gray code is exactly twice that of the binary code. Therefore, the traditional structured light three-dimensional measurement system also uses gray code to encode the pattern more, Figure 1 A black and white stripe pattern encoded by a 7-bit gray code is shown.
[0006] However, for the traditional gray code pattern, that is, Figure 1 The black and white stripe pattern shown, although the highest bit (G6) black and white stripe has a large width, the width of the lowest bit (G0) black and white stripe is only 2 pixels wide. When the 2-pixel-wide black and white stripe is projected to a high-reflectivity area, surface mutual reflection and subsurface scattering are likely to occur, which affects the gray value of the stripe image pixel and further affects the phase calculation and measurement accuracy. As shown in Figure 2 The gray value of the 2-pixel-wide black stripe is obviously affected by the scattering of the white stripe, and the edge part of the black stripe has turned white, which may cause the error of misjudging digital 0 as 1 during decoding, resulting in failure of three-dimensional coordinate calculation.
[0007] Therefore, it is necessary to design a gray code pattern for high-speed high dynamic range three-dimensional measurement. SUMMARY
[0008] Based on this, the purpose of the present application is to provide a three-dimensional measurement method based on an improved gray code pattern, which can realize high-speed high dynamic range three-dimensional measurement and reduce the risk of decoding errors.
[0009] The present application provides a three-dimensional measurement method based on an improved gray code pattern, which comprises the following steps:
[0010] S1: determining the number of gray code bits n=x required for three-dimensional measurement of the object to be measured;
[0011] S2: generate a transform sequence of n=x bits, and convert the transform sequence into a Gray code sequence, and after representing the Gray code sequence by black and white stripes, obtain a to-be-projected Gray code pattern, wherein a narrowest stripe width of the to-be-projected Gray code pattern is greater than a set threshold;
[0012] S3: project the to-be-projected Gray code pattern on the object to be measured by a structured light projection device;
[0013] S4: collect a surface stripe image of the object to be measured, and calculate a three-dimensional coordinate of the object to be measured according to the surface stripe image by using a triangular principle.
[0014] Further, in step S2, the generation of a transform sequence of n=x bits, and the conversion of the transform sequence into a Gray code sequence, and the representation of the Gray code sequence by black and white stripes to obtain a to-be-projected Gray code pattern, comprises:
[0015] S21: when x≤6, generate a transform sequence of length 2 x by an exhaustive method, and convert the transform sequence into a Gray code sequence, and represent the Gray code sequence by black and white stripes to obtain a corresponding Gray code pattern, and select a target Gray code pattern with a narrowest stripe width greater than a set threshold in the Gray code pattern as the to-be-projected Gray code pattern;
[0016] S22: when x>6, execute step S21 to obtain target Gray code patterns and transform sequences thereof when n=2,...,6;
[0017] S23: split x=7 into two integers a and b, satisfying x=a+b, a≥b≥1, obtain transform sequences A and B of target Gray code patterns when n=a and n=b, and narrowest stripe widths g A and g B of the target Gray code patterns when n=a and n=b;
[0018] S24: select two odd numbers s and t, satisfying s+t=2 b ;
[0019] S25: repeat steps S23-S24 to find the most suitable integers a, b and odd numbers s, t, so that is the smallest;
[0020] S26: construct a sequence P of length 2 b , the first element of the sequence P is b', and a' is added after b', so that a' satisfies if (the number of a'+the number of b')<2 bthen a second b' is added subsequently, and a' satisfying the above formula is added after the second b', until the sequence P contains t b's and s a's;
[0021] S27: Copy 2 a sequences P, generating a sequence of length 2 x sequences of (x=a+b)
[0022] S28: Replace the elements b' in the sequence Z by adding a to each element in the transformed sequence B of the target Gray code pattern of n=b bits, and replace the elements a' in the sequence Z by the transformed sequence A of the target Gray code pattern of n=a bits, generating the transformed sequence T of the target Gray code pattern of n=7 bits, and convert the transformed sequence T into a Gray code sequence, after the Gray code sequence is represented by black and white stripes, the target Gray code pattern of n=7 bits is obtained, and the narrowest stripe width g is obtained;
[0023] S29: Repeat steps S23-S28 to obtain the transformed sequence of the target Gray code pattern of n=8,..., x, and convert the transformed sequence of n=x bits into a Gray code sequence, after the Gray code sequence is represented by black and white stripes, the target Gray code pattern of n=x bits is obtained.
[0024] Further, in step S3, the target Gray code pattern is projected onto the object to be measured by a structured light projection device, comprising:
[0025] Extracting each row of stripe patterns in the target Gray code pattern;
[0026] Projecting the stripe patterns respectively.
[0027] The three-dimensional measurement method based on the improved Gray code pattern provided in the present application can project the improved Gray code pattern onto the object to be measured, so that the structured light projection device can project a 1-bit (black and white binary coded stripe) pattern, thereby realizing high-speed three-dimensional measurement. Moreover, the narrowest stripe width in the improved Gray code pattern has a certain width, which can avoid the problem of decoding error caused by the narrowest stripe width being too narrow and the surface reflectivity of the object to be measured being too large, and the surface mutual reflection and the scattering of the subsurface. In addition, the present application also provides a method for generating an improved Gray code pattern, which can generate a Gray code pattern with a certain width, and is suitable for high-speed and high-dynamic-range three-dimensional measurement.
[0028] In order to better understand and implement, the present application is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0029] Figure 1 is the conventional Gray code pattern of n=7 bits in the prior art;
[0030] Figure 2 A black and white stripe image of G0 row (the narrowest stripe width is 2 pixel width) in a conventional Gray code pattern when n=7 in the prior art;
[0031] Figure 3 A step schematic diagram of a three-dimensional measurement method based on a modified Gray code pattern in an embodiment of the present application;
[0032] Figure 4 A conventional Gray code sequence schematic diagram when n=5 in the prior art;
[0033] Figure 5 A Gray code sequence schematic diagram when n=5 in a three-dimensional measurement method based on a modified Gray code pattern in an embodiment of the present application;
[0034] Figure 6 A black and white stripe image of G0 row (the narrowest stripe width is 5 pixel width) in a Gray code pattern obtained by a three-dimensional measurement method based on a modified Gray code pattern in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the objects, technical solutions and advantages of the present application clearer, the following will further describe the embodiments of the present application with reference to the drawings.
[0036] It should be clear that the described embodiments are only some of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0037] The terms used in the present application are only for the purpose of describing the specific embodiments, and are not intended to limit the present application. The singular forms "a", "an" and "the" used in the present application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein means and includes any or all possible combinations of one or more associated listed items.
[0038] The following description refers to the accompanying drawings. Unless otherwise noted, like elements in different drawings have the same or similar notation, and the same or similar elements in different drawings are represented with the same or similar references. The following description of exemplary embodiments is not representative of all possible embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims. In the description of the present application, it should be understood that the terms "first", "second", "third", etc., merely identify similar objects, and are not necessarily indicative of a particular order or sequence, nor are they to be interpreted as indicating or implying relative importance. The specific meaning of the above terms in the present application can be understood according to the specific circumstances by those of ordinary skill in the art.
[0039] In addition, in the description of the present application, "multiple" refers to two or more, unless otherwise stated. The association between the associated objects described by "and / or" indicates that there can be three relationships, for example, A and / or B can represent the three cases of A alone, A and B together, and B alone. The character " / " generally represents that the associated objects before and after are in an "or" relationship.
[0040] To solve the technical problems mentioned in the background art, the embodiments of the present application provide a three-dimensional measurement method based on a modified Gray code pattern, which can be applied to high-speed and high-dynamic range three-dimensional measurement scenes, such as Figure 3 As shown in the figure, the method comprises the following steps:
[0041] S1: Determine the number of Gray code bits n=x required for three-dimensional measurement of the object to be measured.
[0042] The number of Gray code bits is determined by the resolution of the DMD chip, for example, the resolution is 1024, and 10-bit Gray code is required for encoding, and the n=10-bit Gray code sequence has G0-G9 ten rows after being converted into a Gray code pattern, with each row as a pattern, to obtain ten complete Gray code patterns to be projected. As shown in the figure, Figure 1 As shown in the figure, Figure 1 is a traditional Gray code pattern with n=7 bits, the narrowest stripe width appears in the lowest bit (G0), and the width is only 2 pixels wide. Projecting the G0 row pattern on the object to be measured obtains Figure 2 the object fringe image.
[0043] S2: Generate a n=x-bit conversion sequence, and convert the conversion sequence into a Gray code sequence. After characterizing the Gray code sequence by black and white stripes, a Gray code pattern to be projected is obtained, wherein the narrowest stripe width of the Gray code pattern to be projected is greater than a set threshold.
[0044] The Gray code sequence is a kind of encoding in which only one binary number is different between any adjacent code words, and the code words of the traditional Gray code generally change in a certain order, such asFigure 4 As shown. Figure 4 For a traditional Gray code sequence with n=5 bits, it can be seen that any two adjacent codewords differ by only one binary digit, and this change occurs gradually from row G0 to row G4. The elements in the transformation sequence represent the row number in which the subsequent codeword changes relative to the previous codeword.
[0045] The traditional Gray code sequence is represented by black and white stripes, with black stripes representing "0" and white stripes representing "1", resulting in a traditional Gray code pattern with a minimum stripe width of 2 pixels. Because this traditional Gray code changes in a specific order, the minimum stripe width in row G0 is always 2 pixels, making it unsuitable for high-speed, high-dynamic-range 3D measurements.
[0046] S3: Project the Gray code pattern to be projected onto the object to be tested using a structured light projection device.
[0047] The process of projecting the Gray code pattern onto the object to be tested using a structured light projection device includes:
[0048] Extract each row of stripes from the Gray code pattern to be projected;
[0049] The stripe patterns are projected separately.
[0050] S4: Acquire a surface stripe image of the object to be tested, and calculate the three-dimensional coordinates of the object to be tested based on the surface stripe image using the triangulation principle.
[0051] In a preferred embodiment, in step S2, generating an n=x bit transformation sequence and converting the transformation sequence into a Gray code sequence, and after the Gray code sequence is characterized by black and white stripes, a Gray code pattern to be projected is obtained, wherein the narrowest stripe width of the Gray code pattern to be projected is greater than a set threshold, including:
[0052] S21: When x≤6, generate a length of 2 using exhaustive search. x The transformation sequence is obtained and transformed into a Gray code sequence. The Gray code sequence is represented by black and white stripes to obtain the corresponding Gray code pattern. The target Gray code pattern with the narrowest stripe width greater than a set threshold is selected as the Gray code pattern to be projected.
[0053] Since the elements in the transformation sequence are the row sequence numbers of the changes in the subsequent codeword relative to the previous codeword, the transformation sequence can be a permutation and combination of row sequence numbers. When n = 5 bits, the Gray code sequence includes rows G0 to G4, such that the transformation sequence is a combination of 0, 1, 2, 3, and 4. A length of 2... is generated by exhaustive search. 5The transformation sequence of each transformation sequence can be converted into a Gray code sequence, and after the Gray code sequence is characterized by black and white stripes, the corresponding Gray code pattern is obtained. The narrowest stripe width of the selected Gray code pattern is greater than the set threshold, so that it can be used for high-speed high-dynamic-range three-dimensional measurement, and the problem of subsurface scattering is avoided.
[0054] As shown in Figure 5 , Figure 5 The narrowest stripe width of the Gray code sequence found by the exhaustive method when n=5 is 4 pixels wide, and the transformation sequence is defined as (20312041302130412031204130213041). The "2" at the beginning represents the transformation of G2 bits "0" from the initial code word {0,0,0,0,0} to obtain the second code word {0,0,1,0,0}. The "0" in the next position represents the transformation of G0 bits to obtain the third code word {0,0,1,0,1}. In this way, 32 code words can be obtained, that is, the corresponding Gray code sequence. After the Gray code sequence is characterized by black and white stripes, the narrowest stripe width is 4 pixels wide, which is twice the width of the traditional Gray code pattern.
[0055] Please refer to Table 1 below. The transformation sequence of the selected target Gray code pattern is shown in Table 1. The narrowest stripe width of the Gray code pattern obtained by the transformation sequence in the table is significantly increased after n=5, so that the Gray code pattern can be applied to high-speed high-dynamic-range three-dimensional measurement. The transformation sequence obtained in the table is not the only transformation sequence for n=x bits. The table only represents a preferred transformation sequence. In other examples, different transformation sequences can be generated by the exhaustive method to obtain the same narrowest stripe width as shown in the table, or even wider transformation sequences.
[0056] Alternatively, all Gray code sequences can be traversed by permutation and combination to obtain Gray code sequences with a narrowest stripe width greater than a set threshold, thereby obtaining the transformation sequence of the Gray code sequence.
[0057] Number of bits n Narrowest stripe width (pixels) Transform sequence 2 2 0101 3 2 01020102 4 2 0123210203013231 5 4 20312041302130412031204130213041 6 4 0123450241320542314025342104352401234502413205423140253421043524
[0058] Table 1 Transformation sequence of selected target Gray code pattern (n≤6)
[0059] S22: When x>6, execute step S21 to obtain the target Gray code pattern and its transformation sequence when n=2,...,6;
[0060] S23: Split x=7 into two integers a and b, satisfying x=a+b, a≥b≥1, obtain the transformation sequence A and B of the target Gray code pattern when n=a and n=b, and the narrowest stripe width g A and gB ;
[0061] S24: Select two odd numbers s and t, satisfying s+t=2 b ;
[0062] S25: Repeat steps S23-S24 to find the best integers a, b and odd numbers s, t, satisfying min;
[0063] S26: Construct a sequence P with length 2 b , the first element in the sequence P is b', and add a' after the b', so that a' satisfies If (the number of a'+the number of b')<2 b , then add a second b' and add a' satisfying the above formula number after the second b', until the sequence P contains t b's and s a's;
[0064] S27: Copy 2 a sequences P to generate a sequence with length 2 x (x=a+b)
[0065] S28: Replace the elements b' in the sequence Z by adding a to the elements in the transformed sequence B of the target Gray code pattern of n=b bits, respectively, and replace the elements a' in the sequence Z by the transformed sequence A of the target Gray code pattern of n=a bits, to generate the transformed sequence T of the target Gray code pattern of n=7 bits, and convert the transformed sequence T into a Gray code sequence, after the Gray code sequence is represented by black and white stripes, the target Gray code pattern of n=7 bits is obtained, and the narrowest stripe width g is obtained.
[0066] S29: Repeat steps S23-S28 to obtain the transformed sequence of the target Gray code pattern of n=8,...,x, and convert the transformed sequence of n=x bits into a Gray code sequence, after the Gray code sequence is represented by black and white stripes, the target Gray code pattern of n=x bits is obtained.
[0067] wherein, when x>6, the target Gray code pattern and its transform sequence of n=2,...,6 bits are obtained, so that the transform sequence of x>6 can be spliced by the known transform sequence. Since the target Gray code pattern is the Gray code pattern with the narrowest stripe width greater than the set threshold, the splicing of the transform sequence of the target Gray code pattern can also obtain the transform sequence with the narrowest stripe width having a greater width. For different x, the set threshold can be a variable, as shown in Table 1, when n=2-4, the narrowest stripe width is 2 pixels wide, when n=5, 6, the narrowest stripe width is 4 pixels wide, and as x increases, the narrowest stripe width of the Gray code pattern also increases, therefore, the set threshold can be a variable that gradually increases as x increases, so that the Gray code pattern with a greater narrowest stripe width is obtained as the target Gray code pattern. A large number of experiments prove that the narrowest stripe width needs to be at least 5 pixels wide to better avoid the problem of subsurface scattering. In other examples, the maximum width of the narrowest stripe width of the Gray code pattern can also be selected as the target Gray code pattern.
[0068] After obtaining the target Gray code pattern and its transform sequence of n=2,...,6 bits, the more complex cases of n=7, 8, 9,..., x are calculated one by one based on the transform sequence of n≤6, therefore, when the transform sequence of the target Gray code pattern of n=2,...,6 bits is obtained by the exhaustive method, the transform sequence and its corresponding narrowest stripe width need to be saved.
[0069] Specifically, in one example, the transform sequence of the target Gray code pattern of n=7 bits is first calculated, and the above steps S22-S25 are sequentially executed to find the most suitable integers a, b and odd numbers s, t, i.e. a=5, b=2, s=3, t=1, so that is the smallest.
[0070] S26: A sequence P with a length of 2 b =2 2 =4 is constructed, wherein the first element of the sequence P is b', and a' satisfies The constructed sequence P={b',a',a',a'}.
[0071] S27: 2 a =2 5 =32 sequences P are copied to generate a sequence Z with a length of 2 7 =128, Z={P0,P1,...,P 127}={b',a',a',a',b',a',a',a',b',...,a'}.
[0072] S28: add a=5 to the transform sequence B=(0101) of the target Gray code pattern of n=2 bits, to obtain the transform sequence B'=(5656), replace the elements b' in the sequence Z with the transform sequence B', and replace the elements a' in the sequence Z with the transform sequence A=(20312041302130412031204130213041) of the target Gray code pattern of n=5 bits. That is, replace the first element b' with "5", replace the second element a' with "2", replace the third element a' with "0", replace the fourth element a' with "3", replace the fifth element b' with "6", replace the sixth element a' with "1", and so on, to obtain the transform sequence T=(52036120541360215304612053126041530261305412603152046130521360415203612054136021530461205312604153026130541260315204613052136041) of the target Gray code pattern of n=7 bits, and the narrowest stripe width of the transformed Gray code pattern has a width of 5 pixels, which can meet the requirements of high-speed and high-dynamic-range three-dimensional measurement.
[0073] S29: repeat steps S23-S28 to obtain the transform sequence of the target Gray code pattern of n=x, and convert the transform sequence of n=x bits into a Gray code sequence, and obtain the Gray code pattern to be projected of n=x bits after the Gray code sequence is represented by black and white stripes.
[0074] Please refer to Table 2 for the parameter settings of the transform sequence of the target Gray code pattern of n=7-12 bits obtained by splicing according to the above method steps. The narrowest stripe width of the obtained Gray code pattern to be projected is 5 pixels in width when n=7, and the narrowest stripe width reaches 8 pixels in width when n=12, which is 4 times the width of the traditional Gray code pattern (2 pixels).
[0075] When the Gray code pattern with a narrowest stripe width of 5 pixels in width is projected on the surface of the object to be measured, the black and white stripe image obtained is as shown in FIG. 6, which is compared with the black and white stripe image obtained by projecting the traditional Gray code pattern as shown in FIG. 5. Figure 6 Figure 2 The black and white stripe width of each of the Gray code patterns is at least 5 pixels in width, so that the Gray code pattern is less affected by subsurface scattering during measurement, and the black and white stripes have good contrast in areas with high reflectivity and areas with low reflectivity, which ensures the accuracy of decoding by the structured light three-dimensional measurement system and the precision of subsequent three-dimensional reconstruction data.
[0076] Number of bits n Integer a Integer b Odd number s Odd number t Narrowest stripe width (pixels) 7 5 2 3 1 5 8 6 2 3 1 5 9 7 2 3 1 6 10 5 5 17 15 7 11 9 2 3 1 8 12 7 5 17 15 8
[0077] Table 2 Parameter settings for generating the conversion sequence of the target gray code pattern of 7-12 bits
[0078] The three-dimensional measurement method based on the improved gray code pattern provided in the application can make the structured light projection device project in 1-bit (black and white binary coded stripes) pattern by projecting the improved gray code pattern on the object to be measured, so as to realize high-speed three-dimensional measurement; and the narrowest stripe width in the improved gray code pattern has a certain width, which can avoid the problem of decoding error caused by surface mutual reflection and subsurface scattering due to the too narrow narrowest stripe width. In addition, the application also provides a generation method of the improved gray code pattern, so as to generate the gray code pattern with a certain width, which is suitable for high-speed high-dynamic-range three-dimensional measurement.
[0079] The above-mentioned embodiments only express several embodiments of the application, and the description is relatively specific and detailed, but it cannot be understood as the limitation of the scope of the patent. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the application, a number of modifications and improvements can be made, which belong to the protection scope of the application.
Claims
1. A method for three-dimensional measurement based on a modified Gray code pattern, characterized by, The method comprises the following steps: S1: determining the number of Gray code bits n=x required for three-dimensional measurement of the object to be measured; S2: generating a n=x-bit conversion sequence, and converting the conversion sequence into a Gray code sequence, and obtaining a to-be-projected Gray code pattern after representing the Gray code sequence through black and white stripe patterns, wherein the narrowest stripe width of the to-be-projected Gray code pattern is greater than a set threshold; S3: projecting the to-be-projected Gray code pattern on the object to be measured through a structured light projection device; S4: collecting a surface stripe image of the object to be measured, and calculating the three-dimensional coordinates of the object to be measured according to the surface stripe image by using the principle of triangle; In step S2, the generation of a n=x-bit conversion sequence, the conversion of the conversion sequence into a Gray code sequence, and the obtaining of a to-be-projected Gray code pattern after representing the Gray code sequence through black and white stripe patterns comprise: S21: when x≤6, a transform sequence with length of 2 x is generated by an exhaustive method, and the transform sequence is converted into a Gray code sequence; after the Gray code sequence is characterized by black and white stripes, a corresponding Gray code pattern is obtained; a target Gray code pattern with a narrowest stripe width greater than a set threshold is selected as a Gray code pattern to be projected; S22: when x>6, performing step S21 to obtain a target Gray code pattern and its conversion sequence when n=2,...,6; S23: split x = 7 into two integers a and b, satisfying x = a + b, a ≥ b ≥ 1, obtain the transformation sequence A and B of the target Gray code pattern when n = a bits and n = b bits, and the narrowest stripe width g of the target Gray code pattern when n = a bits and n = b bits A and g B ; S24: Select two odd numbers s and t, satisfying s+t=2 b ; S25: repeat steps S23-S24 to find the best integer a, b and odd numbers s, t such that min; S26: construct a sequence P of length 2 b where the first element in the sequence P is b', and after the b' an a' is added such that the a' satisfies if (number of a's + number of b's) < 2 b then a second b' is added, and after the second b' an a' is added that satisfies the above formula for the number until the sequence P contains t b's and s a's; S27: copy 2 a a sequence P of length 2 x a sequence of length (x=a+b) S28: replacing elements b' in the sequence Z by adding a to elements b in the conversion sequence B of the target Gray code pattern of n=b bits respectively, and replacing elements a' in the sequence Z by the conversion sequence A of the target Gray code pattern of n=a bits, generating a conversion sequence T of the target Gray code pattern of n=7 bits, and converting the conversion sequence T into a Gray code sequence, obtaining a to-be-projected Gray code pattern of n=7 bits after representing the Gray code sequence through black and white stripe patterns, and obtaining the narrowest stripe width g; S29: repeating steps S23-S28 to obtain the conversion sequence of the target Gray code pattern of n=8,...,x, and converting the conversion sequence of n=x bits into a Gray code sequence, obtaining a to-be-projected Gray code pattern of n=x bits after representing the Gray code sequence through black and white stripe patterns; Wherein, the elements in the conversion sequence represent the row sequence number of the next code word relative to the previous code word.
2. The method of claim 1, wherein, In step S3, the to-be-projected Gray code pattern is projected on the object to be measured through a structured light projection device, which comprises: Extracting each row of stripe patterns in the to-be-projected Gray code pattern; Projecting the stripe patterns respectively.
Citation Information
Patent Citations
Stereoscopic vision detecting method for measuring three-dimensional morphology on strong reflection surface
CN101694375A
Coded grating projection method in three-dimensional measurement of coding structured light
CN107490348A