Three-dimensional reconstruction method and device, electronic equipment and storage medium
Through multiple sets of rotating stripe image projection and point cloud data processing, the problem of being unable to capture the fine details of complex objects in the existing technology is solved, and the accuracy and detailed features of the three-dimensional reconstruction are achieved.
Patent Information
- Application Number
- CN202410896760.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-09-24
AI Technical Summary
In the existing technology, a single horizontal and vertical stripe or a single optimal direction stripe cannot capture the subtle undulation details of the surface of a complex object, resulting in inaccurate three-dimensional reconstruction.
Using multiple sets of rotating stripe image projections in different directions, by acquiring and processing the collected images of multiple rotating stripe image groups, the low-resolution areas are determined and the point cloud data is replaced to generate target point cloud data without low-resolution areas.
It achieves complete and accurate restoration of the subtle topography of complex object surfaces, taking into account the preservation of different detailed features, and improves the accuracy and completeness of three-dimensional reconstruction.
Smart Images

Figure CN118691749A
Abstract
Description
Technical Field
[0001] The present application relates to the field of three-dimensional reconstruction technology, and in particular to a three-dimensional reconstruction method, device, electronic device and storage medium. Background Art
[0002] The multi-frequency phase shifted area array structured light technology based on sinusoidal fringes is being used more and more widely in high-precision 3D reconstruction scenarios. This technology can quickly scan the object to be measured in a short time, obtain dense point cloud data, and realize 3D reconstruction.
[0003] In the prior art, a three-dimensional reconstruction device is usually composed of a projector and one or two cameras. The projector uses structured light stripes with single horizontal and vertical stripes or single optimal direction stripes to project onto the object. The camera collects the image on the object and generates a point cloud to achieve three-dimensional reconstruction.
[0004] However, in the prior art, a single horizontal or vertical stripe or a single optimal direction stripe cannot capture the subtle undulating details on the surface of a complex object, which is not conducive to accurately restoring the three-dimensional morphology of the object being measured. Summary of the invention
[0005] The purpose of the present application is to provide a three-dimensional reconstruction method, device, electronic device and storage medium to address the problem that the prior art cannot capture the subtle undulating details of the surface of complex objects.
[0006] To achieve the above objectives, the technical solutions adopted in this application are as follows:
[0007] In a first aspect, the present application provides a three-dimensional reconstruction method, the method comprising:
[0008] Acquire an original fringe image group, wherein the original fringe image group includes a plurality of original fringe images, and the fringe phases of the original fringe images are shifted in sequence according to a preset shift amount;
[0009] Generate a plurality of sequentially arranged rotated fringe image groups according to the original fringe image group, each rotated fringe image group includes a first image group and a second image group, the deflection angles of the fringe of each image in the first image group and the fringe of the corresponding image in the first image group of the adjacent rotated fringe image group meet a preset condition, and the fringe of each image in the first image group is orthogonal to the fringe of the corresponding image in the second image;
[0010] Acquire multiple acquisition image groups obtained by photographing the object to be reconstructed by a photographing device, each acquisition image group includes a first acquisition group and a second acquisition group, each image in the first acquisition group is obtained by correspondingly acquiring each image in the first image group, and each image in the second acquisition group is obtained by correspondingly acquiring each image in the second image group, wherein before the photographing device photographs, a projection device sequentially projects each rotating fringe image group onto the object to be reconstructed;
[0011] Determine the low-resolution area corresponding to each acquired image group according to the pixel phase value of each image in the first acquired image group in each acquired image group;
[0012] The point cloud data corresponding to each acquired image group is determined, and the point cloud data corresponding to at least one acquired image group is replaced according to the low-resolution area corresponding to each acquired image group to obtain the target point cloud data without the low-resolution area corresponding to the object to be reconstructed.
[0013] Optionally, determining the low-resolution area corresponding to each acquired image group according to the pixel phase value of each image in the first acquired image group in each acquired image group includes:
[0014] performing phase decomposition calculation on the phase of each image in the first acquisition group to obtain an absolute phase map;
[0015] Determine a difference in pixel phase values of two end pixels of a preset horizontal range of each pixel in the absolute phase map;
[0016] Determining a plurality of low-resolution points according to the difference and a preset phase threshold;
[0017] The multiple low-resolution points are connected to form a low-resolution area.
[0018] Optionally, determining the difference between pixel phase values of two end point pixels of a preset horizontal range of each pixel in the absolute phase map includes:
[0019] Each pixel in the absolute phase map is traversed, and for a current pixel traversed, a difference between a phase value of a preset number of pixels on the left and a phase value of a preset number of pixels on the right of the current pixel is calculated.
[0020] Optionally, connecting the multiple low-resolution points to form a low-resolution area includes:
[0021] Performing a breadth-first search, connecting at least two low-resolution points whose distance between each low-resolution point is not greater than a preset distance to form a low-resolution region to be selected;
[0022] It is determined whether the area of the low-resolution region to be selected is greater than a preset area threshold. If so, the low-resolution region to be selected is used as the low-resolution region.
[0023] Optionally, replacing the point cloud data corresponding to at least one acquired image group according to the low-resolution area corresponding to each acquired image group includes:
[0024] Determine a second acquisition image group according to a target position of a low-resolution area corresponding to the first acquisition image group, wherein the target position in the second acquisition image group is not of low resolution;
[0025] The point cloud data corresponding to the target position in the first acquired image group is replaced based on the point cloud data corresponding to the target position in the second acquired image group.
[0026] Optionally, generating a plurality of sequentially arranged rotated fringe image groups according to the original fringe image group comprises:
[0027] Acquire device parameters, wherein the device parameters include at least: internal parameters of the projection device, optical center coordinates of the projection device, and optical center coordinates of the shooting device;
[0028] determining a first fringe angle according to the device parameters;
[0029] Rotating each image in the original fringe image group by the first fringe angle according to a preset direction to obtain a first image group in a first rotated fringe image group;
[0030] The first image group is rotated 90 degrees in a preset direction to obtain a second image group.
[0031] Optionally, determining the first stripe angle according to the device parameter includes:
[0032] Taking the difference between the optical center coordinates of the projection device and the optical center coordinates of the shooting device as a baseline vector;
[0033] Determining a projection baseline vector according to the projection device internal parameters and the baseline vector;
[0034] The angle between the projection baseline vector and the horizontal axis of the projection normalization plane is taken as the first fringe angle.
[0035] In a second aspect, the present application provides a three-dimensional reconstruction device, the device comprising:
[0036] A first acquisition module is used to acquire an original fringe image group, wherein the original fringe image group includes a plurality of original fringe images, and the fringe phases of the original fringe images are shifted in sequence according to a preset shift amount;
[0037] a rotation module, configured to generate a plurality of sequentially arranged rotated fringe image groups according to the original fringe image group, each rotated fringe image group comprising a first image group and a second image group, the deflection angles of the fringe of each image in the first image group and the fringe of the corresponding image in the first image group of the adjacent rotated fringe image group satisfy a preset condition, and the fringe of each image in the first image group is orthogonal to the fringe of the corresponding image in the second image;
[0038] A second acquisition module is used to acquire a plurality of acquisition image groups obtained by photographing the object to be reconstructed by a photographing device, each acquisition image group includes a first acquisition group and a second acquisition group, each image in the first acquisition group is obtained by correspondingly acquiring each image in the first image group, and each image in the second acquisition group is obtained by correspondingly acquiring each image in the second image group, wherein before the photographing device photographs, each rotating fringe image group is sequentially projected onto the object to be reconstructed by a projection device;
[0039] A first determination module, used to determine the low-resolution area corresponding to each acquired image group according to the pixel phase value of each image in the first acquired group in each acquired image group;
[0040] The second determination module is used to determine the point cloud data corresponding to each acquired image group, and replace the point cloud data corresponding to at least one acquired image group according to the low-resolution area corresponding to each acquired image group, so as to obtain the target point cloud data without low-resolution area corresponding to the object to be reconstructed.
[0041] Optionally, the first determining module is specifically configured to:
[0042] performing phase decomposition calculation on the phase of each image in the first acquisition group to obtain an absolute phase map;
[0043] Determine a difference in pixel phase values of two end pixels of a preset horizontal range of each pixel in the absolute phase map;
[0044] Determining a plurality of low-resolution points according to the difference and a preset phase threshold;
[0045] The multiple low-resolution points are connected to form a low-resolution area.
[0046] Optionally, the first determining module is specifically configured to:
[0047] Each pixel in the absolute phase map is traversed, and for a current pixel traversed, a difference between a phase value of a preset number of pixels on the left and a phase value of a preset number of pixels on the right of the current pixel is calculated.
[0048] Optionally, the first determining module is specifically configured to:
[0049] Performing a breadth-first search, connecting at least two low-resolution points whose distance between each low-resolution point is not greater than a preset distance to form a low-resolution region to be selected;
[0050] It is determined whether the area of the low-resolution region to be selected is greater than a preset area threshold. If so, the low-resolution region to be selected is used as the low-resolution region.
[0051] Optionally, the second determining module is specifically configured to:
[0052] Determine a second acquisition image group according to a target position of a low-resolution area corresponding to the first acquisition image group, wherein the target position in the second acquisition image group is not of low resolution;
[0053] The point cloud data corresponding to the target position in the first acquired image group is replaced based on the point cloud data corresponding to the target position in the second acquired image group.
[0054] Optionally, the rotation module is specifically used for:
[0055] Acquire device parameters, wherein the device parameters include at least: internal parameters of the projection device, optical center coordinates of the projection device, and optical center coordinates of the shooting device;
[0056] determining a first fringe angle according to the device parameters;
[0057] Rotating each image in the original fringe image group by the first fringe angle according to a preset direction to obtain a first image group in a first rotated fringe image group;
[0058] The first image group is rotated 90 degrees in a preset direction to obtain a second image group.
[0059] Optionally, the rotation module is specifically used for:
[0060] Taking the difference between the optical center coordinates of the projection device and the optical center coordinates of the shooting device as a baseline vector;
[0061] Determining a projection baseline vector according to the projection device internal parameters and the baseline vector;
[0062] The angle between the projection baseline vector and the horizontal axis of the projection normalization plane is taken as the first fringe angle.
[0063] In a third aspect, the present application provides an electronic device comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the above-mentioned three-dimensional reconstruction method.
[0064] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned three-dimensional reconstruction method are executed.
[0065] The beneficial effects of the present application are as follows: first, multiple rotated fringe image groups are determined based on the original fringe image groups, then the acquisition image groups corresponding to the multiple rotated fringe image groups are obtained, the low-resolution areas of each acquisition image group are determined based on the pixel phase values of each acquisition image group, and then the point cloud data in other acquisition image groups that are not low-resolution areas replace the point cloud data in the low-resolution area to obtain target point cloud data without low-resolution areas corresponding to the object to be reconstructed. This embodiment uses multiple groups of rotated fringe image groups with stripes in different directions, so that the target point cloud data finally obtained can fully and accurately reflect the morphological details of the object to be reconstructed, while retaining different detail features. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0067] Figure 1 It is a schematic diagram of an application scenario of a three-dimensional reconstruction method provided in an embodiment of the present application;
[0068] Figure 2 is a flow chart of a three-dimensional reconstruction method provided in an embodiment of the present application;
[0069] Figure 3 is a schematic diagram of an original fringe image group and two rotated fringe image groups provided in an embodiment of the present application;
[0070] Figure 4 It is a schematic flow chart of a method for determining a low-resolution area corresponding to each acquired image group provided in an embodiment of the present application;
[0071] Figure 5 It is a schematic flow chart of a method for generating a plurality of sequentially arranged rotating fringe image groups provided in an embodiment of the present application;
[0072] Figure 6 This is a schematic flow chart of a method for determining a first stripe angle provided in an embodiment of the present application;
[0073] Figure 7 is a schematic structural diagram of a three-dimensional reconstruction device provided in an embodiment of the present application;
[0074] Figure 8 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0075] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0076] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0077] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0078] In the prior art, a three-dimensional reconstruction device usually consists of a projector and one or two cameras. The projector uses structured light stripes with single horizontal and vertical stripes or single optimal direction stripes to project onto the object. The camera collects images on the object and generates a point cloud to achieve three-dimensional reconstruction.
[0079] However, for objects with complex surface morphology, the horizontal and vertical stripes alone cannot fully capture the structural features of the subtle surface undulations, which is not conducive to three-dimensional reconstruction. The use of a single optimal direction stripe cannot cope with the ever-changing morphological features of the object surface. Specifically, the optimal direction of the stripe is often evaluated and selected based on the ratio of phase difference to depth difference, but for small grooves, the phase value will show an obvious squeezing effect. Therefore, the above evaluation criteria actually reduce the ability to resolve such details and cannot take all aspects into account.
[0080] Therefore, the present application proposes a three-dimensional reconstruction method, which is applied to a server. First, the projection device is controlled to project multiple groups of stripe images in different directions onto the object to be reconstructed. The shooting device collects each stripe image and sends it to the server. The server determines the low-resolution area of each group of collected images based on the pixel phase values in the received multiple groups of collected images, and determines the point cloud data corresponding to each group of collected images. Finally, the point cloud data is replaced according to the low-resolution area in each group of collected images to obtain the target point cloud data without low-resolution area corresponding to the object to be reconstructed. The present application obtains the collected images corresponding to multiple groups of projected stripes, and replaces the low-resolution area in each group of images to obtain the target point cloud data without low-resolution area. Compared with the traditional single-directional stripe structured light, it can take into account the subtle morphological features of various objects to be reconstructed, and can greatly improve the accuracy and completeness of three-dimensional reconstruction.
[0081] Figure 1 Schematic diagram of an application scenario of a three-dimensional reconstruction method provided in an embodiment of the present application. Figure 1 As shown, the 3D reconstruction method is applied in a server, and the server is connected to a projection device and a shooting device respectively. The projection device and the shooting device can be located on the left and right sides or the upper and lower sides of the object to be reconstructed respectively. Figure 1 Taking the case where both devices are located on the left and right sides of the object to be reconstructed, the projection device is used to project the pattern sent by the server onto the object to be reconstructed, and the shooting device is used to capture the object to be reconstructed with the projected pattern. Both the projection device and the shooting device have a normalized plane, the normalized plane of the projection device is perpendicular to the line connecting the projection device and the object to be reconstructed, and the normalized plane of the shooting device is perpendicular to the line connecting the shooting device and the object to be reconstructed.
[0082] Next, Figure 2 is a flow chart of a three-dimensional reconstruction method provided in an embodiment of the present application. Figure 2 The three-dimensional reconstruction method in this application is introduced.
[0083] S201, obtaining an original fringe image group, wherein the original fringe image group includes a plurality of original fringe images, and the fringe phases of the original fringe images are shifted in sequence according to a preset shift amount.
[0084] The original fringe image group includes multiple original fringe images, and the stripes in the original fringe images are all single-directional stripes. A multi-frequency multi-step phase shift method can be used to generate multiple sinusoidal original fringe images based on a preset offset. The number of original fringe images is related to the number of fringe offset cycles and the number of offset fringe images, and the number is not limited in this application.
[0085] As an example, the stripes in the original stripe image group may be single-direction stripes such as horizontal stripes or vertical stripes. It is worth noting that the direction of the stripes in the original stripe image group is related to the relative positions of the shooting device and the projection device. Specifically, when the shooting device and the projection device are located on both sides of the horizontal direction of the object to be reconstructed, the image stripes in the original stripe image group are vertical, and when the shooting device and the projection device are located on both sides of the vertical direction of the object to be reconstructed, the image stripes in the original stripe image are horizontal.
[0086] S202, generating a plurality of sequentially arranged rotated stripe image groups according to the original stripe image group, each rotated stripe image group including a first image group and a second image group, the deflection angles of the stripes of each image in the first image group and the stripes of the corresponding image in the first image group of an adjacent rotated stripe image group satisfy a preset condition, and the stripes of each image in the first image group are orthogonal to the stripes of the corresponding image in the second image.
[0087] The number of the rotating stripe image groups can be 2 or any number greater than 2, which can be flexibly set according to actual needs, and the present application embodiment does not specifically limit this. For ease of description, the following embodiments of the present application take the generation of 2 rotating stripe image groups as an example. Specifically, Figure 3 is an example diagram of an original fringe image group and two rotated fringe image groups provided by an embodiment of the present application. Figure 3 , two rotated fringe image groups can be generated according to the original fringe image group, namely the first rotated fringe image group and the second rotated fringe image group. Among them, the first rotated fringe image group can be obtained by rotating the original fringe image group once, and on this basis, the second rotated fringe image group can be obtained by rotating again based on the first rotated fringe image group. Specifically, when the projection device and the shooting device are set horizontally, the stripes in each original fringe image in the original fringe image group can be vertical stripes, and when the projection device and the shooting device are set vertically, the stripes in each original fringe image in the original fringe image group can be horizontal stripes. Taking the case that the image stripes in the original fringe image group are all vertical stripes, each stripe in each original fringe image is rotated counterclockwise according to the above-mentioned optimal angle to obtain the first image group in the first rotated fringe image group, and each image in the first image group is rotated counterclockwise by 90 degrees to obtain the second image group in the first rotated fringe image group. Then, each image stripe in the first image group in the first rotated stripe image group is rotated 45 degrees counterclockwise to obtain the first image group in the second rotated stripe image group, and each stripe in the first image group in the second rotated stripe image group is rotated 90 degrees counterclockwise to obtain the second image group in the second rotated stripe image group. The rotation direction of the stripes in the image may be clockwise or counterclockwise, which is not limited in this embodiment.
[0088] As an optional implementation, among the multiple rotating fringe image groups, there may be a group of rotating fringe image groups in which the deflection angles of the fringe of each image in the first image group and the fringe of the corresponding image in the original fringe image group are the optimal angles. The optimal angle can be calculated using the internal parameters of the projection device and the optical center coordinates of the projection device and the shooting device.
[0089] Optionally, the preset condition may be that the deflection angle of the stripes of each image in the first image group and the stripes of the corresponding image in the first image group of the adjacent rotated stripe image group is less than 90 degrees. It is worth noting that, relative to the stripes in each image in the original stripe image group, the stripes in each image in the rotated stripe image group obtained by rotating it by 20 degrees are the same as the stripes in each image in the rotated stripe image group obtained by rotating it by 200 degrees cumulatively, and therefore are processed as the same rotated stripe image group.
[0090] S203, obtaining a plurality of acquired image groups obtained by photographing the object to be reconstructed by a photographing device, wherein each acquired image group includes a first acquisition group and a second acquisition group, each image in the first acquisition group is obtained by correspondingly acquiring each image in the first image group, and each image in the second acquisition group is obtained by correspondingly acquiring each image in the second image group, wherein before the photographing device photographs, each rotating stripe image group is sequentially projected onto the object to be reconstructed by a projection device.
[0091] After generating a plurality of rotating fringe image groups, the server sends the rotating fringe image groups to the projection device in sequence, so that the projection device projects the images in each rotating fringe image group onto the object to be reconstructed.
[0092] As an optional implementation, each image in each rotating fringe image group and each image in each collected image group may be numbered accordingly to match and store each image.
[0093] S204: Determine a low-resolution region corresponding to each acquired image group according to a pixel phase value of each image in a first acquired image group in each acquired image group.
[0094] Among them, the characteristics of the low-resolution area are: the phase value difference of each pixel in the adjacent preset range is too large, and the phase value is stacked, resulting in a decrease in the ability of the shooting device to resolve the phase value of the pixel when shooting the stripe image.
[0095] The specific method of acquiring the low-resolution area is as follows: perform phase decomposition calculation on the images in each acquisition image group, and obtain an absolute phase map corresponding to the first acquisition group and the second acquisition group in each acquisition image group. For example, if there are two acquisition image groups, there are 4 absolute phase maps. Then, for each pixel point in the absolute phase map corresponding to one acquisition group in each acquisition image group, compare the difference in the pixel phase values of the pixels at the two end points in the preset horizontal range of the same absolute phase map where the pixel point is located with the preset phase threshold. If it is greater than, the pixel point is determined to be a pixel point in the low-resolution area.
[0096] S205, determining the point cloud data corresponding to each acquired image group, and replacing the point cloud data corresponding to at least one acquired image group according to the low-resolution area corresponding to each acquired image group, to obtain target point cloud data without low-resolution area corresponding to the object to be reconstructed.
[0097] According to the first acquisition group and the second acquisition group in each acquisition image group, the point cloud data corresponding to each acquisition image group is determined. It should be noted that the number of point cloud data is the same as the number of acquisition image groups.
[0098] Specifically, the first acquisition group and the second acquisition group in each acquisition image group can be phase-deconstructed respectively to obtain the first absolute phase map and the second absolute phase map, which are generated based on the shooting pixel coordinates of the normalized plane where the shooting device is located. Then, the phase values therein are converted into pixel row and column values of the projection pixel coordinates of the normalized plane where the projection device is located, and then the point cloud data corresponding to each acquisition image group is calculated by using methods such as triangulation. Taking the shooting device and the projection device as an example, the method of converting the phase value in the absolute phase map into the pixel row and column values of the projection pixel coordinates is as shown in the following formula (1) and formula (2): Assuming that the phase value at the coordinate (i, j) in the first absolute phase map corresponding to the first acquisition group in an acquisition image group is u(i, j), and the phase value at the coordinate (i, j) in the second absolute phase map is v(i, j), then the projection pixel coordinate corresponding to the pixel coordinate (i, j) of the acquisition image group is (p u , p v ),in:
[0099] p v =cos(θ1)v(i,j)-sin(θ1)u(i,j)+h*sin(θ1)*sin(θ1) (1)
[0100] p u =sin(θ1)v(i,j)+cos(θ1)u(i,j)-h*sin(θ1)*cos(θ1) (2)
[0101] Wherein, h is the number of pixel rows of the fringe image, and θ1 is the angle between the horizontal x-axis of the normalized plane of the projection device and the projection baseline vector. The projection baseline vector can be calculated by the following step S602.
[0102] Optionally, point cloud data of possible non-low-resolution areas of corresponding target positions in other acquired image groups are determined based on the target position of the corresponding low-resolution area in a certain acquired image group, and the point cloud data replaces the point cloud data of the target position of the corresponding low-resolution area in the above-mentioned acquired image group.
[0103] In this embodiment, firstly, a plurality of rotating fringe image groups are determined according to the original fringe image group, then the acquisition image groups corresponding to the plurality of rotating fringe image groups are obtained, the low-resolution area of each acquisition image group is determined according to the pixel phase value of each acquisition image group, and then the point cloud data in the other acquisition image groups which are not low-resolution areas replace the point cloud data in the low-resolution area, so as to obtain the target point cloud data without low-resolution area corresponding to the object to be reconstructed. In this embodiment, by using a plurality of rotating fringe image groups with stripes in different directions, the target point cloud data finally obtained can fully and accurately reflect the morphological details of the object to be reconstructed, while retaining different detail features.
[0104] Figure 4 is a flow chart of a method for determining a low-resolution area corresponding to each acquired image group provided in an embodiment of the present application. Figure 4 The specific method for determining the low-resolution area corresponding to each acquired image group is introduced. Take any acquired image group in each acquired image group as an example:
[0105] S401, performing phase decomposition calculation on the phase of each image in the first acquisition group to obtain an absolute phase map.
[0106] The method for phase resolution calculation may specifically be a phase shift method. The absolute phase map includes the absolute phase value of each pixel under the coordinates of the captured pixel, that is, the pixel phase value.
[0107] It is worth mentioning that, since the angles of the fringes in the images of the first acquisition group and the second acquisition group are both 90 degrees, there is no restriction on whether the phase decomposition calculation is uniformly performed on the first acquisition group or the second acquisition group in the acquisition image group in this embodiment.
[0108] S402: Determine the difference between the pixel phase values of two end pixels of a preset horizontal range of each pixel in the absolute phase map.
[0109] The preset horizontal range may be a range centered on the determined pixel. For example, for the current pixel in the absolute phase image, the preset number of pixels on its left are one of its endpoint pixels, and the preset number of pixels on its right are also another of its endpoint pixels, and the range of the two endpoint pixels constitutes the preset horizontal range.
[0110] It is worth noting that step S402 is described based on the case where the shooting device and the projection device are located at the horizontal sides of the object to be reconstructed, respectively. However, when the shooting device and the projection device are located at the vertical sides of the object to be reconstructed, respectively, step S402 may be: determining the difference in pixel phase values of two end pixels of a preset vertical range of each pixel in the absolute phase map.
[0111] It is worth noting that the phase values within the preset horizontal range in the absolute phase diagram keep increasing continuously.
[0112] S403: Determine a plurality of low-resolution points according to the difference and a preset phase threshold.
[0113] If the difference is greater than a preset phase threshold, the pixel is determined to be a low-resolution point.
[0114] S404: Connect multiple low-resolution points to form a low-resolution area.
[0115] Since the low-resolution points obtained by the method in S403 are scattered points and their number is large, the low-resolution points need to be connected to form low-resolution areas. The number of low-resolution areas is small, which can better perform positioning and point cloud replacement.
[0116] In this embodiment, the phase of the image in the first acquisition group is dephased to obtain an absolute phase map, and a small number of low-resolution areas are determined based on the phase value of each pixel in the absolute phase map, thereby obtaining low-resolution areas of the captured images corresponding to each rotating fringe image group, laying the foundation for obtaining target point cloud data.
[0117] Furthermore, how to determine the difference in pixel phase values of two endpoint pixels is described below:
[0118] When the shooting device and the projection device are set horizontally, as an optional implementation, each pixel in the absolute phase map is traversed, and for the current pixel traversed, the difference between the phase value of a preset number of pixels to the left and the phase value of a preset number of pixels to the right of the current pixel is calculated.
[0119] When the shooting device and the projection device are arranged vertically, as another optional implementation, the difference between a preset number of pixel phase values below the current pixel phase value and a preset number of pixel phase values above the current pixel phase value traversed may be calculated.
[0120] In this embodiment, by traversing each pixel in the absolute phase map, for the current pixel traversed, the difference between the phase values of a preset number of pixels on the left and the phase values of a preset number of pixels on the right is calculated, so that low-resolution pixels can be determined, and then the low-resolution pixels form a selected low-resolution area.
[0121] Next, we will introduce how to connect multiple low-resolution points to form a low-resolution area:
[0122] Optionally, the search is performed in a breadth-first manner, and at least two low-resolution points whose distance between each low-resolution point is not greater than a preset distance are connected to form a low-resolution region to be selected.
[0123] As an optional implementation, a seed growing method can be used to search by breadth first to connect low-resolution points whose distance is not greater than a preset distance, wherein the preset distance can be the distance between two adjacent pixels in the absolute phase image.
[0124] Optionally, it is determined whether the area of the to-be-selected low-resolution region is greater than a preset area threshold, and if so, the to-be-selected low-resolution region is used as the low-resolution region.
[0125] If the area of the to-be-selected low-resolution region is less than or equal to a preset area threshold, the to-be-selected low-resolution region is not used as a low-resolution region.
[0126] It should be understood that the larger the preset area threshold is, the smaller the workload of subsequent replacement of point cloud data is, but the completeness is lower; the smaller the preset area threshold is, the larger the workload of subsequent replacement of point cloud data is, but the completeness is higher.
[0127] As an optional implementation, the low-resolution area and the non-low-resolution area may be marked separately.
[0128] In this embodiment, by using breadth-first search, the low-resolution region to be selected is determined according to the low-resolution points, and then the low-resolution region is determined according to the area of the low-resolution region to be selected, thereby reducing the workload and avoiding analyzing and replacing each low-resolution point one by one.
[0129] Next, how to replace the point cloud data in the above step S205 is introduced.
[0130] Optionally, the second acquired image group is determined according to the target position of the low-resolution area corresponding to the first acquired image group, wherein the target position in the second acquired image group is not of low resolution.
[0131] The first acquired image group is any one of all acquired image groups.
[0132] Since multiple acquisition image groups may be determined based on the target position of the low-resolution area corresponding to the first acquisition image group, the pixels at the target position are not low-resolution. At this time, one of the acquisition image groups may be selected as the second acquisition image group.
[0133] Optionally, the point cloud data corresponding to the target position in the first acquired image group is replaced based on the point cloud data corresponding to the target position in the second acquired image group.
[0134] As an optional implementation, the acquisition image group with the smallest low-resolution area can be selected as the first acquisition image group. At this time, the point cloud data corresponding to the target position in the first acquisition image group is replaced based on the point cloud data corresponding to the target position in the second acquisition image group, so that the workload of replacement is reduced.
[0135] As another optional implementation, the corresponding coordinates in each captured image group can be judged for each pixel coordinate in the captured pixel coordinates. If the pixel coordinate is not located in the low-resolution area, the point cloud data is replaced to the coordinate position to finally form the target point cloud data.
[0136] In this embodiment, the second acquisition image group is determined according to the target position of the corresponding low-resolution area in the first acquisition image group, and the point cloud data corresponding to the target position in the first acquisition image group is replaced based on the point cloud data of the corresponding position in the second acquisition image group, thereby forming high-resolution target point cloud data, so that the target point cloud data can cover various subtle morphological features.
[0137] Next, refer to Figure 5 The specific steps of generating a plurality of sequentially arranged rotation fringe image groups according to the original fringe image groups in the above step S202 are introduced. Taking the generation of a set of rotation fringe image groups as an example:
[0138] S501. Obtain device parameters, where the device parameters at least include: internal parameters of the projection device, optical center coordinates of the projection device, and optical center coordinates of the shooting device.
[0139] As an optional implementation, the server may obtain device parameters of the shooting device and the projection device before three-dimensional reconstruction.
[0140] S502: Determine a first stripe angle according to device parameters.
[0141] The first fringe angle may be an optimal angle, which is the angle between the projection baseline vector and the projection normalization plane. Specifically, if the shooting device and the projection device are located on both horizontal sides of the object to be reconstructed, the first fringe angle is the angle between the projection baseline vector and the x-axis horizontal to the projection normalization plane; if the shooting device and the projection device are located on both vertical sides of the object to be reconstructed, the first fringe angle is the angle between the projection baseline vector and the y-axis vertical to the projection normalization plane.
[0142] It is worth mentioning that the angle of the first stripe is less than 90 degrees, which meets the preset conditions.
[0143] S503: Rotate each image in the original fringe image group by a first fringe angle in a preset direction to obtain a first image group in a first rotated fringe image group.
[0144] Since the phases of the stripes of the original stripe images in the original stripe image group have an offset relationship in sequence, the phases of the stripes of the images in the first graphic group in the first rotated stripe image group also have an offset relationship in sequence.
[0145] Optionally, the preset direction may be counterclockwise.
[0146] S504: Rotate the first image group by 90 degrees in a preset direction to obtain a second image group.
[0147] The second image group and the first image group always remain orthogonal.
[0148] It is worth noting that the above steps S501 to S504 are only one way to generate a rotated fringe image group, and each image in the original fringe image group can also be rotated by an angle less than 90 degrees in a preset direction to obtain a rotated fringe image group. The present application does not limit the method of rotating the fringe image group.
[0149] In this embodiment, by obtaining device parameters and determining a first fringe angle according to the device parameters, and then rotating the first fringe angle in a preset direction, a first image group in a first rotated fringe image group is obtained, and then the first image group is rotated 90 degrees in a preset direction to obtain a second image group. In this embodiment, two image groups in a rotated fringe image group are obtained, so that the low-resolution area can be determined and the corresponding point cloud data can be generated at the same time.
[0150] Further, taking the example that the shooting device and the projection device are respectively located on the horizontal sides of the object to be reconstructed, referring to Figure 6 The method for determining the first stripe angle in the above step S502 is introduced as follows:
[0151] S601: The difference between the optical center coordinates of the projection device and the optical center coordinates of the shooting device is used as a baseline vector.
[0152] Exemplarily, the calculation formula of the baseline vector is as follows (3):
[0153] b=O c -O p (3)
[0154] Where b is the baseline vector, O c is the optical center coordinate of the shooting device, O p is the optical center coordinate of the projection device.
[0155] S602: Determine a projection baseline vector according to the projection device internal parameters and the baseline vector.
[0156] Exemplarily, the calculation formula of the projection baseline vector is as follows:
[0157] b p =I p *b (4)
[0158] Among them, b p is the projection baseline vector, I p is the internal parameter of the projection device, and b is the baseline vector.
[0159] S603: taking the angle between the projection baseline vector and the x-axis of the projection normalization plane as the first fringe angle.
[0160] Exemplarily, the angle between the projection baseline vector and the x-axis of the projection normalized plane is calculated as follows:
[0161]
[0162] Wherein, θ1 is the angle between the projection baseline vector and the horizontal axis of the projection normalization plane.
[0163] As an optional implementation, the first image group in the first rotated fringe image group can be expressed as the following formula (6):
[0164]
[0165] Where i is the current row number of the image in the first image group, j is the current column number of the image in the first image group, T n is the nth period of the sinusoidal fringes in the image in the first image group, k is the sequence number of the image in the first image group, is the phase of the image in the first image group.
[0166] The second image group can be expressed as the following equation (7):
[0167]
[0168] Where I is the current row number of the image in the second image group, J is the current column number of the image in the second image group, and T N is the Nth period of the sinusoidal fringes in the image in the second image group, K is the sequence number of the image in the second image group, is the phase of the image in the second image group. α1 is the sum of the first fringe angle and 90 degrees, and h is the number of pixel rows in the fringe image.
[0169] In this embodiment, by calculating the first fringe angle, a first image group of a set of rotating fringe image groups can be obtained, and then the projection device projects it onto the object to be reconstructed so that the phase image acquired by the shooting device has fewer low-resolution areas.
[0170] Based on the same inventive concept, a three-dimensional reconstruction device corresponding to the three-dimensional reconstruction method is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned three-dimensional reconstruction method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0171] Reference Figure 7 , which is a schematic diagram of the structure of a three-dimensional reconstruction device provided in an embodiment of the present application, the device includes: a first acquisition module 701, a rotation module 702, a second acquisition module 703, a first determination module 704 and a second determination module 705; wherein:
[0172] A first acquisition module 701 is used to acquire an original fringe image group, wherein the original fringe image group includes a plurality of original fringe images, and the fringe phases of the original fringe images are shifted in sequence according to a preset shift amount;
[0173] A rotation module 702 is used to generate a plurality of sequentially arranged rotated fringe image groups according to the original fringe image group, each rotated fringe image group includes a first image group and a second image group, the deflection angle between the fringe of each image in the first image group and the fringe of the corresponding image in the first image group of the adjacent rotated fringe image group meets a preset condition, and the fringe of each image in the first image group is orthogonal to the fringe of the corresponding image in the second image;
[0174] The second acquisition module 703 is used to acquire multiple acquisition image groups obtained by photographing the object to be reconstructed by the photographing device, each acquisition image group includes a first acquisition group and a second acquisition group, each image in the first acquisition group is obtained by correspondingly acquiring each image in the first image group, and each image in the second acquisition group is obtained by correspondingly acquiring each image in the second image group, wherein before the photographing device photographs, each rotating fringe image group is sequentially projected onto the object to be reconstructed by a projection device;
[0175] A first determination module 704 is used to determine the low-resolution area corresponding to each acquired image group according to the pixel phase value of each image in the first acquired image group in each acquired image group;
[0176] The second determination module 705 is used to determine the point cloud data corresponding to each acquired image group, and replace the point cloud data corresponding to at least one acquired image group according to the low-resolution area corresponding to each acquired image group, so as to obtain the target point cloud data without low-resolution area corresponding to the object to be reconstructed.
[0177] Optionally, the first determining module 704 is specifically configured to:
[0178] performing phase decomposition calculation on the phase of each image in the first acquisition group to obtain an absolute phase map;
[0179] Determine a difference in pixel phase values of two end pixels of a preset horizontal range of each pixel in the absolute phase map;
[0180] Determining a plurality of low-resolution points according to the difference and a preset phase threshold;
[0181] The multiple low-resolution points are connected to form a low-resolution area.
[0182] Optionally, the first determining module 704 is specifically configured to:
[0183] Each pixel in the absolute phase map is traversed, and for a current pixel traversed, a difference between a phase value of a preset number of pixels on the left and a phase value of a preset number of pixels on the right of the current pixel is calculated.
[0184] Optionally, the first determining module 704 is specifically configured to:
[0185] Performing a breadth-first search, connecting at least two low-resolution points whose distance is less than a preset distance among the low-resolution points to form a low-resolution region to be selected;
[0186] It is determined whether the area of the low-resolution region to be selected is greater than a preset area threshold. If so, the low-resolution region to be selected is used as the low-resolution region.
[0187] Optionally, the second determining module 705 is specifically configured to:
[0188] Determine a second acquisition image group according to a target position of a low-resolution area corresponding to the first acquisition image group, wherein the target position in the second acquisition image group is not of low resolution;
[0189] The point cloud data corresponding to the target position in the first acquired image group is replaced based on the point cloud data corresponding to the target position in the second acquired image group.
[0190] Optionally, the rotation module 702 is specifically used for:
[0191] Acquire device parameters, wherein the device parameters include at least: internal parameters of the projection device, optical center coordinates of the projection device, and optical center coordinates of the shooting device;
[0192] determining a first fringe angle according to the device parameters;
[0193] Rotating each image in the original fringe image group by the first fringe angle according to a preset direction to obtain a first image group in a first rotated fringe image group;
[0194] The first image group is rotated 90 degrees in a preset direction to obtain a second image group.
[0195] Optionally, the rotation module 702 is specifically used for:
[0196] Taking the difference between the optical center coordinates of the projection device and the optical center coordinates of the shooting device as a baseline vector;
[0197] Determining a projection baseline vector according to the projection device internal parameters and the baseline vector;
[0198] The angle between the projection baseline vector and the horizontal axis of the projection normalization plane is taken as the first fringe angle.
[0199] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0200] The present application also provides an electronic device, such as Figure 8 801, a memory 802 and a bus. The memory 802 stores machine-readable instructions executable by the processor 801 (for example, Figure 8 The device includes the execution instructions corresponding to the first acquisition module 701, the rotation module 702, the second acquisition module 703, the first determination module 704 and the second determination module 705, etc.), when the computer device is running, the processor 801 communicates with the memory 802 through a bus, and when the machine-readable instructions are executed by the processor 801, the above-mentioned three-dimensional reconstruction method is performed.
[0201] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned three-dimensional reconstruction method are executed.
[0202] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0203] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of 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 the present invention is essentially or part of the technical solution that contributes to the prior art or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.
[0204] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A three-dimensional reconstruction method, characterized in that: The method comprises: Acquire an original fringe image group, wherein the original fringe image group includes a plurality of original fringe images, and the fringe phases of the original fringe images are shifted in sequence according to a preset shift amount; Generate a plurality of sequentially arranged rotated fringe image groups according to the original fringe image group, each rotated fringe image group includes a first image group and a second image group, the deflection angles of the fringe of each image in the first image group and the fringe of the corresponding image in the first image group of the adjacent rotated fringe image group meet a preset condition, and the fringe of each image in the first image group is orthogonal to the fringe of the corresponding image in the second image; Acquire multiple acquisition image groups obtained by photographing the object to be reconstructed by a photographing device, each acquisition image group includes a first acquisition group and a second acquisition group, each image in the first acquisition group is obtained by correspondingly acquiring each image in the first image group, and each image in the second acquisition group is obtained by correspondingly acquiring each image in the second image group, wherein before the photographing device photographs, a projection device sequentially projects each rotating fringe image group onto the object to be reconstructed; Determine the low-resolution area corresponding to each acquired image group according to the pixel phase value of each image in the first acquired image group in each acquired image group; The point cloud data corresponding to each acquired image group is determined, and the point cloud data corresponding to at least one acquired image group is replaced according to the low-resolution area corresponding to each acquired image group to obtain the target point cloud data without the low-resolution area corresponding to the object to be reconstructed.
2. The three-dimensional reconstruction method according to claim 1, characterized in that: The step of determining the low-resolution region corresponding to each acquired image group according to the pixel phase value of each image in the first acquired image group in each acquired image group comprises: performing phase decomposition calculation on the phase of each image in the first acquisition group to obtain an absolute phase map; Determine a difference in pixel phase values of two end pixels of a preset horizontal range of each pixel in the absolute phase map; Determining a plurality of low-resolution points according to the difference and a preset phase threshold; The multiple low-resolution points are connected to form a low-resolution area.
3. The three-dimensional reconstruction method according to claim 2, characterized in that: The step of determining the difference between the pixel phase values of two end pixels of a preset horizontal range of each pixel in the absolute phase map comprises: Each pixel in the absolute phase map is traversed, and for a current pixel traversed, a difference between a phase value of a preset number of pixels on the left and a phase value of a preset number of pixels on the right of the current pixel is calculated.
4. The three-dimensional reconstruction method according to claim 2, characterized in that: The connecting the plurality of low-resolution points to form a low-resolution area comprises: Performing a breadth-first search, connecting at least two low-resolution points whose distance between each low-resolution point is not greater than a preset distance to form a low-resolution region to be selected; It is determined whether the area of the low-resolution region to be selected is greater than a preset area threshold. If so, the low-resolution region to be selected is used as the low-resolution region.
5. The three-dimensional reconstruction method according to claim 1, characterized in that: The replacing the point cloud data corresponding to at least one acquired image group according to the low-resolution area corresponding to each acquired image group comprises: Determine a second acquisition image group according to a target position of a low-resolution area corresponding to the first acquisition image group, wherein the target position in the second acquisition image group is not of low resolution; The point cloud data corresponding to the target position in the first acquired image group is replaced based on the point cloud data corresponding to the target position in the second acquired image group.
6. The three-dimensional reconstruction method according to claim 1, characterized in that: The step of generating a plurality of sequentially arranged rotated fringe image groups according to the original fringe image group comprises: Acquire device parameters, wherein the device parameters include at least: internal parameters of the projection device, optical center coordinates of the projection device, and optical center coordinates of the shooting device; determining a first fringe angle according to the device parameters; Rotating each image in the original fringe image group by the first fringe angle according to a preset direction to obtain a first image group in a first rotated fringe image group; The first image group is rotated 90 degrees in a preset direction to obtain a second image group.
7. The three-dimensional reconstruction method according to claim 6, characterized in that: The determining the first stripe angle according to the device parameter comprises: Taking the difference between the optical center coordinates of the projection device and the optical center coordinates of the shooting device as a baseline vector; Determining a projection baseline vector according to the projection device internal parameters and the baseline vector; The angle between the projection baseline vector and the horizontal axis of the projection normalization plane is taken as the first fringe angle.
8. A three-dimensional reconstruction device, characterized in that: The device comprises: A first acquisition module is used to acquire an original fringe image group, wherein the original fringe image group includes a plurality of original fringe images, and the fringe phases of the original fringe images are shifted in sequence according to a preset shift amount; a rotation module, configured to generate a plurality of sequentially arranged rotated fringe image groups according to the original fringe image group, each rotated fringe image group comprising a first image group and a second image group, the deflection angles of the fringe of each image in the first image group and the fringe of the corresponding image in the first image group of the adjacent rotated fringe image group satisfy a preset condition, and the fringe of each image in the first image group is orthogonal to the fringe of the corresponding image in the second image; A second acquisition module is used to acquire a plurality of acquisition image groups obtained by photographing the object to be reconstructed by a photographing device, each acquisition image group includes a first acquisition group and a second acquisition group, each image in the first acquisition group is obtained by correspondingly acquiring each image in the first image group, and each image in the second acquisition group is obtained by correspondingly acquiring each image in the second image group, wherein before the photographing device photographs, each rotating fringe image group is sequentially projected onto the object to be reconstructed by a projection device; A first determination module, used to determine the low-resolution area corresponding to each acquired image group according to the pixel phase value of each image in the first acquired group in each acquired image group; The second determination module is used to determine the point cloud data corresponding to each acquired image group, and replace the point cloud data corresponding to at least one acquired image group according to the low-resolution area corresponding to each acquired image group, so as to obtain the target point cloud data without low-resolution area corresponding to the object to be reconstructed.
9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor executes the machine-readable instructions to perform the steps of the three-dimensional reconstruction method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the three-dimensional reconstruction method according to any one of claims 1 to 7 are executed.
