[go: up one dir, main page]

WO2025223567A1 - Three-dimensional reconstruction method and apparatus - Google Patents

Three-dimensional reconstruction method and apparatus

Info

Publication number
WO2025223567A1
WO2025223567A1 PCT/CN2025/091406 CN2025091406W WO2025223567A1 WO 2025223567 A1 WO2025223567 A1 WO 2025223567A1 CN 2025091406 W CN2025091406 W CN 2025091406W WO 2025223567 A1 WO2025223567 A1 WO 2025223567A1
Authority
WO
WIPO (PCT)
Prior art keywords
stripes
image
line segment
line segments
distribution rule
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2025/091406
Other languages
French (fr)
Chinese (zh)
Inventor
赵晓波
马超
陈晓军
陈瀚
章惠全
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shining 3D Technology Co Ltd
Original Assignee
Shining 3D Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shining 3D Technology Co Ltd filed Critical Shining 3D Technology Co Ltd
Publication of WO2025223567A1 publication Critical patent/WO2025223567A1/en
Pending legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Definitions

  • This application relates to the field of computer technology, and more specifically, to a three-dimensional reconstruction method and apparatus.
  • Structured light 3D reconstruction technology is a 3D reconstruction technique that projects an optically encoded pattern onto the surface of a measured object and recovers the object's 3D surface data through the acquired deformed pattern. It features high efficiency and anti-interference capabilities, and is widely used in various 3D reconstruction scenarios.
  • related technologies employ two methods: one uses circular symbol encoding, utilizing the relative displacement relationship of neighboring symbols for decoding; the other uses matching between image blocks to obtain 3D data.
  • the former method has a small symbol encoding capacity, can only reconstruct sparse symbol points, has limited data per frame, and low scanning efficiency; the latter method uses image block matching, resulting in lower accuracy.
  • This application provides a three-dimensional reconstruction method and apparatus to at least solve the technical problem of low scanning efficiency caused by the small encoding capacity of code elements in related technologies.
  • a three-dimensional reconstruction method comprising: acquiring a first image and a second image, wherein the first image and the second image are obtained by acquiring images of a projection pattern respectively by a pre-calibrated binocular camera, the image of the projection pattern is formed by a projection pattern projected onto the surface of a measured object, the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes include at least: colored stripes or binarized stripes, and the length of the line segments and stripes is random; sequentially matching the line segments and stripes in the first image and the second image; and performing three-dimensional reconstruction of the measured object based on the successfully matched line segments and stripes in the first image and the second image.
  • the projection pattern is determined by: determining the type of line segment stripes, wherein the colored stripes include at least one of the following: colored straight line stripes, colored curved stripes, and colored polygonal line stripes, and the binarized stripes include at least one of the following: binarized straight line stripes, binarized curved stripes, and binarized polygonal line stripes; arranging the line segment stripes according to a predetermined distribution rule to form the projection pattern, wherein the length of the line segment stripes is random.
  • the projected pattern is composed of line segments arranged according to a predetermined distribution rule, including: determining a first distribution rule for the line segments from the predetermined distribution rule, wherein the first distribution rule includes at least one of the following: the horizontal spacing between adjacent horizontal line segments is equal, the horizontal spacing between adjacent horizontal line segments increases sequentially at equal intervals, and the horizontal spacing between adjacent horizontal line segments is randomly selected from a predetermined distance range; determining a second distribution rule and a third distribution rule for the line segments from the predetermined distribution rule, wherein the second distribution rule includes at least one of the following: the vertical distance between adjacent vertical line segments is equal, the vertical distance between adjacent vertical line segments increases sequentially at equal intervals, and the horizontal spacing between adjacent vertical line segments is randomly selected from a predetermined distance range; and determining a second distribution rule and a third distribution rule for the line segments from the predetermined distribution rule, wherein the second distribution rule includes at least one of the following: the vertical distance between adjacent vertical line segments is equal, the vertical distance between adjacent vertical line segments increases sequentially at equal intervals, and
  • the third distribution rule includes: adjacent transverse line segments are arranged periodically in a preset order, wherein the number of adjacent transverse line segments in each period is a preset number, and each period contains line segments of multiple colors.
  • the preset order is determined according to the color of the line segments.
  • the line segments are colored straight line segments, the line segments are arranged according to the first, second, and third distribution rules to form a projection pattern.
  • the line segments are binary straight line segments, the line segments are arranged according to the first and second distribution rules to form a projection pattern.
  • arranging the line segments into a projection pattern according to a predetermined distribution rule includes: when the line segments are colored polygonal line segments, determining a fourth distribution rule for the line segments from the predetermined distribution rules, wherein the fourth distribution rule includes at least one of the following: the polygonal line segments are distributed longitudinally from left to right, or the polygonal line segments are distributed at a predetermined angle, wherein the included angle of the polygonal line segments is randomly selected within a predetermined angle range or the included angle of all polygonal line segments is equal; arranging the line segments into a projection pattern according to the first, second, third, and fourth distribution rules; and when the line segments are binary polygonal line segments, arranging the line segments into a projection pattern according to the first, second, and fourth distribution rules.
  • arranging the line segment stripes according to a predetermined distribution rule to form a projection pattern includes: when the line segment stripes are colored curved line segment stripes, determining a fifth distribution rule for the line segment stripes from the predetermined distribution rules, wherein the fifth distribution rule includes at least one of the following: the curved line segments are distributed longitudinally from left to right, or the curved line segments are distributed at a predetermined angle, wherein the radii of the curved line segments are randomly selected within a predetermined radii range or all curved line segments have equal radii; arranging the line segment stripes according to the first, second, third, and fifth distribution rules to form a projection pattern; and when the line segment stripes are binary curved line segment stripes, arranging the line segment stripes according to the first, second, and fifth distribution rules to form a projection pattern.
  • matching the line segments and stripes in the first image and the second image sequentially includes: when the line segments and stripes are colored straight line segments, matching the line segments and stripes in the first image and the second image sequentially according to a preset first matching method, wherein the preset first matching method includes: matching the line segments and stripes in the first image and the second image sequentially according to the arrangement order of the colored straight line segments; when the line segments and stripes are colored curved line segments or colored polyline segments, matching the line segments and stripes in the first image and the second image sequentially using a preset first matching method or a preset second matching method, wherein the preset second matching method includes: obtaining the center point of the line segments and stripes, and matching the line segments and stripes in the first image and the second image sequentially according to the center point of the line segments and stripes; when the line segments and stripes are binarized curved line segments or binarized polyline segments, matching the line segments and stripes in the first image and the second image sequentially using a preset second matching method.
  • the preset first matching method includes: matching
  • the line segments and stripes in the first image and the second image are matched sequentially using either a preset first matching method or a preset second matching method, including: randomly selecting one preset matching method from the two preset matching methods to perform a first matching of the line segments and stripes in the first image and the second image sequentially to obtain a first matching result; selecting another preset matching method from the two preset matching methods to perform a second matching of the line segments and stripes in the first image and the second image sequentially to obtain a second matching result; selecting the matching result that passes verification from the first matching result and the second matching result as the final matching result; if both the first matching result and the second matching result pass verification, determining whether the first matching result and the second matching result are consistent, and if both are consistent, determining the first matching result as the final matching result.
  • obtaining the center point of the line segment stripes includes: when the line segment stripes in the first image and the second image are matched sequentially using a preset second matching method, detecting the edges of the line segment stripes in the first image and the second image to obtain a binarized edge image or center line, wherein the edge pixels in the edge image are white and the background in the edge image is black or the opposite, and the edge pixels are used to represent the edge trajectory of the line segment stripes; obtaining the target matrix of each edge pixel, wherein the target matrix is used to characterize the curvature information of the edge pixels; and determining the edge line or center line of the line segment stripes based on the target matrix.
  • determining the center point of the line segment stripe based on the target matrix includes: obtaining the feature values of the target matrix corresponding to all edge pixels in each line segment stripe; determining the smallest feature value among all feature values corresponding to the line segment stripe as the target feature value, and obtaining the target feature vector corresponding to the target feature value; obtaining the edge pixel coordinates in the direction of the target feature vector, and determining them as the target edge pixel coordinates; and determining the center point of the line segment stripe based on the target edge pixel coordinates.
  • obtaining the center point of the line segment stripe includes: obtaining the gradient of all edge pixels in each line segment stripe; selecting the edge pixel with the largest gradient from all edge pixels as the target pixel; and determining the sub-pixel center of the target pixel as the center point of the line segment stripe.
  • the method further includes: after determining the center point of the line segment stripe, removing line segment stripes whose curvature is not within a preset curvature range.
  • a three-dimensional reconstruction apparatus comprising: an acquisition module configured to acquire a first image and a second image, wherein the first image and the second image are obtained by acquiring target images respectively by a pre-calibrated binocular camera, the target image being formed by a projection pattern projected onto the surface of the object being measured, the projection pattern being composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes including at least one of the following: colored stripes or binarized stripes, the length of the line segments and stripes being random; a matching module configured to sequentially match the line segments and stripes in the first image and the second image; and a reconstruction module configured to complete the three-dimensional reconstruction of the object being measured based on the mutually matched line segments and stripes in the first image and the second image.
  • a three-dimensional reconstruction system comprising: at least two image acquisition devices, a projection device, and a first processor; the projection device is configured to project a projection pattern onto the surface of a measured object, wherein the projection pattern is composed of line segments arranged according to a predetermined distribution rule, and the line segments include at least one of the following: colored stripes or binarized stripes, and the length of the line segments is random; at least two image acquisition modules are configured to acquire images of the projection pattern from the surface of the measured object to obtain a first image and a second image; the first processor is configured to sequentially match the line segments in the first image and the second image; and to perform three-dimensional reconstruction of the measured object based on the successfully matched line segments in the first image and the second image.
  • a projection device configured to project a projection pattern onto the surface of a measured object.
  • the projection pattern is composed of line segments arranged according to a predetermined distribution rule, and the line segments include at least one of the following: colored stripes or binarized stripes.
  • an electronic device including: a memory configured to store program instructions; and a processor connected to the memory, configured to perform the program instructions that perform the following functions: acquiring a first image and a second image, wherein the first image and the second image are obtained by acquiring target images respectively by a pre-calibrated binocular camera, the target image is formed by a projection pattern projected onto the surface of the object being measured, the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes include at least one of the following: colored stripes or binarized stripes, the length of the line segments and stripes is random; sequentially matching the line segments and stripes in the first image and the second image; and completing the three-dimensional reconstruction of the object being measured based on the mutually matched line segments and stripes in the first image and the second image.
  • a non-volatile storage medium including a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-described three-dimensional reconstruction method by running the computer program.
  • a computer program product including a computer program that, when executed by a processor, implements the steps of the above-described method.
  • a first image and a second image are acquired.
  • the first image and the second image are obtained by acquiring images of a projection pattern from a pre-calibrated binocular camera.
  • the projection pattern is formed by a projection pattern projected onto the surface of the object being measured.
  • the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule.
  • the line segments and stripes include at least colored stripes or binarized stripes, and the length of the line segments and stripes is random.
  • the line segments and stripes in the first image and the second image are matched sequentially.
  • the object being measured is reconstructed in three dimensions based on the successfully matched line segments and stripes in the first image and the second image.
  • Figure 1 is a hardware structure block diagram of a computer terminal for implementing a three-dimensional reconstruction method according to an embodiment of this application;
  • Figure 2 is a flowchart of a three-dimensional reconstruction method according to an embodiment of this application.
  • Figure 3 is a schematic diagram of a projection pattern according to an embodiment of this application.
  • Figure 4 is a schematic diagram of a color stripe encoding sequence according to an embodiment of this application.
  • Figure 5 is a schematic diagram of another projection pattern according to an embodiment of this application.
  • Figure 6 is a schematic diagram of another projection pattern according to an embodiment of this application.
  • Figure 7 is a structural diagram of a three-dimensional reconstruction device according to an embodiment of this application.
  • FIG. 1 shows a hardware structure block diagram of a computer terminal for implementing the three-dimensional reconstruction method.
  • the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 configured to store data, and a transmission module 106 configured for communication functions.
  • processors shown as 102a, 102b, ..., 102n in the figure
  • the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.
  • a memory 104 configured to store data
  • a transmission module 106 configured for communication functions.
  • the computer terminal 10 may also include: a display, a keyboard, a cursor control device, an input/output interface (I/O interface), a universal serial bus (USB) port (which may be one of the ports of the I/O interface), a network interface, and a BUS bus.
  • I/O interface input/output interface
  • USB universal serial bus
  • the structure shown in Figure 1 is only illustrative and does not limit the structure of the above-described electronic device.
  • the computer terminal 10 may also include more or fewer components than shown in Figure 1, or have a different configuration than shown in Figure 1.
  • processors and/or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be implemented wholly or partially as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be wholly or partially integrated into any other element in the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as processor control (e.g., selection of a variable resistor termination path connected to an interface).
  • the memory 104 can be configured to store software programs and modules for application software, such as the program instructions/data storage device corresponding to the 3D reconstruction method in this embodiment.
  • the processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the aforementioned 3D reconstruction method.
  • the memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
  • the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
  • the transmission module 106 is configured to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission module 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 106 may be a Radio Frequency (RF) module, configured to communicate with the Internet wirelessly.
  • NIC Network Interface Controller
  • RF Radio Frequency
  • the display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10.
  • LCD liquid crystal display
  • the computer device shown in FIG1 may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be pointed out that FIG1 is merely one example of a specific embodiment and is intended to illustrate the types of components that may be present in the aforementioned computer device.
  • this application provides an embodiment of a three-dimensional reconstruction method. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than that shown here.
  • Figure 2 is a flowchart of a three-dimensional reconstruction method according to an embodiment of the present application. As shown in Figure 2, the method includes the following steps:
  • Step S202 Acquire the first image and the second image, wherein the first image and the second image are obtained by acquiring images of the projection pattern by a pre-calibrated binocular camera respectively.
  • the image of the projection pattern is formed by the projection pattern projected onto the surface of the object being measured.
  • the projection pattern is composed of line segments and stripes arranged according to a pre-determined distribution rule.
  • the line segments and stripes include at least: colored stripes or binarized stripes, and the length of the line segments and stripes is random.
  • a binocular camera refers to a camera set on both sides of the object being measured, for example: a left camera set on the left side and a right camera set on the right side.
  • Step S204 Match the line segments and stripes in the first image and the second image sequentially;
  • step S204 above there are multiple ways to match line segments and stripes, such as matching by using feature points on the line segments and stripes.
  • Step S206 Perform three-dimensional reconstruction of the object under test based on the successfully matched line segments and stripes in the first and second images.
  • the three-dimensional reconstruction method in steps S202 to S206 above employs the acquisition of a first image and a second image.
  • the first and second images are obtained by pre-calibrated binocular cameras acquiring images of a projection pattern.
  • the projection pattern is formed by a projection pattern projected onto the surface of the object being measured.
  • the projection pattern consists of line segments arranged according to a predetermined distribution rule.
  • the line segments include at least colored or binarized stripes, and the length of the line segments is random.
  • the line segments in the first and second images are matched sequentially. Based on the successfully matched line segments in the first and second images, the object being measured is reconstructed in three dimensions.
  • the method achieves the goal of recording more encoded information through the line segments, thereby improving scanning efficiency and solving the technical problem of low scanning efficiency due to the small encoding capacity of code elements in related technologies.
  • the following is a detailed explanation.
  • the line type in the projected pattern includes at least one of the following: colored stripes, binarized stripes, such as a projected pattern composed of colored stripes, or a projected pattern composed of binarized stripes.
  • the length of the line segments and stripes is random, and all the line segments and stripes in the projected pattern have the same length, or as shown in Figure 3, the lengths of the line segments and stripes in the projected pattern are different and randomly distributed.
  • the process of determining the projection pattern consists of two steps.
  • the first step is to determine the type of line segment stripes.
  • colored stripes include at least one of the following: colored straight line stripes, colored curved stripes, and colored polygonal line stripes.
  • Binarized stripes include at least one of the following: binarized straight line stripes, binarized curved stripes, and binarized polygonal line stripes.
  • the second step is to arrange the line segment stripes according to a predetermined distribution rule to form the projection pattern.
  • a first distribution rule for line segment stripes is determined from a predetermined distribution rule.
  • This first distribution rule includes at least one of the following: equal horizontal spacing between adjacent horizontal line segment stripes; sequentially increasing horizontal spacing between adjacent horizontal line segment stripes; and randomly selecting the horizontal spacing between adjacent horizontal line segment stripes from a predetermined distance range.
  • a second and third distribution rule for line segment stripes are determined from the predetermined distribution rule.
  • the second distribution rule includes at least one of the following: equal vertical distance between adjacent vertical line segment stripes; sequentially increasing vertical distance between adjacent vertical line segment stripes; and randomly selecting the vertical distance between adjacent vertical line segment stripes from a predetermined distance range.
  • the third distribution rule includes: adjacent horizontal line segment stripes are arranged periodically in a predetermined order.
  • the number of adjacent horizontal line segment stripes in each period is a predetermined number, and each period contains line segment stripes of multiple colors.
  • the predetermined order is determined based on the color of the line segment stripes.
  • the line segment stripes are colored straight line segment stripes, the line segment stripes are arranged according to the first, second, and third distribution rules to form a projection pattern.
  • the line segment stripes are binary straight line segment stripes, the line segment stripes are arranged according to the first and second distribution rules to form a projection pattern.
  • color signals are used as encoding information to help improve the accuracy of stripe decoding.
  • This solves the problem of missing 3D data due to optical blind spots caused by the angle between the two cameras, resulting in the loss of some single-camera code value information.
  • decoding can be performed using color information from the neighborhood.
  • Colored stripes can be composed of multiple different colors, including RGB colors such as red, blue, and green, or blue and green, or other colors. They can also be combinations of colors like RB, RG, and BG to create orange, yellow, cyan, white, and black.
  • the 8 line segments within that cycle are color-coded, as shown in Figure 4.
  • the preset order is RGBRBGGB (red, green, blue, red, blue, green, green, blue).
  • Corresponding encoding values can be generated in the computer, for example: red is 100, green is 010, and blue is 001.
  • stripes can be identified regardless of various adverse environmental conditions such as object boundaries, occlusion, and reflections, thus avoiding encoding ambiguity.
  • Designing this encoded image as a cycle allows decoding and reconstruction to be completed with just one simple color space image. This shortens the image sequence acquisition time required for a single frame of 3D data during dynamic scanning, reduces the complexity and computational cost of encoding and decoding, and avoids problems such as algorithm complexity, time consumption, and decoding errors caused by too many color types.
  • the projection pattern can be composed of either broken line segments or curved line segments.
  • a fourth distribution rule for the line segment stripes is determined from a predetermined distribution rule.
  • the fourth distribution rule includes at least one of the following: the broken line segments are distributed longitudinally from left to right, or the broken line segments are distributed at a predetermined angle. The included angle of the broken line segments is randomly selected within the predetermined angle range or the included angle of all broken line segments is equal.
  • the line segments are arranged according to the first, second, third, and fourth distribution rules to form a projection pattern; when the line segments are binary broken line segments, the line segments are arranged according to the first, second, and fourth distribution rules to form a projection pattern.
  • a fifth distribution rule for the line segment stripes is determined from a predetermined distribution rule.
  • the fifth distribution rule includes at least one of the following: the curved line segments are distributed longitudinally from left to right; the curved line segments are distributed at a predetermined angle; the radii of the zigzag curve segments are randomly selected within a predetermined radii range or all the curved line segments have equal radii.
  • the line segment stripes are arranged according to the first, second, third, and fifth distribution rules to form a projection pattern.
  • the line segment stripes are binary curved line segment stripes
  • the line segment stripes are arranged according to the first, second, and fifth distribution rules to form a projection pattern.
  • an image of the projection pattern is formed.
  • a binocular camera captures the image of the projection pattern to obtain a first image and a second image. Then, the line segments and stripes in the first and second images are matched. If the line segments and stripes are colored straight lines, the line segments and stripes in the first and second images are matched sequentially according to a preset first matching method.
  • the preset first matching method includes: matching the line segments and stripes in the first and second images sequentially according to the arrangement order of the colored straight lines and stripes; if the line segments and stripes are colored curved lines or colored polygonal lines, the line segments and stripes in the first and second images are matched sequentially using either a preset first matching method or a preset second matching method.
  • the preset second matching method includes: obtaining the center point of the line segments and stripes, and matching the line segments and stripes in the first and second images sequentially based on the center point of the line segments and stripes; if the line segments and stripes are binarized curved lines or binarized polygonal lines, the line segments and stripes in the first and second images are matched sequentially using a preset second matching method.
  • one preset matching method can be randomly selected from two preset matching methods to perform a first matching of the line segments and stripes in the first image and the second image in sequence, resulting in a first matching result; another preset matching method can be selected from the two preset matching methods to perform a second matching of the line segments and stripes in the first image and the second image in sequence, resulting in a second matching result; the matching result that passes verification is selected from the first matching result and the second matching result and determined as the final matching result; if both the first matching result and the second matching result pass verification, it is determined whether the first matching result and the second matching result are consistent; if both are consistent, the first matching result is determined as the final matching result.
  • the first match uses the first preset matching method
  • the second match uses the second preset matching method.
  • the second match result is used as the final match result.
  • the center point of the line segments and stripes can be obtained in the following way: detect the edges of the line segments and stripes in the first and second images to obtain a binarized edge image or center line.
  • the edge pixels in the edge image are white, and the background in the edge image is black or the opposite.
  • the edge pixels are set to represent the edge trajectory of the line segments and stripes; obtain the target matrix for each edge pixel.
  • the target matrix is set to represent the curvature information of the edge pixels; determine the edge line or center line of the line segments and stripes based on the target matrix.
  • edge detection algorithms such as edge detectors
  • edge detection algorithms can be used to detect the edges of curved and polyline segments in an image. This generates a binary edge image, where edge pixels are white and the background is black.
  • the target matrix can be a Hessian matrix, a 2x2 matrix used to describe the second-order gradient information of the line segments in the image.
  • the process of determining the center point of a line segment stripe using the target matrix is as follows: obtain the feature values of the target matrix corresponding to all edge pixels in each line segment stripe; determine the smallest feature value among all feature values corresponding to the line segment stripe as the target feature value, and obtain the target feature vector corresponding to the target feature value; obtain the edge pixel coordinates in the direction of the target feature vector, and determine them as the target edge pixel coordinates; determine the center point of the line segment stripe based on the target edge pixel coordinates.
  • eigenvalues are used to determine whether it is part of a curve or polyline segment.
  • a curve or polyline segment has at least one very small eigenvalue, while another larger eigenvalue is close to zero.
  • the eigenvector corresponding to the very small eigenvalue is found; this vector represents the normal direction of the curve or polyline segment.
  • the position of the stripe centerline can be determined based on the edge pixel location and the eigenvector along the normal direction. This can be achieved by calculating the pixel coordinates along the eigenvector direction.
  • the center point of the line segment stripe can be obtained by: obtaining the gradient of all edge pixels in each line segment stripe; selecting the edge pixel with the largest gradient from all edge pixels as the target pixel; and determining the sub-pixel center of the target pixel as the center point of the line segment stripe.
  • the eigenvalues of a curve should be close to zero, and one of them should be greater than zero, while the eigenvalues of a broken line segment should have one that is much larger than the other.
  • the center lines formed by the extracted center points can be post-processed, such as removing line segments whose curvature is not within the preset curvature range, removing unnecessary branches, or smoothing the center lines to obtain more accurate and consistent results.
  • Figure 7 is a structural diagram of a three-dimensional reconstruction device according to an embodiment of this application. As shown in Figure 7, the device includes:
  • the acquisition module 70 is configured to acquire a first image and a second image, wherein the first image and the second image are obtained by acquiring target images by a pre-calibrated binocular camera respectively.
  • the target image is formed by a projection pattern projected onto the surface of the object being measured.
  • the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule.
  • the line segments and stripes include at least one of the following: colored stripes or binarized stripes, and the length of the line segments and stripes is random.
  • the matching module 72 is configured to match the line segments and stripes in the first image and the second image sequentially.
  • the reconstruction module 74 is configured to perform three-dimensional reconstruction of the object under test based on the matching line segments and stripes in the first and second images.
  • the acquisition module 70 of the above-mentioned three-dimensional reconstruction device includes: a determination submodule, configured to determine the type of line segment stripes, wherein the colored stripes include at least one of the following: colored straight line stripes, colored curved stripes, and colored polyline stripes, and the binarized stripes include at least one of the following: binarized straight line stripes, binarized curved stripes, and binarized polyline stripes; and the line segment stripes are arranged according to a predetermined distribution rule to form a projection pattern.
  • the determination submodule includes: a first determination unit, configured to determine a first distribution rule for line segment stripes from a predetermined distribution rule, wherein the first distribution rule includes at least one of the following: the horizontal spacing between adjacent horizontal line segment stripes is equal, the horizontal spacing between adjacent horizontal line segment stripes increases sequentially at equal intervals, and the horizontal spacing between adjacent horizontal line segment stripes is randomly selected from a preset distance range; and a second distribution rule and a third distribution rule for line segment stripes are determined from the predetermined distribution rule, wherein the second distribution rule includes at least one of the following: the vertical distance between adjacent vertical line segment stripes is equal, the vertical distance between adjacent vertical line segment stripes increases sequentially at equal intervals, and the vertical distance between adjacent vertical line segment stripes increases sequentially at equal intervals.
  • the vertical distance between adjacent line segments is randomly selected within a preset distance range.
  • the third distribution rule includes: horizontally adjacent line segments are arranged periodically in a preset order, wherein the number of horizontally adjacent line segments in each period is a preset number, and each period contains line segments of multiple colors. The preset order is determined according to the color of the line segments.
  • the line segments are colored straight line segments, the line segments are arranged according to the first, second, and third distribution rules to form a projection pattern.
  • the line segments are binary straight line segments, the line segments are arranged according to the first and second distribution rules to form a projection pattern.
  • the first determining unit includes a first determining subunit and a second determining subunit.
  • the first determining subunit is configured to determine a fourth distribution rule for the line segment stripes from a predetermined distribution rule when the line segment stripes are colored broken line segment stripes.
  • the fourth distribution rule includes at least one of the following: the broken line segments are distributed longitudinally from left to right; the broken line segments are distributed at a predetermined angle, wherein the included angle of the broken line segments is randomly selected within a predetermined angle range or the included angle of all broken line segments is equal; the line segment stripes are arranged according to the first distribution rule, the second distribution rule, the third distribution rule, and the fourth distribution rule to form a projection pattern; when the line segment stripes are binary broken line segment stripes, the line segment stripes are arranged according to the first distribution rule, the second distribution rule, and the fourth distribution rule to form a projection pattern.
  • the second determining subunit is configured to, when the line segment stripes are colored curved line segment stripes, determine the fifth distribution rule of the line segment stripes from a predetermined distribution rule, wherein the fifth distribution rule includes at least one of the following: the curved segments are distributed longitudinally from left to right, or the curved segments are distributed at a predetermined angle, wherein the radii of the zigzag curve segments are randomly selected within a predetermined radii range or the radii of all curve segments are equal; the line segment stripes are arranged according to the first distribution rule, the second distribution rule, the third distribution rule, and the fifth distribution rule to form a projection pattern; when the line segment stripes are binary curved line segment stripes, the line segment stripes are arranged according to the first distribution rule, the second distribution rule, and the fifth distribution rule to form a projection pattern.
  • the matching module 72 includes a matching submodule configured to, when the line segment stripes are colored straight line stripes, sequentially match the line segment stripes in the first image and the second image according to a preset first matching method.
  • the preset first matching method includes: sequentially matching the line segment stripes in the first image and the second image according to the arrangement order of the colored straight line stripes; and, when the line segment stripes are colored curved line stripes or colored polyline stripes, sequentially matching the line segment stripes in the first image and the second image using either the preset first matching method or the preset second matching method.
  • the preset second matching method includes: obtaining the center point of the line segment stripes and sequentially matching the line segment stripes in the first image and the second image according to the center point of the line segment stripes; and, when the line segment stripes are binarized curved line stripes or binarized polyline stripes, sequentially matching the line segment stripes in the first image and the second image using the preset second matching method.
  • the matching submodule includes a matching unit, a first acquisition unit, and a second acquisition unit.
  • the matching unit is configured to randomly select one of two preset matching methods to perform a first matching of the line segments and stripes in the first image and the second image sequentially to obtain a first matching result; select another preset matching method to perform a second matching of the line segments and stripes in the first image and the second image sequentially to obtain a second matching result; select the matching result that passes verification from the first matching result and the second matching result to determine the final matching result; if both the first matching result and the second matching result pass verification, determine whether the first matching result and the second matching result are consistent; if both the first matching result and the second matching result are consistent, determine the first matching result as the final matching result.
  • the first acquisition unit is configured to detect the edges of the line segments and stripes in the first image and the second image by sequentially matching the line segments and stripes in the first image and the second image using a preset second matching method, and obtain a binarized edge image or center line.
  • the edge pixels in the edge image are white, and the background in the edge image is black or the opposite.
  • the edge pixels are set to represent the edge trajectory of the line segments and stripes.
  • the unit acquires a target matrix for each edge pixel, and the target matrix is set to represent the curvature information of the edge pixels.
  • the unit determines the edge line or center line of the line segments and stripes based on the target matrix.
  • the first acquisition unit includes a center point subunit and a removal subunit.
  • the center point subunit is configured to acquire the feature values of the target matrix corresponding to all edge pixels in each line segment stripe; determine the smallest feature value among all feature values corresponding to the line segment stripe as the target feature value, and acquire the target feature vector corresponding to the target feature value; acquire the edge pixel coordinates in the direction of the target feature vector, and determine them as the target edge pixel coordinates; and determine the center point of the line segment stripe based on the target edge pixel coordinates.
  • the second acquisition unit is configured to acquire the gradient of all edge pixels in each line segment stripe; select the edge pixel with the largest gradient from all edge pixels and determine it as the target pixel; and determine the sub-pixel center of the target pixel as the center point of the line segment stripe.
  • Remove sub-units configured to remove line segment stripes whose curvature is not within a preset curvature range after determining the center point of the line segment stripe.
  • This application embodiment also provides a three-dimensional reconstruction system, including: at least two image acquisition devices, a projection device, and a first processor; the projection device is configured to project a projection pattern onto the surface of a measured object, wherein the projection pattern is composed of line segments arranged according to a predetermined distribution rule, and the line segments include at least one of the following: colored stripes or binarized stripes, and the length of the line segments is random; at least two image acquisition modules are configured to acquire images of the projection pattern from the surface of the measured object to obtain a first image and a second image; the first processor is configured to sequentially match the line segments in the first image and the second image; and to perform three-dimensional reconstruction of the measured object based on the successfully matched line segments in the first image and the second image.
  • the 3D reconstruction method shown in Figure 2 is applicable to various 3D scanners, including dental scanners, facial scanners, industrial scanners, professional scanners, handheld scanners, and fixed scanners. It can reconstruct 3D images of teeth, faces, bodies, industrial products, industrial equipment, cultural relics, artworks, prostheses, medical devices, and buildings.
  • the aforementioned 3D reconstruction system can be understood as a 3D scanner and a first processor connected via wired or wireless means.
  • At least two image acquisition devices and a projection device in the 3D reconstruction system can be understood as 3D scanners, and the first processor can be understood as a mobile phone, tablet, laptop, desktop computer, smart TV, or other similar device.
  • the first processor can be built into the 3D scanner; in this case, the aforementioned 3D reconstruction system is equivalent to a 3D scanner.
  • the three-dimensional reconstruction device shown in Figure 7 is configured to perform the three-dimensional reconstruction method shown in Figure 2. Therefore, the relevant explanations and descriptions in the above three-dimensional reconstruction method also apply to this type of three-dimensional reconstruction device, and will not be repeated here.
  • This application embodiment also provides a projection device, configured to project a projection pattern onto the surface of a measured object.
  • the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule.
  • the line segments and stripes include at least one of the following: colored stripes or binary stripes, and the length of the line segments and stripes is random.
  • This application also provides an electronic device, including: a memory configured to store program instructions; and a processor connected to the memory, configured to execute program instructions that perform the following functions: acquiring a first image and a second image, wherein the first image and the second image are obtained by acquiring target images respectively by a pre-calibrated binocular camera, the target image is formed by a projection pattern projected onto the surface of the object being measured, the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes include at least one of the following: colored stripes or binarized stripes, the length of the line segments and stripes is random; sequentially matching the line segments and stripes in the first image and the second image; and completing the three-dimensional reconstruction of the object being measured based on the mutually matched line segments and stripes in the first image and the second image.
  • This application embodiment also provides a non-volatile storage medium, which includes a stored computer program.
  • the device containing the non-volatile storage medium executes the following three-dimensional reconstruction method by running the computer program: acquiring a first image and a second image, wherein the first image and the second image are obtained by acquiring target images respectively using a pre-calibrated binocular camera.
  • the target image is formed by a projection pattern projected onto the surface of the object being measured.
  • the projection pattern consists of line segments and stripes arranged according to a predetermined distribution rule.
  • the line segments and stripes include at least one of the following: colored stripes or binarized stripes, and the length of the line segments and stripes is random; sequentially matching the line segments and stripes in the first image and the second image; and completing the three-dimensional reconstruction of the object being measured based on the mutually matched line segments and stripes in the first image and the second image.
  • non-volatile storage medium is configured to perform the three-dimensional reconstruction method shown in Figure 2. Therefore, the relevant explanations in the above-mentioned three-dimensional reconstruction method are also applicable to this non-volatile storage medium, and will not be repeated here.
  • This application also provides a computer program product, including a computer program, characterized in that the computer program, when executed by a processor, implements the steps of a three-dimensional reconstruction method.
  • sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
  • the disclosed technical content can be implemented in other ways.
  • the device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
  • the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
  • the units described as separate components may or may not be physically separate.
  • the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
  • the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
  • the integrated unit can be implemented in hardware or as a software functional unit.
  • the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application.
  • the aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
  • a first image and a second image are acquired.
  • the first image and the second image are obtained by acquiring images of a projection pattern by a pre-calibrated binocular camera.
  • the projection pattern is formed by a projection pattern projected onto the surface of the object being measured.
  • the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule.
  • the line segments and stripes include at least colored stripes or binarized stripes, and the length of the line segments and stripes is random.
  • the line segments and stripes in the first image and the second image are matched sequentially.
  • the object being measured is reconstructed in three dimensions based on the successfully matched line segments and stripes in the first image and the second image.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)
  • Length Measuring Devices By Optical Means (AREA)

Abstract

A three-dimensional reconstruction method and apparatus. The method comprises: acquiring a first image and a second image, the first image and the second image being obtained by a pre-calibrated binocular camera separately acquiring images of a projection pattern, the images of the projection pattern being formed by a projection pattern projected onto a surface of a measured object, the projection pattern being formed by arranging line segment stripes according to a predetermined distribution rule, and the line segment stripes at least comprising: colored stripes or binarized stripes, the lengths of the line segment stripes being random (S202); sequentially matching the line segment stripes in the first image and the second image (S204); and performing three-dimensional reconstruction of the measured object on the basis of line segment stripes successfully matched in the first image and the second image (S206).

Description

三维重建方法及装置Three-dimensional reconstruction method and device

交叉援引Cross-reference

本申请要求于2024年04月26日提交中国专利局,申请号为202410515673.4,申请名称为“三维重建方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to Chinese Patent Application No. 202410515673.4, filed on April 26, 2024, entitled “Three-dimensional reconstruction method and apparatus”, the entire contents of which are incorporated herein by reference.

技术领域Technical Field

本申请涉及计算机技术领域,具体而言,涉及一种三维重建方法及装置。This application relates to the field of computer technology, and more specifically, to a three-dimensional reconstruction method and apparatus.

背景技术Background Technology

结构光三维重建技术是一种向被测物体表面投射光学编码图案,并通过采集到的变形图案恢复物体表面三维数据的三维重构技术。其具有高效率、抗干扰等特性,被广泛应用于各类三维重建场景。目前,相关技术中,通过圆形码元的编码方式,利用邻域码元的相对位移关系来解码,另一种方式是通过图像块间的匹配来获取三维数据,前一种方式,码元的编码容量较小,只能重建稀疏的码元点,单帧数据少,扫描效率低;后一种方式,利用图像块进行匹配,精度较低。Structured light 3D reconstruction technology is a 3D reconstruction technique that projects an optically encoded pattern onto the surface of a measured object and recovers the object's 3D surface data through the acquired deformed pattern. It features high efficiency and anti-interference capabilities, and is widely used in various 3D reconstruction scenarios. Currently, related technologies employ two methods: one uses circular symbol encoding, utilizing the relative displacement relationship of neighboring symbols for decoding; the other uses matching between image blocks to obtain 3D data. The former method has a small symbol encoding capacity, can only reconstruct sparse symbol points, has limited data per frame, and low scanning efficiency; the latter method uses image block matching, resulting in lower accuracy.

针对上述的问题,目前尚未提出有效的解决方案。There is currently no effective solution to the above problems.

发明内容Summary of the Invention

本申请实施例提供了一种三维重建方法及装置,以至少解决相关技术中由于码元的编码容量较小导致扫描效率低的技术问题。This application provides a three-dimensional reconstruction method and apparatus to at least solve the technical problem of low scanning efficiency caused by the small encoding capacity of code elements in related technologies.

根据本申请实施例的一个方面,提供了一种三维重建方法,包括:获取第一图像和第二图像,其中,第一图像和第二图像是由预先标定的双目相机分别采集投影图案的图像得到的,投影图案的图像是由投射到被测物体表面的投影图案形成的,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括:彩色条纹或二值化条纹,线段条纹的长度随机;将第一图像和第二图像中的线段条纹依次进行匹配;根据第一图像和第二图像中匹配成功的线段条纹对被测物体进行三维重建。According to one aspect of the embodiments of this application, a three-dimensional reconstruction method is provided, comprising: acquiring a first image and a second image, wherein the first image and the second image are obtained by acquiring images of a projection pattern respectively by a pre-calibrated binocular camera, the image of the projection pattern is formed by a projection pattern projected onto the surface of a measured object, the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes include at least: colored stripes or binarized stripes, and the length of the line segments and stripes is random; sequentially matching the line segments and stripes in the first image and the second image; and performing three-dimensional reconstruction of the measured object based on the successfully matched line segments and stripes in the first image and the second image.

可选地,投影图案通过以下方式确定,包括:确定线段条纹的类型,其中,彩色条纹至少包括以下之一:彩色直线段条纹、彩色曲线段条纹和彩色折线段条纹,二值化条纹至少包括以下之一:二值化直线段条纹、二值化曲线段条纹和二值化折线段条纹;将线段条纹按照预先确定的分布规则排列组成投影图案,其中,线段条纹的长度随机。Optionally, the projection pattern is determined by: determining the type of line segment stripes, wherein the colored stripes include at least one of the following: colored straight line stripes, colored curved stripes, and colored polygonal line stripes, and the binarized stripes include at least one of the following: binarized straight line stripes, binarized curved stripes, and binarized polygonal line stripes; arranging the line segment stripes according to a predetermined distribution rule to form the projection pattern, wherein the length of the line segment stripes is random.

可选地,投影图案由线段条纹按照预先确定的分布规则排列组成,包括:从预先确定的分布规则中确定线段条纹的第一分布规则,其中,第一分布规则至少包括以下之一:横向相邻线段条纹间的水平间距相等、横向相邻线段条纹的水平间距依次等距增大和横向相邻线段条纹的水平间距在预设距离区间中随机选取;从预先确定的分布规则中确定线段条纹的第二分布规则和第三分布规则,其中,第二分布规则至少包括以下之一:纵向相邻线段条纹间的垂直距离相等、纵向相邻线段条纹间的垂直距离依次等距增大和纵向相邻线段条纹间的垂直距离在预设距离区间中随机选取,第三分布规则包括:横向相邻线段条纹按照预设顺序周期性排列,其中,每个周期内的横向相邻线段条纹的数量为预设数量,每个周期内包含多种颜色的线段条纹,预设顺序根据线段条纹的颜色确定;在线段条纹为彩色直线段条纹的情况下,将线段条纹按照第一分布规则、第二分布规则和第三分布规则排列组成投影图案;在线段条纹为二值化直线段条纹的情况下,将线段条纹按照第一分布规则和第二分布规则排列组成投影图案。Optionally, the projected pattern is composed of line segments arranged according to a predetermined distribution rule, including: determining a first distribution rule for the line segments from the predetermined distribution rule, wherein the first distribution rule includes at least one of the following: the horizontal spacing between adjacent horizontal line segments is equal, the horizontal spacing between adjacent horizontal line segments increases sequentially at equal intervals, and the horizontal spacing between adjacent horizontal line segments is randomly selected from a predetermined distance range; determining a second distribution rule and a third distribution rule for the line segments from the predetermined distribution rule, wherein the second distribution rule includes at least one of the following: the vertical distance between adjacent vertical line segments is equal, the vertical distance between adjacent vertical line segments increases sequentially at equal intervals, and the horizontal spacing between adjacent vertical line segments is randomly selected from a predetermined distance range; and determining a second distribution rule and a third distribution rule for the line segments from the predetermined distribution rule, wherein the second distribution rule includes at least one of the following: the vertical distance between adjacent vertical line segments is equal, the vertical distance between adjacent vertical line segments increases sequentially at equal intervals, and the vertical distance between adjacent vertical line segments increases sequentially at equal intervals. The equidistant increasing and the vertical distance between adjacent longitudinal line segments are randomly selected within a preset distance range. The third distribution rule includes: adjacent transverse line segments are arranged periodically in a preset order, wherein the number of adjacent transverse line segments in each period is a preset number, and each period contains line segments of multiple colors. The preset order is determined according to the color of the line segments. When the line segments are colored straight line segments, the line segments are arranged according to the first, second, and third distribution rules to form a projection pattern. When the line segments are binary straight line segments, the line segments are arranged according to the first and second distribution rules to form a projection pattern.

可选地,将线段条纹按照预先确定的分布规则排列组成投影图案,包括:在线段条纹为彩色折线段条纹的情况下,从预先确定的分布规则中确定线段条纹的第四分布规则,其中,第四分布规则至少包括以下之一:折线段从左往右依次纵向分布、折线段倾斜预设角度分布,其中,折线段的夹角角度在预设角度范围内随机选取或所有折线段的夹角角度相等;将线段条纹按照第一分布规则、第二分布规则、第三分布规则和第四分布规则排列组成投影图案;在线段条纹为二值化折线段条纹的情况下,将线段条纹按照第一分布规则、第二分布规则和第四分布规则排列组成投影图案。Optionally, arranging the line segments into a projection pattern according to a predetermined distribution rule includes: when the line segments are colored polygonal line segments, determining a fourth distribution rule for the line segments from the predetermined distribution rules, wherein the fourth distribution rule includes at least one of the following: the polygonal line segments are distributed longitudinally from left to right, or the polygonal line segments are distributed at a predetermined angle, wherein the included angle of the polygonal line segments is randomly selected within a predetermined angle range or the included angle of all polygonal line segments is equal; arranging the line segments into a projection pattern according to the first, second, third, and fourth distribution rules; and when the line segments are binary polygonal line segments, arranging the line segments into a projection pattern according to the first, second, and fourth distribution rules.

可选地,将线段条纹按照预先确定的分布规则排列组成投影图案,包括:在线段条纹为彩色曲线段条纹的情况下,从预先确定的分布规则中确定线段条纹的第五分布规则,其中,第五分布规则至少包括以下之一:曲线段从左往右依次纵向分布、曲线段倾斜预设角度分布,其中,曲线段的弧度在预设弧度范围内随机选取或所有曲线段的弧度相等;将线段条纹按照第一分布规则、第二分布规则、第三分布规则和第五分布规则排列组成投影图案;在线段条纹为二值化曲线段条纹的情况下,将线段条纹按照第一分布规则、第二分布规则和第五分布规则排列组成投影图案。Optionally, arranging the line segment stripes according to a predetermined distribution rule to form a projection pattern includes: when the line segment stripes are colored curved line segment stripes, determining a fifth distribution rule for the line segment stripes from the predetermined distribution rules, wherein the fifth distribution rule includes at least one of the following: the curved line segments are distributed longitudinally from left to right, or the curved line segments are distributed at a predetermined angle, wherein the radii of the curved line segments are randomly selected within a predetermined radii range or all curved line segments have equal radii; arranging the line segment stripes according to the first, second, third, and fifth distribution rules to form a projection pattern; and when the line segment stripes are binary curved line segment stripes, arranging the line segment stripes according to the first, second, and fifth distribution rules to form a projection pattern.

可选地,将第一图像和第二图像中的线段条纹依次进行匹配,包括:在线段条纹为彩色直线段条纹的情况下,按照预设第一匹配方式将第一图像和第二图像中的线段条纹依次进行匹配,其中,预设第一匹配方式包括:根据彩色直线段条纹的排列顺序将第一图像和第二图像中的线段条纹依次进行匹配;在线段条纹为彩色曲线段条纹或彩色折线段条纹的情况下,采用预设第一匹配方式或预设第二匹配方式将第一图像和第二图像中的线段条纹依次进行匹配,其中,预设第二匹配方式包括:获取线段条纹的中心点,根据线段条纹的中心点将第一图像和第二图像中的线段条纹依次进行匹配;在线段条纹为二值化曲线段条纹或二值化折线段条纹的情况下,采用预设第二匹配方式将第一图像和第二图像中的线段条纹依次进行匹配。Optionally, matching the line segments and stripes in the first image and the second image sequentially includes: when the line segments and stripes are colored straight line segments, matching the line segments and stripes in the first image and the second image sequentially according to a preset first matching method, wherein the preset first matching method includes: matching the line segments and stripes in the first image and the second image sequentially according to the arrangement order of the colored straight line segments; when the line segments and stripes are colored curved line segments or colored polyline segments, matching the line segments and stripes in the first image and the second image sequentially using a preset first matching method or a preset second matching method, wherein the preset second matching method includes: obtaining the center point of the line segments and stripes, and matching the line segments and stripes in the first image and the second image sequentially according to the center point of the line segments and stripes; when the line segments and stripes are binarized curved line segments or binarized polyline segments, matching the line segments and stripes in the first image and the second image sequentially using a preset second matching method.

可选地,采用预设第一匹配方式或预设第二匹配方式将第一图像和第二图像中的线段条纹依次进行匹配,包括:从两种预设匹配方式中随机选择一种预设匹配方式将第一图像和第二图像中的线段条纹依次进行第一次匹配,得到第一匹配结果;从两种预设匹配方式中选择另一种预设匹配方式将第一图像和第二图像中的线段条纹依次进行第二次匹配,得到第二匹配结果;从第一匹配结果和第二匹配结果中选择通过验证的匹配结果确定为最终匹配结果;在第一匹配结果和第二匹配结果都通过验证的情况下,确定第一匹配结果和第二匹配结果是否一致,在第一匹配结果和第二匹配结果的情况下,将第一匹配结果确定为最终匹配结果。Optionally, the line segments and stripes in the first image and the second image are matched sequentially using either a preset first matching method or a preset second matching method, including: randomly selecting one preset matching method from the two preset matching methods to perform a first matching of the line segments and stripes in the first image and the second image sequentially to obtain a first matching result; selecting another preset matching method from the two preset matching methods to perform a second matching of the line segments and stripes in the first image and the second image sequentially to obtain a second matching result; selecting the matching result that passes verification from the first matching result and the second matching result as the final matching result; if both the first matching result and the second matching result pass verification, determining whether the first matching result and the second matching result are consistent, and if both are consistent, determining the first matching result as the final matching result.

可选地,获取线段条纹的中心点,包括:在采用预设第二匹配方式将第一图像和第二图像中的线段条纹依次进行匹配的情况下,检测第一图像和第二图像中的线段条纹的边缘,得到二值化的边缘图像或者中心线,边缘图像中的边缘像素为白色,边缘图像中的背景为黑色或相反,边缘像素用于表示线段条纹的边缘轨迹;获取每个边缘像素的目标矩阵,目标矩阵用于表征边缘像素的曲率信息;根据目标矩阵确定线段条纹的边缘线或中心线。Optionally, obtaining the center point of the line segment stripes includes: when the line segment stripes in the first image and the second image are matched sequentially using a preset second matching method, detecting the edges of the line segment stripes in the first image and the second image to obtain a binarized edge image or center line, wherein the edge pixels in the edge image are white and the background in the edge image is black or the opposite, and the edge pixels are used to represent the edge trajectory of the line segment stripes; obtaining the target matrix of each edge pixel, wherein the target matrix is used to characterize the curvature information of the edge pixels; and determining the edge line or center line of the line segment stripes based on the target matrix.

可选地,根据目标矩阵确定线段条纹的中心点,包括:获取每个线段条纹中所有边缘像素对应的目标矩阵的特征值;将线段条纹对应的所有特征值中最小的特征值确定为目标特征值,并获取目标特征值对应的目标特征向量;获取目标特征向量的方向上的边缘像素坐标,并将其确定为目标边缘像素坐标;根据目标边缘像素坐标确定线段条纹的中心点。Optionally, determining the center point of the line segment stripe based on the target matrix includes: obtaining the feature values of the target matrix corresponding to all edge pixels in each line segment stripe; determining the smallest feature value among all feature values corresponding to the line segment stripe as the target feature value, and obtaining the target feature vector corresponding to the target feature value; obtaining the edge pixel coordinates in the direction of the target feature vector, and determining them as the target edge pixel coordinates; and determining the center point of the line segment stripe based on the target edge pixel coordinates.

可选地,获取线段条纹的中心点,包括:获取每个线段条纹中所有边缘像素的梯度;从所有边缘像素中选择梯度最大的边缘像素点确定为目标像素点;将目标像素点的亚像素中心确定为线段条纹的中心点。Optionally, obtaining the center point of the line segment stripe includes: obtaining the gradient of all edge pixels in each line segment stripe; selecting the edge pixel with the largest gradient from all edge pixels as the target pixel; and determining the sub-pixel center of the target pixel as the center point of the line segment stripe.

可选地,方法还包括:在确定线段条纹的中心点之后,去除曲率不在预设曲率范围内的线段条纹。Optionally, the method further includes: after determining the center point of the line segment stripe, removing line segment stripes whose curvature is not within a preset curvature range.

根据本申请实施例的另一方面,还提供了一种三维重建装置,包括:获取模块,设置为获取第一图像和第二图像,其中,第一图像和第二图像是由预先标定的双目相机分别采集目标图像得到的,目标图像是由投射到被测物体表面的投影图案形成的,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括以下之一:彩色条纹或二值化条纹,线段条纹的长度随机;匹配模块,设置为将第一图像和第二图像中的线段条纹依次进行匹配;重建模块,设置为根据第一图像和第二图像中相互匹配的线段条纹完成被测物体的三维重建。According to another aspect of the embodiments of this application, a three-dimensional reconstruction apparatus is also provided, comprising: an acquisition module configured to acquire a first image and a second image, wherein the first image and the second image are obtained by acquiring target images respectively by a pre-calibrated binocular camera, the target image being formed by a projection pattern projected onto the surface of the object being measured, the projection pattern being composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes including at least one of the following: colored stripes or binarized stripes, the length of the line segments and stripes being random; a matching module configured to sequentially match the line segments and stripes in the first image and the second image; and a reconstruction module configured to complete the three-dimensional reconstruction of the object being measured based on the mutually matched line segments and stripes in the first image and the second image.

根据本申请实施例的又一方面,还提供了一种三维重建系统,包括:至少两个图像采集设备、投影设备和第一处理器;投影设备设置为将投影图案投射到被测物体表面,其中,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括以下之一:彩色条纹或二值化条纹,线段条纹的长度随机;至少两个图像采集模块设置为从被测物体表面采集投影图案的图像,得到第一图像和第二图像;第一处理器设置为将第一图像和第二图像中的线段条纹依次进行匹配;根据第一图像和第二图像中匹配成功的线段条纹对被测物体进行三维重建。According to another aspect of the embodiments of this application, a three-dimensional reconstruction system is also provided, comprising: at least two image acquisition devices, a projection device, and a first processor; the projection device is configured to project a projection pattern onto the surface of a measured object, wherein the projection pattern is composed of line segments arranged according to a predetermined distribution rule, and the line segments include at least one of the following: colored stripes or binarized stripes, and the length of the line segments is random; at least two image acquisition modules are configured to acquire images of the projection pattern from the surface of the measured object to obtain a first image and a second image; the first processor is configured to sequentially match the line segments in the first image and the second image; and to perform three-dimensional reconstruction of the measured object based on the successfully matched line segments in the first image and the second image.

根据本申请实施例的又一方面,还提供了一种投影装置,设置为将投影图案投射到被测物体表面,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括以下之一:彩色条纹或二值化条纹。According to another aspect of the embodiments of this application, a projection device is also provided, configured to project a projection pattern onto the surface of a measured object. The projection pattern is composed of line segments arranged according to a predetermined distribution rule, and the line segments include at least one of the following: colored stripes or binarized stripes.

根据本申请实施例的又一方面,还提供了一种电子设备,包括:存储器,设置为存储程序指令;处理器,与存储器连接,设置为执行以下功能的程序指令:获取第一图像和第二图像,其中,第一图像和第二图像是由预先标定的双目相机分别采集目标图像得到的,目标图像是由投射到被测物体表面的投影图案形成的,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括以下之一:彩色条纹或二值化条纹,线段条纹的长度随机;将第一图像和第二图像中的线段条纹依次进行匹配;根据第一图像和第二图像中相互匹配的线段条纹完成被测物体的三维重建。According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory configured to store program instructions; and a processor connected to the memory, configured to perform the program instructions that perform the following functions: acquiring a first image and a second image, wherein the first image and the second image are obtained by acquiring target images respectively by a pre-calibrated binocular camera, the target image is formed by a projection pattern projected onto the surface of the object being measured, the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes include at least one of the following: colored stripes or binarized stripes, the length of the line segments and stripes is random; sequentially matching the line segments and stripes in the first image and the second image; and completing the three-dimensional reconstruction of the object being measured based on the mutually matched line segments and stripes in the first image and the second image.

根据本申请实施例的又一方面,还提供了一种非易失性存储介质,非易失性存储介质包括存储的计算机程序,其中,非易失性存储介质所在设备通过运行计算机程序执行上述的三维重建方法。According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-described three-dimensional reconstruction method by running the computer program.

根据本申请实施例的又一方面,还提供了一种计算机程序产品,包括计算机程序,计算机程序被处理器执行时实现上述方法的步骤。According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the above-described method.

在本申请实施例中,采用获取第一图像和第二图像,其中,第一图像和第二图像是由预先标定的双目相机分别采集投影图案的图像得到的,投影图案的图像是由投射到被测物体表面的投影图案形成的,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括:彩色条纹或二值化条纹,线段条纹的长度随机;将第一图像和第二图像中的线段条纹依次进行匹配;根据第一图像和第二图像中匹配成功的线段条纹对被测物体进行三维重建的方式,通过线段条纹组成的投影图案获取匹配参数,达到了通过线段条纹记载更多编码信息目的,从而实现了提高扫描效率的技术效果,进而解决了相关技术中由于码元的编码容量较小导致扫描效率低的技术问题。In this embodiment, a first image and a second image are acquired. The first image and the second image are obtained by acquiring images of a projection pattern from a pre-calibrated binocular camera. The projection pattern is formed by a projection pattern projected onto the surface of the object being measured. The projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule. The line segments and stripes include at least colored stripes or binarized stripes, and the length of the line segments and stripes is random. The line segments and stripes in the first image and the second image are matched sequentially. The object being measured is reconstructed in three dimensions based on the successfully matched line segments and stripes in the first image and the second image. By obtaining matching parameters through the projection pattern composed of line segments and stripes, the purpose of recording more encoded information through line segments and stripes is achieved, thereby improving the scanning efficiency and solving the technical problem of low scanning efficiency caused by the small encoding capacity of code elements in related technologies.

附图说明Attached Figure Description

此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

图1是根据本申请实施例的一种用于实现三维重建方法的计算机终端的硬件结构框图;Figure 1 is a hardware structure block diagram of a computer terminal for implementing a three-dimensional reconstruction method according to an embodiment of this application;

图2是根据本申请实施例的一种三维重建方法的流程图;Figure 2 is a flowchart of a three-dimensional reconstruction method according to an embodiment of this application;

图3是根据本申请实施例的一种投影图案的示意图;Figure 3 is a schematic diagram of a projection pattern according to an embodiment of this application;

图4是根据本申请实施例的一种彩色条纹编码顺序的示意图;Figure 4 is a schematic diagram of a color stripe encoding sequence according to an embodiment of this application;

图5是根据本申请实施例的另一种投影图案的示意图;Figure 5 is a schematic diagram of another projection pattern according to an embodiment of this application;

图6是根据本申请实施例的又一种投影图案的示意图;Figure 6 is a schematic diagram of another projection pattern according to an embodiment of this application;

图7是根据本申请实施例的一种三维重建装置的结构图。Figure 7 is a structural diagram of a three-dimensional reconstruction device according to an embodiment of this application.

具体实施方式Detailed Implementation

为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

本申请实施例所提供的三维重建方法实施例可以在移动终端、计算机终端或者类似的运算装置中执行。图1示出了一种用于实现三维重建方法的计算机终端的硬件结构框图。如图1所示,计算机终端10可以包括一个或多个(图中采用102a、102b,……,102n来示出)处理器(处理器可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理装置)、设置为存储数据的存储器104、以及设置为通信功能的传输模块106。除此以外,还可以包括:显示器、键盘、光标控制设备、输入/输出接口(I/O接口)、通用串行总线(USB)端口(可以作为I/O接口的端口中的一个端口)、网络接口、BUS总线。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述电子装置的结构造成限定。例如,计算机终端10还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。The three-dimensional reconstruction method embodiments provided in this application can be executed in mobile terminals, computer terminals, or similar computing devices. Figure 1 shows a hardware structure block diagram of a computer terminal for implementing the three-dimensional reconstruction method. As shown in Figure 1, the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 configured to store data, and a transmission module 106 configured for communication functions. In addition, it may also include: a display, a keyboard, a cursor control device, an input/output interface (I/O interface), a universal serial bus (USB) port (which may be one of the ports of the I/O interface), a network interface, and a BUS bus. Those skilled in the art will understand that the structure shown in Figure 1 is only illustrative and does not limit the structure of the above-described electronic device. For example, the computer terminal 10 may also include more or fewer components than shown in Figure 1, or have a different configuration than shown in Figure 1.

应当注意到的是上述一个或多个处理器和/或其他数据处理电路在本文中通常可以被称为“数据处理电路”。该数据处理电路可以全部或部分的体现为软件、硬件、固件或其他任意组合。此外,数据处理电路可为单个独立的处理模块,或全部或部分的结合到计算机终端10中的其他元件中的任意一个内。如本申请实施例中所涉及到的,该数据处理电路作为一种处理器控制(例如与接口连接的可变电阻终端路径的选择)。It should be noted that the aforementioned one or more processors and/or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be implemented wholly or partially as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be wholly or partially integrated into any other element in the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as processor control (e.g., selection of a variable resistor termination path connected to an interface).

存储器104可设置为存储应用软件的软件程序以及模块,如本申请实施例中的三维重建方法对应的程序指令/数据存储装置,处理器通过运行存储在存储器104内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的三维重建方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器远程设置的存储器,这些远程存储器可以通过网络连接至计算机终端10。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 104 can be configured to store software programs and modules for application software, such as the program instructions/data storage device corresponding to the 3D reconstruction method in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the aforementioned 3D reconstruction method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

传输模块106设置为经由一个网络接收或者发送数据。上述的网络具体实例可包括计算机终端10的通信供应商提供的无线网络。在一个实例中,传输模块106包括一个网络适配器(Network Interface Controller,NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输模块106可以为射频(Radio Frequency,RF)模块,其设置为通过无线方式与互联网进行通讯。The transmission module 106 is configured to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission module 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 106 may be a Radio Frequency (RF) module, configured to communicate with the Internet wirelessly.

显示器可以例如触摸屏式的液晶显示器(LCD),该液晶显示器可使得用户能够与计算机终端10的用户界面进行交互。The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10.

此处需要说明的是,在一些可选实施例中,上述图1所示的计算机设备可以包括硬件元件(包括电路)、软件元件(包括存储在计算机可读介质上的计算机代码)、或硬件元件和软件元件两者的结合。应当指出的是,图1仅为特定具体实例的一个实例,并且旨在示出可存在于上述计算机设备中的部件的类型。It should be noted that, in some alternative embodiments, the computer device shown in FIG1 may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be pointed out that FIG1 is merely one example of a specific embodiment and is intended to illustrate the types of components that may be present in the aforementioned computer device.

在上述运行环境下,本申请实施例提供了一种三维重建方法实施例,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。In the above operating environment, this application provides an embodiment of a three-dimensional reconstruction method. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than that shown here.

图2是根据本申请实施例的一种三维重建方法的流程图,如图2所示,该方法包括如下步骤:Figure 2 is a flowchart of a three-dimensional reconstruction method according to an embodiment of the present application. As shown in Figure 2, the method includes the following steps:

步骤S202,获取第一图像和第二图像,其中,第一图像和第二图像是由预先标定的双目相机分别采集投影图案的图像得到的,投影图案的图像是由投射到被测物体表面的投影图案形成的,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括:彩色条纹或二值化条纹,线段条纹的长度随机;Step S202: Acquire the first image and the second image, wherein the first image and the second image are obtained by acquiring images of the projection pattern by a pre-calibrated binocular camera respectively. The image of the projection pattern is formed by the projection pattern projected onto the surface of the object being measured. The projection pattern is composed of line segments and stripes arranged according to a pre-determined distribution rule. The line segments and stripes include at least: colored stripes or binarized stripes, and the length of the line segments and stripes is random.

在上述步骤S202中,双目相机表示设置于被测物体两侧的相机,例如:设置于左侧的左相机和设置于右侧的右相机。In step S202 above, a binocular camera refers to a camera set on both sides of the object being measured, for example: a left camera set on the left side and a right camera set on the right side.

步骤S204,将第一图像和第二图像中的线段条纹依次进行匹配;Step S204: Match the line segments and stripes in the first image and the second image sequentially;

在上述步骤S204中,线段条纹进行匹配的方式有多种,例如:采用线段条纹上的特征点进行匹配。In step S204 above, there are multiple ways to match line segments and stripes, such as matching by using feature points on the line segments and stripes.

步骤S206,根据第一图像和第二图像中匹配成功的线段条纹对被测物体进行三维重建。Step S206: Perform three-dimensional reconstruction of the object under test based on the successfully matched line segments and stripes in the first and second images.

通过上述步骤S202至步骤S206中的三维重建方法,采用获取第一图像和第二图像,其中,第一图像和第二图像是由预先标定的双目相机分别采集投影图案的图像得到的,投影图案的图像是由投射到被测物体表面的投影图案形成的,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括:彩色条纹或二值化条纹,线段条纹的长度随机;将第一图像和第二图像中的线段条纹依次进行匹配;根据第一图像和第二图像中匹配成功的线段条纹对被测物体进行三维重建的方式,通过线段条纹组成的投影图案获取匹配参数,达到了通过线段条纹记载更多编码信息目的,从而实现了提高扫描效率的技术效果,进而解决了相关技术中由于码元的编码容量较小导致扫描效率低的技术问题。以下详细说明。The three-dimensional reconstruction method in steps S202 to S206 above employs the acquisition of a first image and a second image. The first and second images are obtained by pre-calibrated binocular cameras acquiring images of a projection pattern. The projection pattern is formed by a projection pattern projected onto the surface of the object being measured. The projection pattern consists of line segments arranged according to a predetermined distribution rule. The line segments include at least colored or binarized stripes, and the length of the line segments is random. The line segments in the first and second images are matched sequentially. Based on the successfully matched line segments in the first and second images, the object being measured is reconstructed in three dimensions. By obtaining matching parameters through the projection pattern composed of line segments, the method achieves the goal of recording more encoded information through the line segments, thereby improving scanning efficiency and solving the technical problem of low scanning efficiency due to the small encoding capacity of code elements in related technologies. The following is a detailed explanation.

在一种可选的方式中,投影图案中的线条类型至少包括以下之一:彩色条纹、二值化条纹,例如由彩色条纹组成的投影图案,或由二值化条纹组成的投影图案。In one alternative approach, the line type in the projected pattern includes at least one of the following: colored stripes, binarized stripes, such as a projected pattern composed of colored stripes, or a projected pattern composed of binarized stripes.

可以理解的是,线段条纹的长度随机,投影图案中所有线段条纹的长度相同或者如图3所示,投影图案中的线段条纹长度各不相同,随机分布。It is understandable that the length of the line segments and stripes is random, and all the line segments and stripes in the projected pattern have the same length, or as shown in Figure 3, the lengths of the line segments and stripes in the projected pattern are different and randomly distributed.

需要进行说明的是,投影图案的确定过程分为两步,第一步需要确定线段条纹的类型,其中,彩色条纹至少包括以下之一:彩色直线段条纹、彩色曲线段条纹和彩色折线段条纹,二值化条纹至少包括以下之一:二值化直线段条纹、二值化曲线段条纹和二值化折线段条纹;第二步需要将线段条纹按照预先确定的分布规则排列组成投影图案。It should be noted that the process of determining the projection pattern consists of two steps. The first step is to determine the type of line segment stripes. Among them, colored stripes include at least one of the following: colored straight line stripes, colored curved stripes, and colored polygonal line stripes. Binarized stripes include at least one of the following: binarized straight line stripes, binarized curved stripes, and binarized polygonal line stripes. The second step is to arrange the line segment stripes according to a predetermined distribution rule to form the projection pattern.

具体地,从预先确定的分布规则中确定线段条纹的第一分布规则,其中,第一分布规则至少包括以下之一:横向相邻线段条纹间的水平间距相等、横向相邻线段条纹的水平间距依次等距增大和横向相邻线段条纹的水平间距在预设距离区间中随机选取;从预先确定的分布规则中确定线段条纹的第二分布规则和第三分布规则,其中,第二分布规则至少包括以下之一:纵向相邻线段条纹间的垂直距离相等、纵向相邻线段条纹间的垂直距离依次等距增大和纵向相邻线段条纹间的垂直距离在预设距离区间中随机选取,第三分布规则包括:横向相邻线段条纹按照预设顺序周期性排列,其中,每个周期内的横向相邻线段条纹的数量为预设数量,每个周期内包含多种颜色的线段条纹,预设顺序根据线段条纹的颜色确定;在线段条纹为彩色直线段条纹的情况下,将线段条纹按照第一分布规则、第二分布规则和第三分布规则排列组成投影图案;在线段条纹为二值化直线段条纹的情况下,将线段条纹按照第一分布规则和第二分布规则排列组成投影图案。Specifically, a first distribution rule for line segment stripes is determined from a predetermined distribution rule. This first distribution rule includes at least one of the following: equal horizontal spacing between adjacent horizontal line segment stripes; sequentially increasing horizontal spacing between adjacent horizontal line segment stripes; and randomly selecting the horizontal spacing between adjacent horizontal line segment stripes from a predetermined distance range. A second and third distribution rule for line segment stripes are determined from the predetermined distribution rule. The second distribution rule includes at least one of the following: equal vertical distance between adjacent vertical line segment stripes; sequentially increasing vertical distance between adjacent vertical line segment stripes; and randomly selecting the vertical distance between adjacent vertical line segment stripes from a predetermined distance range. The third distribution rule includes: adjacent horizontal line segment stripes are arranged periodically in a predetermined order. The number of adjacent horizontal line segment stripes in each period is a predetermined number, and each period contains line segment stripes of multiple colors. The predetermined order is determined based on the color of the line segment stripes. When the line segment stripes are colored straight line segment stripes, the line segment stripes are arranged according to the first, second, and third distribution rules to form a projection pattern. When the line segment stripes are binary straight line segment stripes, the line segment stripes are arranged according to the first and second distribution rules to form a projection pattern.

在线段条纹为彩色条纹的情况下,利用彩色信号作为编码信息,辅助提升条纹解码的准确性,解决局部线段由于双相机夹角引起的光学死角而丢失部分单相机码值信息的三维数据缺失问题,例如:利用邻域的颜色信息解码。彩色条纹可以是由多种不同颜色组合而成的,可以是RGB的颜色,例如可以是红色、蓝色、绿色,也可是蓝色和绿色也可以是其他的颜色,还可以是如RB,RG,BG等组合出的橙色,黄色,青色,白色,黑色等。When the line segments are colored stripes, color signals are used as encoding information to help improve the accuracy of stripe decoding. This solves the problem of missing 3D data due to optical blind spots caused by the angle between the two cameras, resulting in the loss of some single-camera code value information. For example, decoding can be performed using color information from the neighborhood. Colored stripes can be composed of multiple different colors, including RGB colors such as red, blue, and green, or blue and green, or other colors. They can also be combinations of colors like RB, RG, and BG to create orange, yellow, cyan, white, and black.

在一个实施例中,以一个周期内横向排列的线段条纹数量为8条为例,对该周期内的8条线段条纹进行颜色编码,如图4所示,预设顺序依次为RGBRBGGB(红色、绿色、蓝色、红色、蓝色、绿色、绿色、蓝色)。在计算机中可以生成对应的编码值,例如:红色为100,绿色为010,蓝色为001。In one embodiment, taking an example of 8 horizontally arranged line segments within a cycle, the 8 line segments within that cycle are color-coded, as shown in Figure 4. The preset order is RGBRBGGB (red, green, blue, red, blue, green, green, blue). Corresponding encoding values can be generated in the computer, for example: red is 100, green is 010, and blue is 001.

三维重建前获取条纹编码时,无论遇到物体边界、遮挡、反光等各种恶劣环境破坏条纹的都可以通过以上编码进行识别,避免了编码歧义的问题。将此编码图设计为一个周期,可实现1张简单颜色空间图像即可完成解码重建的工作,缩短了动态扫描时的单帧三维数据所需的图像序列采集持续时间,减少了编码解码的复杂度和计算消耗,避免了因颜色种类过多导致的算法复杂耗时,解码错误等问题。When acquiring stripe codes before 3D reconstruction, stripes can be identified regardless of various adverse environmental conditions such as object boundaries, occlusion, and reflections, thus avoiding encoding ambiguity. Designing this encoded image as a cycle allows decoding and reconstruction to be completed with just one simple color space image. This shortens the image sequence acquisition time required for a single frame of 3D data during dynamic scanning, reduces the complexity and computational cost of encoding and decoding, and avoids problems such as algorithm complexity, time consumption, and decoding errors caused by too many color types.

为了提高三维重建过程中的扫描效率,如图5和图6所示,投影图案可以由折线段条纹组成或曲线段条纹组成。To improve scanning efficiency during the 3D reconstruction process, as shown in Figures 5 and 6, the projection pattern can be composed of either broken line segments or curved line segments.

在线段条纹为彩色折线段条纹的情况下,从预先确定的分布规则中确定线段条纹的第四分布规则,其中,第四分布规则至少包括以下之一:折线段从左往右依次纵向分布、折线段倾斜预设角度分布,其中,折线段的夹角角度在预设角度范围内随机选取或所有折线段的夹角角度相等;When the line segment stripes are colored broken line segment stripes, a fourth distribution rule for the line segment stripes is determined from a predetermined distribution rule. The fourth distribution rule includes at least one of the following: the broken line segments are distributed longitudinally from left to right, or the broken line segments are distributed at a predetermined angle. The included angle of the broken line segments is randomly selected within the predetermined angle range or the included angle of all broken line segments is equal.

将线段条纹按照第一分布规则、第二分布规则、第三分布规则和第四分布规则排列组成投影图案;在线段条纹为二值化折线段条纹的情况下,将线段条纹按照第一分布规则、第二分布规则和第四分布规则排列组成投影图案。The line segments are arranged according to the first, second, third, and fourth distribution rules to form a projection pattern; when the line segments are binary broken line segments, the line segments are arranged according to the first, second, and fourth distribution rules to form a projection pattern.

在线段条纹为彩色曲线段条纹的情况下,从预先确定的分布规则中确定线段条纹的第五分布规则,其中,第五分布规则至少包括以下之一:曲线段从左往右依次纵向分布、曲线段倾斜预设角度分布,其中,折曲线段的弧度在预设弧度范围内随机选取或所有曲线段的弧度相等;将线段条纹按照第一分布规则、第二分布规则、第三分布规则和第五分布规则排列组成投影图案;在线段条纹为二值化曲线段条纹的情况下,将线段条纹按照第一分布规则、第二分布规则和第五分布规则排列组成投影图案。When the line segment stripes are colored curved line segment stripes, a fifth distribution rule for the line segment stripes is determined from a predetermined distribution rule. The fifth distribution rule includes at least one of the following: the curved line segments are distributed longitudinally from left to right; the curved line segments are distributed at a predetermined angle; the radii of the zigzag curve segments are randomly selected within a predetermined radii range or all the curved line segments have equal radii. The line segment stripes are arranged according to the first, second, third, and fifth distribution rules to form a projection pattern. When the line segment stripes are binary curved line segment stripes, the line segment stripes are arranged according to the first, second, and fifth distribution rules to form a projection pattern.

在将预先确定投影图案投射到被测物体表面后,形成投影图案的图像,由双目相机分别采集投影图案的图像,得到第一图像和第二图像,然后将第一图像和第二图像中的线段条纹进行匹配,在线段条纹为彩色直线段条纹的情况下,按照预设第一匹配方式将第一图像和第二图像中的线段条纹依次进行匹配,其中,预设第一匹配方式包括:根据彩色直线段条纹的排列顺序将第一图像和第二图像中的线段条纹依次进行匹配;在线段条纹为彩色曲线段条纹或彩色折线段条纹的情况下,采用预设第一匹配方式或预设第二匹配方式将第一图像和第二图像中的线段条纹依次进行匹配,其中,预设第二匹配方式包括:获取线段条纹的中心点,根据线段条纹的中心点将第一图像和第二图像中的线段条纹依次进行匹配;在线段条纹为二值化曲线段条纹或二值化折线段条纹的情况下,采用预设第二匹配方式将第一图像和第二图像中的线段条纹依次进行匹配。After a predetermined projection pattern is projected onto the surface of the object being measured, an image of the projection pattern is formed. A binocular camera captures the image of the projection pattern to obtain a first image and a second image. Then, the line segments and stripes in the first and second images are matched. If the line segments and stripes are colored straight lines, the line segments and stripes in the first and second images are matched sequentially according to a preset first matching method. The preset first matching method includes: matching the line segments and stripes in the first and second images sequentially according to the arrangement order of the colored straight lines and stripes; if the line segments and stripes are colored curved lines or colored polygonal lines, the line segments and stripes in the first and second images are matched sequentially using either a preset first matching method or a preset second matching method. The preset second matching method includes: obtaining the center point of the line segments and stripes, and matching the line segments and stripes in the first and second images sequentially based on the center point of the line segments and stripes; if the line segments and stripes are binarized curved lines or binarized polygonal lines, the line segments and stripes in the first and second images are matched sequentially using a preset second matching method.

在匹配的过程中,可以从两种预设匹配方式中随机选择一种预设匹配方式将第一图像和第二图像中的线段条纹依次进行第一次匹配,得到第一匹配结果;从两种预设匹配方式中选择另一种预设匹配方式将第一图像和第二图像中的线段条纹依次进行第二次匹配,得到第二匹配结果;从第一匹配结果和第二匹配结果中选择通过验证的匹配结果确定为最终匹配结果;在第一匹配结果和第二匹配结果都通过验证的情况下,确定第一匹配结果和第二匹配结果是否一致,在第一匹配结果和第二匹配结果的情况下,将第一匹配结果确定为最终匹配结果。During the matching process, one preset matching method can be randomly selected from two preset matching methods to perform a first matching of the line segments and stripes in the first image and the second image in sequence, resulting in a first matching result; another preset matching method can be selected from the two preset matching methods to perform a second matching of the line segments and stripes in the first image and the second image in sequence, resulting in a second matching result; the matching result that passes verification is selected from the first matching result and the second matching result and determined as the final matching result; if both the first matching result and the second matching result pass verification, it is determined whether the first matching result and the second matching result are consistent; if both are consistent, the first matching result is determined as the final matching result.

例如:第一次匹配采用的是第一预设匹配方式,第二次匹配就采用第二预设匹配方式。在一种可选的方式中,如果第一匹配结果未通过验证,则采用第二匹配结果作为最终匹配结果。For example, the first match uses the first preset matching method, and the second match uses the second preset matching method. In an optional method, if the first match result fails verification, the second match result is used as the final match result.

在采用预设第二匹配方式将第一图像和第二图像中的线段条纹依次进行匹配的情况下,可以通过以下方式获取线段条纹的中心点:检测第一图像和第二图像中的线段条纹的边缘,得到二值化的边缘图像或者中心线,边缘图像中的边缘像素为白色,边缘图像中的背景为黑色或相反,边缘像素设置为表示线段条纹的边缘轨迹;获取每个边缘像素的目标矩阵,目标矩阵设置为表征边缘像素的曲率信息;根据目标矩阵确定线段条纹的边缘线或中心线。When the line segments and stripes in the first and second images are matched sequentially using a preset second matching method, the center point of the line segments and stripes can be obtained in the following way: detect the edges of the line segments and stripes in the first and second images to obtain a binarized edge image or center line. The edge pixels in the edge image are white, and the background in the edge image is black or the opposite. The edge pixels are set to represent the edge trajectory of the line segments and stripes; obtain the target matrix for each edge pixel. The target matrix is set to represent the curvature information of the edge pixels; determine the edge line or center line of the line segments and stripes based on the target matrix.

需要进行说明的是,对线段条纹的边缘进行检测的方式可以采用边缘检测算法进行检测,例如:边缘检测器,来检测图像中的曲线段和折线段的边缘。这将生成一个二值化边缘图像,其中边缘像素为白色,背景为黑色。目标矩阵可以是Hessian矩阵,Hessian矩阵是一个2x2的矩阵,用于描述图像中线段条纹的二阶梯度信息。It should be noted that edge detection algorithms, such as edge detectors, can be used to detect the edges of curved and polyline segments in an image. This generates a binary edge image, where edge pixels are white and the background is black. The target matrix can be a Hessian matrix, a 2x2 matrix used to describe the second-order gradient information of the line segments in the image.

利用目标矩阵确定线段条纹的中心点的过程如下:获取每个线段条纹中所有边缘像素对应的目标矩阵的特征值;将线段条纹对应的所有特征值中最小的特征值确定为目标特征值,并获取目标特征值对应的目标特征向量;获取目标特征向量的方向上的边缘像素坐标,并将其确定为目标边缘像素坐标;根据目标边缘像素坐标确定线段条纹的中心点。The process of determining the center point of a line segment stripe using the target matrix is as follows: obtain the feature values of the target matrix corresponding to all edge pixels in each line segment stripe; determine the smallest feature value among all feature values corresponding to the line segment stripe as the target feature value, and obtain the target feature vector corresponding to the target feature value; obtain the edge pixel coordinates in the direction of the target feature vector, and determine them as the target edge pixel coordinates; determine the center point of the line segment stripe based on the target edge pixel coordinates.

具体地,对于每个边缘像素,根据其特征值来判断是否为曲线或折线段的一部分。通常,曲线段或折线段的特征值中至少有一个非常小的特征值,而另一个较大的特征值接近零。找到特征值中非常小的那个特征值对应的特征向量,它表示了曲线段或折线段的法线方向。在法线方向上,可以根据边缘像素位置以及特征向量来确定条纹中心线的位置。这可以通过计算沿着特征向量方向的像素坐标来实现。Specifically, for each edge pixel, its eigenvalues are used to determine whether it is part of a curve or polyline segment. Typically, a curve or polyline segment has at least one very small eigenvalue, while another larger eigenvalue is close to zero. The eigenvector corresponding to the very small eigenvalue is found; this vector represents the normal direction of the curve or polyline segment. The position of the stripe centerline can be determined based on the edge pixel location and the eigenvector along the normal direction. This can be achieved by calculating the pixel coordinates along the eigenvector direction.

在另一种可选的方式中,还可以通过以下方式获取线段条纹的中心点:获取每个线段条纹中所有边缘像素的梯度;从所有边缘像素中选择梯度最大的边缘像素点确定为目标像素点;将目标像素点的亚像素中心确定为线段条纹的中心点。In another alternative approach, the center point of the line segment stripe can be obtained by: obtaining the gradient of all edge pixels in each line segment stripe; selecting the edge pixel with the largest gradient from all edge pixels as the target pixel; and determining the sub-pixel center of the target pixel as the center point of the line segment stripe.

判断特征值是否满足曲线或折线段的条件。一般来说,曲线的特征值应该接近零,并且有一个特征值大于零,而折线段的特征值则应该有一个远大于另一个。Determine whether the eigenvalues satisfy the conditions for a curve or a broken line segment. Generally, the eigenvalues of a curve should be close to zero, and one of them should be greater than zero, while the eigenvalues of a broken line segment should have one that is much larger than the other.

在确定所有线段条纹的中心点后,可以对提取到的中心点组成的中心线进行后处理,例如:去除曲率不在预设曲率范围内的线段条纹,去除不必要的分支或平滑中心线以获得更准确和一致的结果。After determining the center points of all line segments, the center lines formed by the extracted center points can be post-processed, such as removing line segments whose curvature is not within the preset curvature range, removing unnecessary branches, or smoothing the center lines to obtain more accurate and consistent results.

图7是根据本申请实施例的一种三维重建装置的结构图,如图7,所示,该装置包括:Figure 7 is a structural diagram of a three-dimensional reconstruction device according to an embodiment of this application. As shown in Figure 7, the device includes:

获取模块70,设置为获取第一图像和第二图像,其中,第一图像和第二图像是由预先标定的双目相机分别采集目标图像得到的,目标图像是由投射到被测物体表面的投影图案形成的,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括以下之一:彩色条纹或二值化条纹,线段条纹的长度随机;The acquisition module 70 is configured to acquire a first image and a second image, wherein the first image and the second image are obtained by acquiring target images by a pre-calibrated binocular camera respectively. The target image is formed by a projection pattern projected onto the surface of the object being measured. The projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule. The line segments and stripes include at least one of the following: colored stripes or binarized stripes, and the length of the line segments and stripes is random.

匹配模块72,设置为将第一图像和第二图像中的线段条纹依次进行匹配;The matching module 72 is configured to match the line segments and stripes in the first image and the second image sequentially.

重建模块74,设置为根据第一图像和第二图像中相互匹配的线段条纹完成被测物体的三维重建。The reconstruction module 74 is configured to perform three-dimensional reconstruction of the object under test based on the matching line segments and stripes in the first and second images.

在上述三维重建装置的获取模块70中,包括:确定子模块,设置为确定线段条纹的类型,其中,彩色条纹至少包括以下之一:彩色直线段条纹、彩色曲线段条纹和彩色折线段条纹,二值化条纹至少包括以下之一:二值化直线段条纹、二值化曲线段条纹和二值化折线段条纹;将线段条纹按照预先确定的分布规则排列组成投影图案。The acquisition module 70 of the above-mentioned three-dimensional reconstruction device includes: a determination submodule, configured to determine the type of line segment stripes, wherein the colored stripes include at least one of the following: colored straight line stripes, colored curved stripes, and colored polyline stripes, and the binarized stripes include at least one of the following: binarized straight line stripes, binarized curved stripes, and binarized polyline stripes; and the line segment stripes are arranged according to a predetermined distribution rule to form a projection pattern.

确定子模块中包括:第一确定单元,设置为从预先确定的分布规则中确定线段条纹的第一分布规则,其中,第一分布规则至少包括以下之一:横向相邻线段条纹间的水平间距相等、横向相邻线段条纹的水平间距依次等距增大和横向相邻线段条纹的水平间距在预设距离区间中随机选取;从预先确定的分布规则中确定线段条纹的第二分布规则和第三分布规则,其中,第二分布规则至少包括以下之一:纵向相邻线段条纹间的垂直距离相等、纵向相邻线段条纹间的垂直距离依次等距增大和纵向相邻线段条纹间的垂直距离在预设距离区间中随机选取,第三分布规则包括:横向相邻线段条纹按照预设顺序周期性排列,其中,每个周期内的横向相邻线段条纹的数量为预设数量,每个周期内包含多种颜色的线段条纹,预设顺序根据线段条纹的颜色确定;在线段条纹为彩色直线段条纹的情况下,将线段条纹按照第一分布规则、第二分布规则和第三分布规则排列组成投影图案;在线段条纹为二值化直线段条纹的情况下,将线段条纹按照第一分布规则和第二分布规则排列组成投影图案。The determination submodule includes: a first determination unit, configured to determine a first distribution rule for line segment stripes from a predetermined distribution rule, wherein the first distribution rule includes at least one of the following: the horizontal spacing between adjacent horizontal line segment stripes is equal, the horizontal spacing between adjacent horizontal line segment stripes increases sequentially at equal intervals, and the horizontal spacing between adjacent horizontal line segment stripes is randomly selected from a preset distance range; and a second distribution rule and a third distribution rule for line segment stripes are determined from the predetermined distribution rule, wherein the second distribution rule includes at least one of the following: the vertical distance between adjacent vertical line segment stripes is equal, the vertical distance between adjacent vertical line segment stripes increases sequentially at equal intervals, and the vertical distance between adjacent vertical line segment stripes increases sequentially at equal intervals. The vertical distance between adjacent line segments is randomly selected within a preset distance range. The third distribution rule includes: horizontally adjacent line segments are arranged periodically in a preset order, wherein the number of horizontally adjacent line segments in each period is a preset number, and each period contains line segments of multiple colors. The preset order is determined according to the color of the line segments. When the line segments are colored straight line segments, the line segments are arranged according to the first, second, and third distribution rules to form a projection pattern. When the line segments are binary straight line segments, the line segments are arranged according to the first and second distribution rules to form a projection pattern.

第一确定单元中包含第一确定子单元和第二确定子单元,第一确定子单元,设置为在线段条纹为彩色折线段条纹的情况下,从预先确定的分布规则中确定线段条纹的第四分布规则,其中,第四分布规则至少包括以下之一:折线段从左往右依次纵向分布、折线段倾斜预设角度分布,其中,折线段的夹角角度在预设角度范围内随机选取或所有折线段的夹角角度相等;将线段条纹按照第一分布规则、第二分布规则、第三分布规则和第四分布规则排列组成投影图案;在线段条纹为二值化折线段条纹的情况下,将线段条纹按照第一分布规则、第二分布规则和第四分布规则排列组成投影图案。The first determining unit includes a first determining subunit and a second determining subunit. The first determining subunit is configured to determine a fourth distribution rule for the line segment stripes from a predetermined distribution rule when the line segment stripes are colored broken line segment stripes. The fourth distribution rule includes at least one of the following: the broken line segments are distributed longitudinally from left to right; the broken line segments are distributed at a predetermined angle, wherein the included angle of the broken line segments is randomly selected within a predetermined angle range or the included angle of all broken line segments is equal; the line segment stripes are arranged according to the first distribution rule, the second distribution rule, the third distribution rule, and the fourth distribution rule to form a projection pattern; when the line segment stripes are binary broken line segment stripes, the line segment stripes are arranged according to the first distribution rule, the second distribution rule, and the fourth distribution rule to form a projection pattern.

第二确定子单元,设置为在线段条纹为彩色曲线段条纹的情况下,从预先确定的分布规则中确定线段条纹的第五分布规则,其中,第五分布规则至少包括以下之一:曲线段从左往右依次纵向分布、曲线段倾斜预设角度分布,其中,折曲线段的弧度在预设弧度范围内随机选取或所有曲线段的弧度相等;将线段条纹按照第一分布规则、第二分布规则、第三分布规则和第五分布规则排列组成投影图案;在线段条纹为二值化曲线段条纹的情况下,将线段条纹按照第一分布规则、第二分布规则和第五分布规则排列组成投影图案。The second determining subunit is configured to, when the line segment stripes are colored curved line segment stripes, determine the fifth distribution rule of the line segment stripes from a predetermined distribution rule, wherein the fifth distribution rule includes at least one of the following: the curved segments are distributed longitudinally from left to right, or the curved segments are distributed at a predetermined angle, wherein the radii of the zigzag curve segments are randomly selected within a predetermined radii range or the radii of all curve segments are equal; the line segment stripes are arranged according to the first distribution rule, the second distribution rule, the third distribution rule, and the fifth distribution rule to form a projection pattern; when the line segment stripes are binary curved line segment stripes, the line segment stripes are arranged according to the first distribution rule, the second distribution rule, and the fifth distribution rule to form a projection pattern.

匹配模块72,包括:匹配子模块,设置为在线段条纹为彩色直线段条纹的情况下,按照预设第一匹配方式将第一图像和第二图像中的线段条纹依次进行匹配,其中,预设第一匹配方式包括:根据彩色直线段条纹的排列顺序将第一图像和第二图像中的线段条纹依次进行匹配;在线段条纹为彩色曲线段条纹或彩色折线段条纹的情况下,采用预设第一匹配方式或预设第二匹配方式将第一图像和第二图像中的线段条纹依次进行匹配,其中,预设第二匹配方式包括:获取线段条纹的中心点,根据线段条纹的中心点将第一图像和第二图像中的线段条纹依次进行匹配;在线段条纹为二值化曲线段条纹或二值化折线段条纹的情况下,采用预设第二匹配方式将第一图像和第二图像中的线段条纹依次进行匹配。The matching module 72 includes a matching submodule configured to, when the line segment stripes are colored straight line stripes, sequentially match the line segment stripes in the first image and the second image according to a preset first matching method. The preset first matching method includes: sequentially matching the line segment stripes in the first image and the second image according to the arrangement order of the colored straight line stripes; and, when the line segment stripes are colored curved line stripes or colored polyline stripes, sequentially matching the line segment stripes in the first image and the second image using either the preset first matching method or the preset second matching method. The preset second matching method includes: obtaining the center point of the line segment stripes and sequentially matching the line segment stripes in the first image and the second image according to the center point of the line segment stripes; and, when the line segment stripes are binarized curved line stripes or binarized polyline stripes, sequentially matching the line segment stripes in the first image and the second image using the preset second matching method.

匹配子模块中包括:匹配单元、第一获取单元和第二获取单元,匹配单元,设置为从两种预设匹配方式中随机选择一种预设匹配方式将第一图像和第二图像中的线段条纹依次进行第一次匹配,得到第一匹配结果;从两种预设匹配方式中选择另一种预设匹配方式将第一图像和第二图像中的线段条纹依次进行第二次匹配,得到第二匹配结果;从第一匹配结果和第二匹配结果中选择通过验证的匹配结果确定为最终匹配结果;在第一匹配结果和第二匹配结果都通过验证的情况下,确定第一匹配结果和第二匹配结果是否一致,在第一匹配结果和第二匹配结果的情况下,将第一匹配结果确定为最终匹配结果。The matching submodule includes a matching unit, a first acquisition unit, and a second acquisition unit. The matching unit is configured to randomly select one of two preset matching methods to perform a first matching of the line segments and stripes in the first image and the second image sequentially to obtain a first matching result; select another preset matching method to perform a second matching of the line segments and stripes in the first image and the second image sequentially to obtain a second matching result; select the matching result that passes verification from the first matching result and the second matching result to determine the final matching result; if both the first matching result and the second matching result pass verification, determine whether the first matching result and the second matching result are consistent; if both the first matching result and the second matching result are consistent, determine the first matching result as the final matching result.

第一获取单元,设置为在采用预设第二匹配方式将第一图像和第二图像中的线段条纹依次进行匹配的情况下,检测第一图像和第二图像中的线段条纹的边缘,得到二值化的边缘图像或者中心线,边缘图像中的边缘像素为白色,边缘图像中的背景为黑色或相反,边缘像素设置为表示线段条纹的边缘轨迹;获取每个边缘像素的目标矩阵,目标矩阵设置为表征边缘像素的曲率信息;根据目标矩阵确定线段条纹的边缘线或中心线。The first acquisition unit is configured to detect the edges of the line segments and stripes in the first image and the second image by sequentially matching the line segments and stripes in the first image and the second image using a preset second matching method, and obtain a binarized edge image or center line. The edge pixels in the edge image are white, and the background in the edge image is black or the opposite. The edge pixels are set to represent the edge trajectory of the line segments and stripes. The unit acquires a target matrix for each edge pixel, and the target matrix is set to represent the curvature information of the edge pixels. The unit determines the edge line or center line of the line segments and stripes based on the target matrix.

第一获取单元中包括:中心点子单元和去除子单元,中心点子单元,设置为获取每个线段条纹中所有边缘像素对应的目标矩阵的特征值;将线段条纹对应的所有特征值中最小的特征值确定为目标特征值,并获取目标特征值对应的目标特征向量;获取目标特征向量的方向上的边缘像素坐标,并将其确定为目标边缘像素坐标;根据目标边缘像素坐标确定线段条纹的中心点。The first acquisition unit includes a center point subunit and a removal subunit. The center point subunit is configured to acquire the feature values of the target matrix corresponding to all edge pixels in each line segment stripe; determine the smallest feature value among all feature values corresponding to the line segment stripe as the target feature value, and acquire the target feature vector corresponding to the target feature value; acquire the edge pixel coordinates in the direction of the target feature vector, and determine them as the target edge pixel coordinates; and determine the center point of the line segment stripe based on the target edge pixel coordinates.

第二获取单元,设置为获取每个线段条纹中所有边缘像素的梯度;从所有边缘像素中选择梯度最大的边缘像素点确定为目标像素点;将目标像素点的亚像素中心确定为线段条纹的中心点。The second acquisition unit is configured to acquire the gradient of all edge pixels in each line segment stripe; select the edge pixel with the largest gradient from all edge pixels and determine it as the target pixel; and determine the sub-pixel center of the target pixel as the center point of the line segment stripe.

去除子单元,设置为在确定线段条纹的中心点之后,去除曲率不在预设曲率范围内的线段条纹。Remove sub-units, configured to remove line segment stripes whose curvature is not within a preset curvature range after determining the center point of the line segment stripe.

本申请实施例中还提供了一种三维重建系统,包括:至少两个图像采集设备、投影设备和第一处理器;投影设备设置为将投影图案投射到被测物体表面,其中,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括以下之一:彩色条纹或二值化条纹,线段条纹的长度随机;至少两个图像采集模块设置为从被测物体表面采集投影图案的图像,得到第一图像和第二图像;第一处理器设置为将第一图像和第二图像中的线段条纹依次进行匹配;根据第一图像和第二图像中匹配成功的线段条纹对被测物体进行三维重建。This application embodiment also provides a three-dimensional reconstruction system, including: at least two image acquisition devices, a projection device, and a first processor; the projection device is configured to project a projection pattern onto the surface of a measured object, wherein the projection pattern is composed of line segments arranged according to a predetermined distribution rule, and the line segments include at least one of the following: colored stripes or binarized stripes, and the length of the line segments is random; at least two image acquisition modules are configured to acquire images of the projection pattern from the surface of the measured object to obtain a first image and a second image; the first processor is configured to sequentially match the line segments in the first image and the second image; and to perform three-dimensional reconstruction of the measured object based on the successfully matched line segments in the first image and the second image.

需要说明的是,上述三维重建系统设置为执行图2所示的三维重建方法,因此上述三维重建方法中的相关解释说明也适用于为该种三维重建装置,此处不再赘述。It should be noted that the above-mentioned three-dimensional reconstruction system is configured to execute the three-dimensional reconstruction method shown in Figure 2. Therefore, the relevant explanations and descriptions in the above-mentioned three-dimensional reconstruction method also apply to this type of three-dimensional reconstruction device, and will not be repeated here.

图2所示的三维重建方法适用于口腔扫描仪、面部扫描仪、工业扫描仪、专业扫描仪、手持扫描仪、固定扫描仪等三维扫描仪,可实现对牙齿、人脸、人身、工业产品、工业设备、文物、艺术品、假肢、医疗器具、建筑等物品或场景的三维重建等场景。上述三维重建系统可以示例性的理解为三维扫描仪与第一处理器通过有线或无线的方式连接组成,其中,三维重建系统中的至少两个图像采集设备和投影设备可以示例性的理解为三维扫描仪,第一处理器可以示例性的理解为手机、平板电脑、笔记本电脑、台式机、智能电视等设备,另外,第一处理器也可以内置于三维扫描仪内,即上述三维重建系统等同于三维扫描仪。The 3D reconstruction method shown in Figure 2 is applicable to various 3D scanners, including dental scanners, facial scanners, industrial scanners, professional scanners, handheld scanners, and fixed scanners. It can reconstruct 3D images of teeth, faces, bodies, industrial products, industrial equipment, cultural relics, artworks, prostheses, medical devices, and buildings. The aforementioned 3D reconstruction system can be understood as a 3D scanner and a first processor connected via wired or wireless means. At least two image acquisition devices and a projection device in the 3D reconstruction system can be understood as 3D scanners, and the first processor can be understood as a mobile phone, tablet, laptop, desktop computer, smart TV, or other similar device. Alternatively, the first processor can be built into the 3D scanner; in this case, the aforementioned 3D reconstruction system is equivalent to a 3D scanner.

需要说明的是,图7所示的三维重建装置设置为执行图2所示的三维重建方法,因此上述三维重建方法中的相关解释说明也适用于为该种三维重建装置,此处不再赘述。It should be noted that the three-dimensional reconstruction device shown in Figure 7 is configured to perform the three-dimensional reconstruction method shown in Figure 2. Therefore, the relevant explanations and descriptions in the above three-dimensional reconstruction method also apply to this type of three-dimensional reconstruction device, and will not be repeated here.

本申请实施例还提供了一种投影装置,设置为将投影图案投射到被测物体表面,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括以下之一:彩色条纹或二值化条纹,线段条纹的长度随机。This application embodiment also provides a projection device, configured to project a projection pattern onto the surface of a measured object. The projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule. The line segments and stripes include at least one of the following: colored stripes or binary stripes, and the length of the line segments and stripes is random.

本申请实施例还提供了一种电子设备,包括:存储器,设置为存储程序指令;处理器,与存储器连接,设置为执行以下功能的程序指令:获取第一图像和第二图像,其中,第一图像和第二图像是由预先标定的双目相机分别采集目标图像得到的,目标图像是由投射到被测物体表面的投影图案形成的,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括以下之一:彩色条纹或二值化条纹,线段条纹的长度随机;将第一图像和第二图像中的线段条纹依次进行匹配;根据第一图像和第二图像中相互匹配的线段条纹完成被测物体的三维重建。This application also provides an electronic device, including: a memory configured to store program instructions; and a processor connected to the memory, configured to execute program instructions that perform the following functions: acquiring a first image and a second image, wherein the first image and the second image are obtained by acquiring target images respectively by a pre-calibrated binocular camera, the target image is formed by a projection pattern projected onto the surface of the object being measured, the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes include at least one of the following: colored stripes or binarized stripes, the length of the line segments and stripes is random; sequentially matching the line segments and stripes in the first image and the second image; and completing the three-dimensional reconstruction of the object being measured based on the mutually matched line segments and stripes in the first image and the second image.

需要说明的是,上述电子设备设置为执行图2所示的三维重建方法,因此上述三维重建方法中的相关解释说明也适设置为该电子设备,此处不再赘述。It should be noted that the above-mentioned electronic device is configured to execute the three-dimensional reconstruction method shown in Figure 2. Therefore, the relevant explanations and descriptions in the above-mentioned three-dimensional reconstruction method are also applicable to this electronic device, and will not be repeated here.

本申请实施例还提供了一种非易失性存储介质,该非易失性存储介质包括存储的计算机程序,其中,该非易失性存储介质所在设备通过运行计算机程序执行以下三维重建方法:获取第一图像和第二图像,其中,第一图像和第二图像是由预先标定的双目相机分别采集目标图像得到的,目标图像是由投射到被测物体表面的投影图案形成的,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括以下之一:彩色条纹或二值化条纹,线段条纹的长度随机;将第一图像和第二图像中的线段条纹依次进行匹配;根据第一图像和第二图像中相互匹配的线段条纹完成被测物体的三维重建。This application embodiment also provides a non-volatile storage medium, which includes a stored computer program. The device containing the non-volatile storage medium executes the following three-dimensional reconstruction method by running the computer program: acquiring a first image and a second image, wherein the first image and the second image are obtained by acquiring target images respectively using a pre-calibrated binocular camera. The target image is formed by a projection pattern projected onto the surface of the object being measured. The projection pattern consists of line segments and stripes arranged according to a predetermined distribution rule. The line segments and stripes include at least one of the following: colored stripes or binarized stripes, and the length of the line segments and stripes is random; sequentially matching the line segments and stripes in the first image and the second image; and completing the three-dimensional reconstruction of the object being measured based on the mutually matched line segments and stripes in the first image and the second image.

需要说明的是,上述非易失性存储介质设置为执行图2所示的三维重建方法,因此上述三维重建方法中的相关解释说明也适设置为该非易失性存储介质,此处不再赘述。It should be noted that the above-mentioned non-volatile storage medium is configured to perform the three-dimensional reconstruction method shown in Figure 2. Therefore, the relevant explanations in the above-mentioned three-dimensional reconstruction method are also applicable to this non-volatile storage medium, and will not be repeated here.

本申请实施例还提供了一种计算机程序产品,包括计算机程序,其特征在于,计算机程序被处理器执行时实现三维重建方法的步骤。This application also provides a computer program product, including a computer program, characterized in that the computer program, when executed by a processor, implements the steps of a three-dimensional reconstruction method.

上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

在本申请的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

在本申请所提供的几个实施例中,应该理解到,所揭露的技术内容,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如单元的划分,可以为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.

作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

以上仅是本申请的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

工业实用性Industrial Applicability

本申请实施例提供的技术方案可适用于三维重建领域,在本申请实施例中,采用获取第一图像和第二图像,其中,第一图像和第二图像是由预先标定的双目相机分别采集投影图案的图像得到的,投影图案的图像是由投射到被测物体表面的投影图案形成的,投影图案由线段条纹按照预先确定的分布规则排列组成,线段条纹至少包括:彩色条纹或二值化条纹,线段条纹的长度随机;将第一图像和第二图像中的线段条纹依次进行匹配;根据第一图像和第二图像中匹配成功的线段条纹对被测物体进行三维重建的方式,通过线段条纹组成的投影图案获取匹配参数,达到了通过线段条纹记载更多编码信息目的,从而实现了提高扫描效率的技术效果,进而解决了相关技术中由于码元的编码容量较小导致扫描效率低的技术问题。The technical solution provided in this application embodiment is applicable to the field of three-dimensional reconstruction. In this application embodiment, a first image and a second image are acquired. The first image and the second image are obtained by acquiring images of a projection pattern by a pre-calibrated binocular camera. The projection pattern is formed by a projection pattern projected onto the surface of the object being measured. The projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule. The line segments and stripes include at least colored stripes or binarized stripes, and the length of the line segments and stripes is random. The line segments and stripes in the first image and the second image are matched sequentially. The object being measured is reconstructed in three dimensions based on the successfully matched line segments and stripes in the first image and the second image. By obtaining matching parameters through the projection pattern composed of line segments and stripes, the purpose of recording more encoded information through line segments and stripes is achieved, thereby improving the scanning efficiency and solving the technical problem of low scanning efficiency caused by the small encoding capacity of code elements in related technologies.

Claims (17)

一种三维重建方法,包括:A three-dimensional reconstruction method, comprising: 获取第一图像和第二图像,其中,所述第一图像和所述第二图像是由预先标定的双目相机分别采集投影图案的图像得到的,所述投影图案的图像是由投射到被测物体表面的投影图案形成的,所述投影图案由线段条纹按照预先确定的分布规则排列组成,所述线段条纹至少包括:彩色条纹或二值化条纹,所述线段条纹的长度随机;Acquire a first image and a second image, wherein the first image and the second image are obtained by acquiring images of a projection pattern by a pre-calibrated binocular camera, the image of the projection pattern is formed by the projection pattern projected onto the surface of the object being measured, the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes include at least: colored stripes or binarized stripes, and the length of the line segments and stripes is random; 将所述第一图像和所述第二图像中的线段条纹依次进行匹配;The line segments and stripes in the first image and the second image are matched sequentially; 根据所述第一图像和所述第二图像中匹配成功的线段条纹对所述被测物体进行三维重建。The object under test is reconstructed in three dimensions based on the line segments and stripes that are successfully matched in the first image and the second image. 根据权利要求1所述的方法,其中,所述投影图案通过以下方式确定:According to the method of claim 1, the projection pattern is determined by the following method: 确定所述线段条纹的类型,其中,所述彩色条纹至少包括以下之一:彩色直线段条纹、彩色曲线段条纹和彩色折线段条纹,所述二值化条纹至少包括以下之一:二值化直线段条纹、二值化曲线段条纹和二值化折线段条纹;The type of the line segment stripes is determined, wherein the colored stripes include at least one of the following: colored straight line stripes, colored curved line stripes, and colored polygonal line stripes, and the binarized stripes include at least one of the following: binarized straight line stripes, binarized curved line stripes, and binarized polygonal line stripes; 将所述线段条纹按照预先确定的分布规则排列组成所述投影图案。The line segments and stripes are arranged according to a predetermined distribution rule to form the projection pattern. 根据权利要求2所述的方法,其中,所述投影图案由线段条纹按照预先确定的分布规则排列组成,包括:According to the method of claim 2, the projected pattern is composed of line segments and stripes arranged according to a predetermined distribution rule, comprising: 从所述预先确定的分布规则中确定所述线段条纹的第一分布规则,其中,所述第一分布规则至少包括以下之一:横向相邻线段条纹间的水平间距相等、所述横向相邻线段条纹的水平间距依次等距增大和所述横向相邻线段条纹的水平间距在预设距离区间中随机选取;The first distribution rule of the line segment stripes is determined from the predetermined distribution rules, wherein the first distribution rule includes at least one of the following: the horizontal spacing between adjacent horizontal line segment stripes is equal, the horizontal spacing between adjacent horizontal line segment stripes increases sequentially at equal intervals, and the horizontal spacing between adjacent horizontal line segment stripes is randomly selected from a preset distance range; 从所述预先确定的分布规则中确定所述线段条纹的第二分布规则和第三分布规则,其中,所述第二分布规则至少包括以下之一:纵向相邻线段条纹间的垂直距离相等、所述纵向相邻线段条纹间的垂直距离依次等距增大和所述纵向相邻线段条纹间的垂直距离在预设距离区间中随机选取,所述第三分布规则包括:横向相邻线段条纹按照预设顺序周期性排列,其中,每个周期内的横向相邻线段条纹的数量为预设数量,每个周期内包含多种颜色的线段条纹,所述预设顺序根据所述线段条纹的颜色确定;The second and third distribution rules of the line segment stripes are determined from the predetermined distribution rules. The second distribution rule includes at least one of the following: the vertical distance between adjacent vertical line segment stripes is equal; the vertical distance between adjacent vertical line segment stripes increases sequentially at equal intervals; and the vertical distance between adjacent vertical line segment stripes is randomly selected from a preset distance range. The third distribution rule includes: adjacent horizontal line segment stripes are arranged periodically in a preset order. The number of adjacent horizontal line segment stripes in each period is a preset number, and each period contains line segment stripes of multiple colors. The preset order is determined according to the color of the line segment stripes. 在所述线段条纹为彩色直线段条纹的情况下,将所述线段条纹按照所述第一分布规则、所述第二分布规则和所述第三分布规则排列组成所述投影图案;When the line segment stripes are colored straight line segment stripes, the line segment stripes are arranged according to the first distribution rule, the second distribution rule and the third distribution rule to form the projection pattern; 在所述线段条纹为二值化直线段条纹的情况下,将所述线段条纹按照所述第一分布规则和所述第二分布规则排列组成所述投影图案。When the line segment stripes are binary straight line segment stripes, the line segment stripes are arranged according to the first distribution rule and the second distribution rule to form the projection pattern. 根据权利要求3所述的方法,其中,将所述线段条纹按照预先确定的分布规则排列组成所述投影图案,包括:According to the method of claim 3, arranging the line segments and stripes according to a predetermined distribution rule to form the projection pattern includes: 在所述线段条纹为所述彩色折线段条纹的情况下,从所述预先确定的分布规则中确定所述线段条纹的第四分布规则,其中,所述第四分布规则至少包括以下之一:折线段从左往右依次纵向分布、折线段倾斜预设角度分布,其中,折线段的夹角角度在预设角度范围内随机选取或所有折线段的夹角角度相等;When the line segment stripes are the colored broken line segment stripes, a fourth distribution rule for the line segment stripes is determined from the predetermined distribution rules, wherein the fourth distribution rule includes at least one of the following: the broken line segments are distributed longitudinally from left to right, or the broken line segments are distributed at a predetermined angle, wherein the included angle of the broken line segments is randomly selected within the predetermined angle range or the included angle of all broken line segments is equal; 将所述线段条纹按照所述第一分布规则、所述第二分布规则、所述第三分布规则和所述第四分布规则排列组成所述投影图案;The line segments and stripes are arranged according to the first distribution rule, the second distribution rule, the third distribution rule, and the fourth distribution rule to form the projection pattern; 在所述线段条纹为二值化折线段条纹的情况下,将所述线段条纹按照所述第一分布规则、所述第二分布规则和所述第四分布规则排列组成所述投影图案。When the line segment stripes are binary broken line segment stripes, the line segment stripes are arranged according to the first distribution rule, the second distribution rule and the fourth distribution rule to form the projection pattern. 根据权利要求3所述的方法,其中,将所述线段条纹按照预先确定的分布规则排列组成所述投影图案,包括:According to the method of claim 3, arranging the line segments and stripes according to a predetermined distribution rule to form the projection pattern includes: 在所述线段条纹为所述彩色曲线段条纹的情况下,从所述预先确定的分布规则中确定所述线段条纹的第五分布规则,其中,所述第五分布规则至少包括以下之一:曲线段从左往右依次纵向分布、曲线段倾斜预设角度分布,其中,曲线段的弧度在预设弧度范围内随机选取或所有曲线段的弧度相等;When the line segment stripes are the colored curved segment stripes, a fifth distribution rule for the line segment stripes is determined from the predetermined distribution rules, wherein the fifth distribution rule includes at least one of the following: the curved segments are distributed longitudinally from left to right, or the curved segments are distributed at a predetermined angle, wherein the radii of the curved segments are randomly selected within a predetermined radii range or the radii of all curved segments are equal. 将所述线段条纹按照所述第一分布规则、所述第二分布规则、所述第三分布规则和所述第五分布规则排列组成所述投影图案;The line segments and stripes are arranged according to the first distribution rule, the second distribution rule, the third distribution rule, and the fifth distribution rule to form the projection pattern; 在所述线段条纹为二值化曲线段条纹的情况下,将所述线段条纹按照所述第一分布规则、所述第二分布规则和所述第五分布规则排列组成所述投影图案。When the line segment stripes are binary curve segment stripes, the line segment stripes are arranged according to the first distribution rule, the second distribution rule and the fifth distribution rule to form the projection pattern. 根据权利要求1所述的方法,其中,将所述第一图像和所述第二图像中的线段条纹依次进行匹配,包括:According to the method of claim 1, the step of sequentially matching the line segments and stripes in the first image and the second image includes: 在所述线段条纹为彩色直线段条纹的情况下,按照预设第一匹配方式将所述第一图像和所述第二图像中的线段条纹依次进行匹配,其中,所述预设第一匹配方式包括:根据所述彩色直线段条纹的排列顺序将所述第一图像和所述第二图像中的线段条纹依次进行匹配;When the line segments are colored straight line segments, the line segments in the first image and the second image are matched sequentially according to a preset first matching method. The preset first matching method includes: matching the line segments in the first image and the second image sequentially according to the arrangement order of the colored straight line segments. 在所述线段条纹为彩色曲线段条纹或彩色折线段条纹的情况下,采用所述预设第一匹配方式或预设第二匹配方式将所述第一图像和所述第二图像中的线段条纹依次进行匹配,其中,所述预设第二匹配方式包括:获取所述线段条纹的中心点,根据所述线段条纹的中心点将所述第一图像和所述第二图像中的线段条纹依次进行匹配;When the line segment stripes are colored curved line segment stripes or colored broken line segment stripes, the line segment stripes in the first image and the second image are matched sequentially using the preset first matching method or the preset second matching method. The preset second matching method includes: obtaining the center point of the line segment stripes, and matching the line segment stripes in the first image and the second image sequentially according to the center point of the line segment stripes. 在所述线段条纹为二值化曲线段条纹或二值化折线段条纹的情况下,采用所述预设第二匹配方式将所述第一图像和所述第二图像中的线段条纹依次进行匹配。When the line segment stripes are binarized curve segment stripes or binarized polyline segment stripes, the preset second matching method is used to match the line segment stripes in the first image and the second image sequentially. 根据权利要求6所述的方法,其中,采用所述预设第一匹配方式或预设第二匹配方式将所述第一图像和所述第二图像中的线段条纹依次进行匹配,包括:According to the method of claim 6, the step of sequentially matching the line segments and stripes in the first image and the second image using the preset first matching method or the preset second matching method includes: 从两种预设匹配方式中随机选择一种预设匹配方式将所述第一图像和所述第二图像中的线段条纹依次进行第一次匹配,得到第一匹配结果;Randomly select one of the two preset matching methods to perform the first matching of the line segments and stripes in the first image and the second image in sequence to obtain the first matching result; 从两种预设匹配方式中选择另一种预设匹配方式将所述第一图像和所述第二图像中的线段条纹依次进行第二次匹配,得到第二匹配结果;Select one preset matching method from the two preset matching methods, and perform a second matching on the line segments and stripes in the first image and the second image in sequence to obtain a second matching result; 从所述第一匹配结果和所述第二匹配结果中选择通过验证的匹配结果确定为最终匹配结果;The final matching result is determined by selecting the verified matching result from the first matching result and the second matching result; 在所述第一匹配结果和所述第二匹配结果都通过验证的情况下,确定所述第一匹配结果和所述第二匹配结果是否一致,在所述第一匹配结果和所述第二匹配结果的情况下,将所述第一匹配结果确定为最终匹配结果。If both the first matching result and the second matching result pass verification, determine whether the first matching result and the second matching result are consistent. If both the first matching result and the second matching result are consistent, determine the first matching result as the final matching result. 根据权利要求6所述的方法,其中,获取所述线段条纹的中心点,包括:According to the method of claim 6, obtaining the center point of the line segment stripe includes: 在采用所述预设第二匹配方式将所述第一图像和所述第二图像中的线段条纹依次进行匹配的情况下,检测所述第一图像和所述第二图像中的线段条纹的边缘,得到二值化的边缘图像或者中心线,所述边缘图像中的边缘像素为白色,所述边缘图像中的背景为黑色或相反,所述边缘像素用于表示所述线段条纹的边缘轨迹;When the line segments and stripes in the first image and the second image are matched sequentially using the preset second matching method, the edges of the line segments and stripes in the first image and the second image are detected to obtain a binarized edge image or center line. The edge pixels in the edge image are white, and the background of the edge image is black or the opposite. The edge pixels are used to represent the edge trajectory of the line segments and stripes. 获取每个边缘像素的目标矩阵,所述目标矩阵用于表征所述边缘像素的曲率信息;Obtain the target matrix for each edge pixel, the target matrix being used to characterize the curvature information of the edge pixel; 根据所述目标矩阵确定所述线段条纹的边缘线或中心线。The edge line or center line of the line segment stripe is determined based on the target matrix. 根据权利要求8所述的方法,其中,根据所述目标矩阵确定所述线段条纹的中心点,包括:According to the method of claim 8, determining the center point of the line segment stripe based on the target matrix includes: 获取每个线段条纹中所有边缘像素对应的目标矩阵的特征值;Obtain the feature values of the target matrix corresponding to all edge pixels in each line segment stripe; 将线段条纹对应的所有特征值中最小的特征值确定为目标特征值,并获取所述目标特征值对应的目标特征向量;The smallest feature value among all feature values corresponding to the line segment stripes is determined as the target feature value, and the target feature vector corresponding to the target feature value is obtained; 获取所述目标特征向量的方向上的边缘像素坐标,并将其确定为目标边缘像素坐标;Obtain the edge pixel coordinates along the direction of the target feature vector and determine them as the target edge pixel coordinates; 根据所述目标边缘像素坐标确定所述线段条纹的中心点。The center point of the line segment stripe is determined based on the target edge pixel coordinates. 根据权利要求9所述的方法,其中,所述方法还包括:在确定所述线段条纹的中心点之后,去除曲率不在预设曲率范围内的线段条纹。According to the method of claim 9, the method further includes: after determining the center point of the line segment stripe, removing line segment stripes whose curvature is not within a preset curvature range. 根据权利要求6所述的方法,其中,获取所述线段条纹的中心点,包括:According to the method of claim 6, obtaining the center point of the line segment stripe includes: 获取每个线段条纹中所有边缘像素的梯度;Obtain the gradient of all edge pixels in each line segment stripe; 从所有边缘像素中选择梯度最大的边缘像素点确定为目标像素点;Select the edge pixel with the largest gradient from all edge pixels and determine it as the target pixel; 将所述目标像素点的亚像素中心确定为所述线段条纹的中心点。The subpixel center of the target pixel is determined as the center point of the line segment stripe. 一种三维重建装置,包括:A three-dimensional reconstruction device, comprising: 获取模块,设置为获取第一图像和第二图像,其中,所述第一图像和所述第二图像是由预先标定的双目相机分别采集目标图像得到的,所述目标图像是由投射到被测物体表面的投影图案形成的,所述投影图案由线段条纹按照预先确定的分布规则排列组成,所述线段条纹至少包括以下之一:彩色条纹或二值化条纹,所述线段条纹的长度随机;The acquisition module is configured to acquire a first image and a second image, wherein the first image and the second image are obtained by acquiring target images by a pre-calibrated binocular camera, the target image is formed by a projection pattern projected onto the surface of the object being measured, the projection pattern is composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes include at least one of the following: colored stripes or binarized stripes, and the length of the line segments and stripes is random; 匹配模块,设置为将所述第一图像和所述第二图像中的线段条纹依次进行匹配;The matching module is configured to match the line segments and stripes in the first image and the second image sequentially; 重建模块,设置为根据所述第一图像和所述第二图像中相互匹配的线段条纹完成被测物体的三维重建。The reconstruction module is configured to perform three-dimensional reconstruction of the object under test based on the matching line segments and stripes in the first image and the second image. 一种三维重建系统,包括:A three-dimensional reconstruction system, comprising: 至少两个图像采集设备、投影设备和第一处理器;At least two image acquisition devices, a projection device, and a first processor; 所述投影设备设置为将投影图案投射到被测物体表面,其中,所述投影图案由线段条纹按照预先确定的分布规则排列组成,所述线段条纹至少包括以下之一:彩色条纹或二值化条纹,所述线段条纹的长度随机;The projection device is configured to project a projection pattern onto the surface of the object being measured, wherein the projection pattern is composed of line segments arranged according to a predetermined distribution rule, and the line segments include at least one of the following: colored stripes or binary stripes, and the length of the line segments is random. 所述至少两个图像采集模块设置为从被测物体表面采集投影图案的图像,得到第一图像和第二图像;The at least two image acquisition modules are configured to acquire images of the projected pattern from the surface of the object being measured, thereby obtaining a first image and a second image; 第一处理器设置为将所述第一图像和所述第二图像中的线段条纹依次进行匹配;根据所述第一图像和所述第二图像中匹配成功的线段条纹对所述被测物体进行三维重建。The first processor is configured to sequentially match the line segments and stripes in the first image and the second image; and to perform three-dimensional reconstruction of the object under test based on the successfully matched line segments and stripes in the first image and the second image. 一种投影装置,设置为将投影图案投射到被测物体表面,A projection device is configured to project a pattern onto the surface of a measured object. 所述投影图案由线段条纹按照预先确定的分布规则排列组成,所述线段条纹至少包括以下之一:彩色条纹或二值化条纹,所述线段条纹的长度随机。The projected pattern is composed of line segments arranged according to a predetermined distribution rule. The line segments include at least one of the following: colored stripes or binarized stripes, and the length of the line segments is random. 一种电子设备,包括:An electronic device, comprising: 存储器,设置为存储程序指令;The memory is configured to store program instructions; 处理器,与所述存储器连接,设置为执行以下功能的程序指令:获取第一图像和第二图像,其中,所述第一图像和所述第二图像是由预先标定的双目相机分别采集目标图像得到的,所述目标图像是由投射到被测物体表面的投影图案形成的,所述投影图案由线段条纹按照预先确定的分布规则排列组成,所述线段条纹至少包括以下之一:彩色条纹或二值化条纹,所述线段条纹的长度随机;将所述第一图像和所述第二图像中的线段条纹依次进行匹配;根据所述第一图像和所述第二图像中相互匹配的线段条纹完成被测物体的三维重建。A processor, connected to the memory, is configured to execute program instructions that perform the following functions: acquiring a first image and a second image, wherein the first image and the second image are obtained by acquiring target images respectively by a pre-calibrated binocular camera, the target image being formed by a projection pattern projected onto the surface of the object being measured, the projection pattern being composed of line segments and stripes arranged according to a predetermined distribution rule, the line segments and stripes including at least one of the following: colored stripes or binarized stripes, the length of the line segments and stripes being random; sequentially matching the line segments and stripes in the first image and the second image; and completing the three-dimensional reconstruction of the object being measured based on the mutually matching line segments and stripes in the first image and the second image. 一种非易失性存储介质,所述非易失性存储介质包括存储的计算机程序,其中,所述非易失性存储介质所在设备通过运行所述计算机程序执行权利要求1至8中任意一项所述的三维重建方法。A non-volatile storage medium includes a stored computer program, wherein the device containing the non-volatile storage medium executes the three-dimensional reconstruction method according to any one of claims 1 to 8 by running the computer program. 一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现权利要求1所述三维重建方法的步骤。A computer program product includes a computer program that, when executed by a processor, implements the steps of the three-dimensional reconstruction method of claim 1.
PCT/CN2025/091406 2024-04-26 2025-04-27 Three-dimensional reconstruction method and apparatus Pending WO2025223567A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202410515673.4A CN120852632A (en) 2024-04-26 2024-04-26 Three-dimensional reconstruction method and device
CN202410515673.4 2024-04-26

Publications (1)

Publication Number Publication Date
WO2025223567A1 true WO2025223567A1 (en) 2025-10-30

Family

ID=97407333

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2025/091406 Pending WO2025223567A1 (en) 2024-04-26 2025-04-27 Three-dimensional reconstruction method and apparatus

Country Status (2)

Country Link
CN (1) CN120852632A (en)
WO (1) WO2025223567A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108267097A (en) * 2017-07-17 2018-07-10 杭州先临三维科技股份有限公司 Three-dimensional reconstruction method and device based on binocular three-dimensional scanning system
CN108592823A (en) * 2017-12-04 2018-09-28 湖南大学 A kind of coding/decoding method based on binocular vision color fringe coding
CN108592824A (en) * 2018-07-16 2018-09-28 清华大学 A kind of frequency conversion fringe projection structural light measurement method based on depth of field feedback
CN110686599A (en) * 2019-10-31 2020-01-14 中国科学院自动化研究所 Three-dimensional measurement method, system and device based on color Gray code structured light
WO2022021678A1 (en) * 2020-07-31 2022-02-03 中国科学院深圳先进技术研究院 Three-dimensional object reconstruction method and terminal device
CN114332349A (en) * 2021-11-17 2022-04-12 浙江智慧视频安防创新中心有限公司 Binocular structured light edge reconstruction method and system and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108267097A (en) * 2017-07-17 2018-07-10 杭州先临三维科技股份有限公司 Three-dimensional reconstruction method and device based on binocular three-dimensional scanning system
CN108592823A (en) * 2017-12-04 2018-09-28 湖南大学 A kind of coding/decoding method based on binocular vision color fringe coding
CN108592824A (en) * 2018-07-16 2018-09-28 清华大学 A kind of frequency conversion fringe projection structural light measurement method based on depth of field feedback
CN110686599A (en) * 2019-10-31 2020-01-14 中国科学院自动化研究所 Three-dimensional measurement method, system and device based on color Gray code structured light
WO2022021678A1 (en) * 2020-07-31 2022-02-03 中国科学院深圳先进技术研究院 Three-dimensional object reconstruction method and terminal device
CN114332349A (en) * 2021-11-17 2022-04-12 浙江智慧视频安防创新中心有限公司 Binocular structured light edge reconstruction method and system and storage medium

Also Published As

Publication number Publication date
CN120852632A (en) 2025-10-28

Similar Documents

Publication Publication Date Title
US10872439B2 (en) Method and device for verification
US20260045033A1 (en) Method, Apparatus and System for Three-Dimensional Reconstruction
CN103336938B (en) A kind of recognition methods based on one-dimensional bar code image
US10726580B2 (en) Method and device for calibration
CN110686599A (en) Three-dimensional measurement method, system and device based on color Gray code structured light
CN102878950A (en) Systems and methods for three-dimensional profiling
CN104766037A (en) Two-dimension code recognition method and device
CN106485275A (en) A kind of cover-plate glass of realizing positions, with liquid crystal display screen, the method fitted
US8727221B1 (en) Color micro bar code marker and system
CN106683071A (en) Image splicing method and image splicing device
US11270100B2 (en) Face image detection method and terminal device
EP4571658A1 (en) Three-dimensional reconstruction method, apparatus and system
EP4571659A1 (en) Three-dimensional reconstruction method, apparatus and system
WO2025223567A1 (en) Three-dimensional reconstruction method and apparatus
CN113723380B (en) Face recognition method, device, equipment and storage medium based on radar technology
CN111444806A (en) Commodity touch information clustering method, device and equipment based on monitoring video
CN115619636A (en) Image stitching method, electronic device and storage medium
CN113822280B (en) Text recognition method, device, system and nonvolatile storage medium
CN112197708A (en) Measuring method and device, electronic device and storage medium
CN105681774B (en) The method and terminal of a kind of image procossing
CN113344068B (en) Material processing methods, devices, electronic equipment and computer-readable storage media
Li et al. Screen-camera calibration using a thread
CN109871724A (en) A kind of method and apparatus of two dimensional code for identification
Huang et al. Pen Tagon-Match (PMatch) for Aerial Images: Using View-Invariant Planar Region for Homography Estimation
CN118102127A (en) Method and device for constructing ocean color images, electronic equipment, and camera

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 25793919

Country of ref document: EP

Kind code of ref document: A1