A three-dimensional reconstruction method, device and equipment based on monocular pan-tilt camera
Through the 3D reconstruction method based on the monocular pan-tilt camera, the problems of expensive 3D modeling equipment and high labor costs at the construction site are solved, low-cost, real-time 3D modeling is achieved, the process is simplified and the degree of automation is improved.
Patent Information
- Application Number
- CN202311755828.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-19
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2043-12-19
AI Technical Summary
The application of existing 3D modeling technology on construction sites requires expensive equipment and high labor costs, and traditional binocular cameras are difficult to deploy for a long time, resulting in low real-time performance and wasted personnel.
A 3D reconstruction method based on a monocular pan-tilt camera is used to achieve automated and real-time 3D modeling by acquiring internal parameter matrices, image correction, parallax calculation and 3D point cloud construction, combined with a 3D reconstruction server, reducing hardware dependence and labor costs.
It achieves low-cost, real-time 3D modeling, simplifies the 3D reconstruction process at the construction site, reduces equipment and manpower investment, and improves the real-time nature and automation of on-site modeling.
Smart Images

Figure CN117765174B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional reconstruction, and also to a three-dimensional reconstruction method, device and equipment based on a monocular pan-tilt camera. Background Art
[0002] With the development of computer vision technology in recent years, it has become possible to perform 3D reconstruction using only images from standard cameras. In particular, machine stereo vision technology has made it possible to perform 3D reconstruction using ordinary RGB cameras. Some preliminary attempts have also shown that this image-only 3D reconstruction method can be applied to the field of engineering construction to assist modeling.
[0003] The implementation scheme closest to the present invention includes binocular camera 3D modeling. Generally speaking, binocular camera 3D modeling includes the following three steps:
[0004] (1) Camera calibration: Use tools such as a calibration plate to calibrate the binocular camera to obtain the intrinsic and extrinsic parameters of the binocular camera.
[0005] (2) Disparity calculation: Use the disparity information between binocular images to calculate the depth information of each point in the scene.
[0006] (3) Triangulation: Use parallax information and camera parameters to perform triangulation and calculate the three-dimensional coordinates of the points in the scene.
[0007] 3D modeling technology plays an important role in engineering construction management, helping managers to more intuitively observe the progress and quality of the project. However, traditional 3D modeling methods often require special 3D scanning or the setting of complex multi-camera systems, which requires additional equipment investment and on-site workload.
[0008] Existing binocular camera modeling usually uses a binocular camera with known internal and external parameters for modeling, and then the binocular camera needs to be purchased separately. The binocular camera is usually not an outdoor camera and cannot be deployed on the construction site for a long time. Professional personnel are required to carry the binocular camera to the site regularly for on-site modeling, resulting in extra waste of personnel and low real-time performance of 3D modeling. Summary of the invention
[0009] The present invention provides a 3D reconstruction method, device and equipment based on a monocular pan-tilt camera, which solves the problem that the existing 3D model needs to be realized through drone scanning, laser scanner, etc. at the construction site, which requires expensive equipment and high labor costs, or the 3D modeling is realized by deploying binocular cameras on site, which is also relatively expensive.
[0010] In order to solve the above technical problems, the technical solution of the present invention is as follows:
[0011] An embodiment of the present invention provides a three-dimensional reconstruction method based on a monocular pan-tilt camera, comprising:
[0012] Get the intrinsic parameter matrix based on the monocular gimbal camera;
[0013] Correcting the image captured by the monocular pan-tilt camera to obtain a corrected image;
[0014] Performing disparity calculation on two adjacent corrected images to obtain a disparity map;
[0015] Constructing a three-dimensional point cloud of an image through two images taken by the monocular gimbal camera before and after rotation, the rotation angle of the monocular gimbal camera, the intrinsic parameter matrix and the disparity map;
[0016] The 3D point clouds of all images are reconstructed in units to obtain the final 3D point cloud.
[0017] Optionally, the obtaining of an intrinsic parameter matrix based on a monocular gimbal camera includes:
[0018] Get the feature points on the calibration plate;
[0019] According to different angles and positions, the image of the calibration plate is captured to obtain the image of the calibration plate;
[0020] The calibration plate image is detected by image processing technology to detect the corner points of the calibration plate;
[0021] According to the corner points of the calibration plate and the actual size of the calibration plate, an intrinsic parameter matrix is calculated by a camera calibration algorithm.
[0022] Optionally, the 3D reconstruction method based on a monocular gimbal camera also includes:
[0023] After obtaining the intrinsic parameter matrix based on the monocular pan-tilt camera, a 3D reconstruction server is set based on the local area network of the monocular pan-tilt camera. The 3D reconstruction server sets a scheduled task to construct a 3D point cloud of an image at fixed time intervals.
[0024] Optionally, correcting the image captured by the monocular gimbal camera to obtain a corrected image includes:
[0025] The 3D reconstruction server controls the monocular pan-tilt camera to rotate to a preset angle through a software development kit, captures an image at each preset angle, and receives the image;
[0026] The image is corrected by using distortion parameters, monocular gimbal camera posture parameters and the internal parameter matrix to obtain a corrected image.
[0027] Optionally, performing disparity calculation on two adjacent corrected images to obtain a disparity map includes:
[0028] The disparity of two adjacent corrected images is calculated using a preset matching algorithm to obtain a disparity map.
[0029] Optionally, the performing disparity calculation on two adjacent corrected images by using a preset matching algorithm to obtain a disparity map includes:
[0030] Calculate the cost volume of each pixel of two adjacent rectified images by convolution;
[0031] Calculate the aggregation cost of each pixel and its surrounding pixels according to the cost volume;
[0032] Performing path optimization according to the aggregated cost;
[0033] A disparity map is obtained according to the cost volume and the path optimization.
[0034] Optionally, constructing a three-dimensional point cloud of an image by using two images taken by a monocular gimbal camera before and after rotation, the rotation angle of the monocular gimbal camera, the intrinsic parameter matrix and the disparity map includes:
[0035] The calculation formula of the three-dimensional point cloud is:
[0036] P1=K*P
[0037] P2=K*R*P
[0038] Among them, P is the three-dimensional point cloud of any point in space, P1 is the coordinate of point P in the camera coordinate system, P2 is the coordinate of point P after the monocular gimbal camera is rotated, K is the intrinsic parameter matrix, and R is the rotation matrix calculated according to the rotation angle θ of the monocular gimbal camera.
[0039] An embodiment of the present invention further provides a three-dimensional reconstruction device based on a monocular pan-tilt camera, comprising:
[0040] The acquisition module is used to obtain the intrinsic parameter matrix based on the monocular gimbal camera;
[0041] The processing module is used to correct the image captured by the monocular gimbal camera to obtain a corrected image; perform disparity calculation on two adjacent corrected images to obtain a disparity map; construct a three-dimensional point cloud of an image through two images taken before and after the rotation of the monocular gimbal camera, the rotation angle of the monocular gimbal camera, the intrinsic parameter matrix and the disparity map; and perform unit reconstruction on the three-dimensional point clouds of all images to obtain a final three-dimensional point cloud.
[0042] An embodiment of the present invention further provides a computing device, comprising: a processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the method described above is executed.
[0043] An embodiment of the present invention further provides a computer-readable storage medium storing instructions, which, when executed on a computer, enable the computer to execute the method described above.
[0044] The above solution of the present invention includes at least the following beneficial effects:
[0045] The above scheme of the present invention obtains an internal parameter matrix based on a monocular pan-tilt camera; corrects the image collected by the monocular pan-tilt camera to obtain a corrected image; calculates the disparity of two adjacent corrected images to obtain a disparity map; constructs a three-dimensional point cloud of an image through two images taken before and after the rotation of the monocular pan-tilt camera, the rotation angle of the monocular pan-tilt camera, the internal parameter matrix and the disparity map; and reconstructs the three-dimensional point clouds of all images in units to obtain the final three-dimensional point cloud. The present invention controls the monocular pan-tilt camera to collect images in real time through a three-dimensional reconstruction server, and adjusts parameters to achieve unmanned automatic adjustment; sets scheduled tasks through the three-dimensional reconstruction server to automatically build models within a short time interval to reflect real-time performance; and uses monitoring equipment with pan-tilt function at the construction site to reduce costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a schematic diagram of the process flow of the three-dimensional reconstruction method of the present invention;
[0047] Figure 2 is a flow chart of the three-dimensional reconstruction method of the present invention;
[0048] Figure 3 It is a schematic diagram of a three-dimensional reconstruction device of the present invention. DETAILED DESCRIPTION
[0049] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0050] like Figure 1 and Figure 2 As shown, an embodiment of the present invention proposes a three-dimensional reconstruction method based on a monocular pan-tilt camera, comprising:
[0051] S1. Obtain the internal parameter matrix based on the monocular gimbal camera;
[0052] S2, correcting the image captured by the monocular pan-tilt camera to obtain a corrected image;
[0053] S3, performing disparity calculation on two adjacent corrected images to obtain a disparity map;
[0054] S4, constructing a three-dimensional point cloud of an image through two images taken by the monocular gimbal camera before and after rotation, the rotation angle of the monocular gimbal camera, the intrinsic parameter matrix and the disparity map;
[0055] S5. Perform unit reconstruction on the three-dimensional point clouds of all images to obtain the final three-dimensional point clouds.
[0056] In this embodiment, a PTZ-supported surveillance camera commonly found at construction sites is used to complete three-dimensional reconstruction of the construction site at a low cost.
[0057] This solution uses the software development kit SDK provided by the camera manufacturer to achieve real-time control, image acquisition and parameter adjustment of the pan-tilt camera to meet the needs of unmanned automated modeling at the construction site, simplify the process and reduce additional manpower; the monitoring equipment with pan-tilt function at the construction site can be directly used, which can effectively reduce costs and reduce hardware dependence.
[0058] In an optional embodiment of the present invention, step S1 includes:
[0059] S11, obtaining feature points on the calibration plate;
[0060] S12, capturing the image of the calibration plate according to different angles and positions to obtain the calibration plate image;
[0061] S13, detecting the calibration plate image by image processing technology to detect the corner points of the calibration plate;
[0062] S14. Calculate an intrinsic parameter matrix using a camera calibration algorithm according to the corner points of the calibration plate and the actual size of the calibration plate.
[0063] In this embodiment, the classic Zhang Zhengyou calibration method is used to obtain the camera's intrinsic parameter matrix by shooting the calibration plate image. Considering that the intrinsic parameter matrix is an inherent property of the monocular pan-tilt camera, after one calibration, the intrinsic parameter matrix can be used for a long time.
[0064] The camera calibration process is as follows:
[0065] Select a calibration plate: Select a calibration plate of known size, usually a black and white checkerboard. The checkerboard on the calibration plate provides easy-to-detect feature points.
[0066] Take images: Use the camera to take images of the calibration plate at different angles and positions. Make sure the calibration plate covers different areas in the image, including edges and corners.
[0067] Detect feature points: Use image processing techniques, such as corner detection algorithms, to detect corners on the calibration board. The open source computer vision library OpenCV provides some functions for corner detection, such as cv2.findChessboardCorners.
[0068] Calculate camera parameters: Based on the detected corner points and the actual size of the calibration plate, use the camera calibration algorithm to calculate the camera's intrinsic parameters. The open source computer vision library OpenCV provides the cv2.calibrateCamera function for performing camera calibration, which can directly obtain the camera's intrinsic parameter matrix.
[0069] In an optional embodiment of the present invention, the three-dimensional reconstruction method based on a monocular pan-tilt camera further includes:
[0070] After obtaining the intrinsic parameter matrix based on the monocular pan-tilt camera, a 3D reconstruction server is set based on the local area network of the monocular pan-tilt camera. The 3D reconstruction server sets a scheduled task to construct a 3D point cloud of an image at fixed time intervals.
[0071] In this embodiment, in order to automatically reconstruct the 3D model, a 3D reconstruction server needs to be deployed on the local area network where the monocular PTZ camera on the construction site is located, and the subsequent control, calculation and 3D reconstruction are completed on the 3D reconstruction server. First, a scheduled task is set through the 3D reconstruction server. The subsequent 3D reconstruction process is executed at fixed time intervals.
[0072] By setting scheduled tasks, automated modeling can be performed within a short time interval to meet the real-time requirements of construction site modeling.
[0073] In an optional embodiment of the present invention, step S2, obtaining a corrected image, includes:
[0074] S21, the 3D reconstruction server controls the monocular pan-tilt camera to rotate to a preset angle through a software development kit, captures an image at each preset angle, and receives the image;
[0075] S22. Correct the image using distortion parameters, monocular gimbal camera posture parameters, and the internal reference matrix to obtain a corrected image.
[0076] In this embodiment, when the scheduled task is triggered, the 3D reconstruction server controls the monocular pan-tilt camera to rotate to a predetermined angle in sequence by calling the SDK interface of the monocular pan-tilt camera, and captures images for each viewing angle. The monocular pan-tilt camera returns the captured images to the 3D reconstruction server in real time. The image collected by the 3D reconstruction server is corrected by the intrinsic parameter matrix, distortion parameters and camera attitude parameters of the monocular pan-tilt camera to obtain a corrected image. The distortion parameters and intrinsic parameter matrix of the monocular pan-tilt camera are obtained during the calibration process of the monocular pan-tilt camera.
[0077] The camera attitude parameters describe the external characteristics of the camera, including the rotation matrix R and the translation matrix T. In the invention, since the camera only has rotation transformation, the translation matrix T is 0, and the rotation matrix can be calculated by the rotation angle θ, and the calculation formula is as follows:
[0078]
[0079] Among them, R is the rotation matrix and θ is the rotation angle. According to the above known parameters, the image correction work can be completed directly using the cv2.stereoRectify function of OpenCV.
[0080] In an optional embodiment of the present invention, step S3 includes:
[0081] S31 , performing disparity calculation on two adjacent corrected images using a preset matching algorithm to obtain a disparity map.
[0082] In this embodiment, for two adjacent corrected images, the SGBM algorithm can be used to calculate the disparity. SGBM (Semi-Global Block Matching) is a semi-global matching algorithm for calculating disparity. It is based on the advantages and disadvantages of the global matching algorithm and the local matching algorithm, and proposes a compromise method that can not only ensure the quality of the disparity map, but also reduce the calculation complexity.
[0083] In an optional embodiment of the present invention, step S31 includes:
[0084] S311, calculating the cost volume of each pixel of two adjacent corrected images by convolution;
[0085] S312, calculating the aggregation cost of each pixel and its surrounding pixels according to the cost volume;
[0086] S313, performing path optimization according to the aggregation cost;
[0087] S314 , obtaining a disparity map according to the cost volume and the path optimization.
[0088] In this embodiment, the process of using the semi-global matching algorithm SGBM to calculate the disparity is as follows:
[0089] Calculate the cost volume: The semi-global matching algorithm SGBM finds matches by calculating the cost volume of each pixel. The cost volume contains the cost of matching each pixel in the left and right images. The calculation of the cost volume can be implemented through convolution operations to efficiently process large-scale data.
[0090] Cost aggregation: In order to obtain a more accurate match, the semi-global matching algorithm SGBM performs cost aggregation, taking into account the relationship between pixels and neighboring pixels. This can be achieved by calculating the aggregation cost of each pixel in the cost volume and its surrounding pixels to obtain a smoother depth map.
[0091] Path optimization: The semi-global matching algorithm SGBM adopts the idea of global optimization and considers the consistency of the entire image through path optimization. Path optimization can be achieved through methods such as dynamic programming to find the global optimal match.
[0092] Cost calculation and depth map generation: By calculating the cost volume and performing path optimization, the semi-global matching algorithm SGBM finally generates a disparity map.
[0093] In an optional embodiment of the present invention, step S4 includes:
[0094] The calculation formula of the three-dimensional point cloud is:
[0095] P1=K*P
[0096] P2=K*R*P
[0097] Among them, P is the three-dimensional point cloud of any point in space, P1 is the coordinate of point P in the camera coordinate system, P2 is the coordinate of point P after the monocular gimbal camera is rotated, K is the intrinsic parameter matrix, and R is the rotation matrix calculated according to the rotation angle θ of the monocular gimbal camera.
[0098] In this embodiment, the three-dimensional point cloud based on the first image is constructed according to the camera intrinsic parameter K, two images taken before and after the camera is rotated, the rotation angle θ, and the disparity map of the two images.
[0099] Assume that there is a spatial point P in the scene captured by the camera. The camera coordinate system of the monocular gimbal camera before rotation is used as the reference coordinate system. The pixel coordinates of point P on the image before rotation are P1, and the pixel coordinates on the image after rotation are P2. The 3D point cloud is calculated according to the calculation formula of the 3D point cloud.
[0100] Among them, R is the rotation matrix calculated according to the rotation angle θ of the monocular gimbal camera, and the calculation formula is:
[0101]
[0102] Where R is the rotation matrix and θ is the rotation angle.
[0103] According to the above formula, the coordinate value of the three-dimensional point cloud point p of any point in the space can be solved jointly, and then the three-dimensional coordinates of all points on the disparity image can be completed, and the reconstruction of the three-dimensional scene can be completed.
[0104] The present invention schedules a monocular PTZ camera to automatically capture images before and after rotation through a timed task; constructs a rotation matrix according to the rotation angle of the camera; and completes three-dimensional reconstruction by matching the rotation matrix with image feature points. The process is simplified and additional manpower is reduced. By using the SDK provided by the camera manufacturer, real-time control, image acquisition and parameter adjustment of the PTZ camera can be achieved to meet the needs of unmanned automated modeling at the construction site; real-time performance is improved: a timed task is set to perform automated modeling within a short time interval to meet the real-time requirements of modeling at the construction site; hardware dependence is reduced: the present invention can directly use the monitoring equipment with PTZ function at the construction site, which can effectively reduce costs.
[0105] like Figure 3 As shown, an embodiment of the present invention further provides a three-dimensional reconstruction device 3 based on a monocular pan-tilt camera, comprising:
[0106] An acquisition module 31 is used to acquire an intrinsic parameter matrix based on a monocular gimbal camera;
[0107] The processing module 32 is used to correct the image captured by the monocular gimbal camera to obtain a corrected image; perform disparity calculation on two adjacent corrected images to obtain a disparity map; construct a three-dimensional point cloud of an image through two images taken before and after the rotation of the monocular gimbal camera, the rotation angle of the monocular gimbal camera, the intrinsic parameter matrix and the disparity map; and perform unit reconstruction on the three-dimensional point clouds of all images to obtain a final three-dimensional point cloud.
[0108] Optionally, the obtaining of an intrinsic parameter matrix based on a monocular gimbal camera includes:
[0109] Get the feature points on the calibration plate;
[0110] According to different angles and positions, the image of the calibration plate is captured to obtain the image of the calibration plate;
[0111] The calibration plate image is detected by image processing technology to detect the corner points of the calibration plate;
[0112] According to the corner points of the calibration plate and the actual size of the calibration plate, the intrinsic moment is calculated by a camera calibration algorithm. Optionally, the three-dimensional reconstruction method based on a monocular pan-tilt camera also includes:
[0113] Based on the local area network of the monocular pan-tilt camera, a three-dimensional reconstruction server is set, and the three-dimensional reconstruction server is set with a scheduled task to construct a three-dimensional point cloud of an image at fixed time intervals.
[0114] Optionally, correcting the image captured by the monocular gimbal camera to obtain a corrected image includes:
[0115] The 3D reconstruction server controls the monocular pan-tilt camera to rotate to a preset angle through a software development kit, captures an image at each preset angle, and receives the image;
[0116] The image is corrected by using distortion parameters, monocular gimbal camera posture parameters and the internal parameter matrix to obtain a corrected image.
[0117] Optionally, performing disparity calculation on two adjacent corrected images to obtain a disparity map includes:
[0118] The disparity of two adjacent corrected images is calculated using a preset matching algorithm to obtain a disparity map.
[0119] Optionally, the performing disparity calculation on two adjacent corrected images by using a preset matching algorithm to obtain a disparity map includes:
[0120] Calculate the cost volume of each pixel of two adjacent rectified images by convolution;
[0121] Calculate the aggregation cost of each pixel and its surrounding pixels according to the cost volume;
[0122] Performing path optimization according to the aggregated cost;
[0123] A disparity map is obtained according to the cost volume and the path optimization.
[0124] Optionally, constructing a three-dimensional point cloud of an image by using two images taken by a monocular gimbal camera before and after rotation, the rotation angle of the monocular gimbal camera, the intrinsic parameter matrix and the disparity map includes:
[0125] The calculation formula of the three-dimensional point cloud is:
[0126] P1=K*P
[0127] P2=K*R*P
[0128] Among them, P is the three-dimensional point cloud of any point in space, P1 is the coordinate of point P in the camera coordinate system, P2 is the coordinate of point P after the monocular gimbal camera is rotated, K is the intrinsic parameter matrix, and R is the rotation matrix calculated according to the rotation angle θ of the monocular gimbal camera.
[0129] It should be noted that the embodiments of the above method are all applicable to the embodiment of the device and can achieve the same technical effect.
[0130] The embodiment of the present invention further provides a computing device, comprising: a processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the method described above is executed. The embodiments of the above method are applicable to this embodiment and can achieve the same technical effect.
[0131] The embodiment of the present invention further provides a computer-readable storage medium storing instructions, which, when executed on a computer, enable the computer to execute the above method. The above method embodiments are applicable to this embodiment and can achieve the same technical effect.
[0132] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0133] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0134] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units 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 interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0135] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0136] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0137] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or 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: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0138] In addition, it should be noted that in the apparatus and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. Moreover, the steps of performing the above-mentioned series of processing can naturally be performed in chronological order according to the order of description, but it is not necessary to perform them in chronological order, and some steps can be performed in parallel or independently of each other. For those of ordinary skill in the art, it is understood that all or any steps or components of the method and apparatus of the present invention can be implemented in any computing device (including processors, storage media, etc.) or a network of computing devices in hardware, firmware, software or a combination thereof, which can be achieved by those of ordinary skill in the art using their basic programming skills after reading the description of the present invention.
[0139] Therefore, the purpose of the present invention can also be achieved by running a program or a group of programs on any computing device. The computing device can be a well-known general device. Therefore, the purpose of the present invention can also be achieved by simply providing a program product containing a program code that implements the method or device. That is to say, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any well-known storage medium or any storage medium developed in the future. It should also be pointed out that in the device and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. In addition, the steps of performing the above-mentioned series of processing can naturally be performed in chronological order according to the order of description, but it is not necessary to perform them in chronological order. Some steps can be performed in parallel or independently of each other.
[0140] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A three-dimensional reconstruction method based on a monocular pan-tilt camera, characterized in that: include: Get the intrinsic parameter matrix based on the monocular gimbal camera; Correcting the image captured by the monocular pan-tilt camera to obtain a corrected image; Performing disparity calculation on two adjacent corrected images to obtain a disparity map; Constructing a three-dimensional point cloud of an image through two images taken by the monocular gimbal camera before and after rotation, the rotation angle of the monocular gimbal camera, the intrinsic parameter matrix and the disparity map; Perform unit reconstruction on the 3D point clouds of all images to obtain the final 3D point cloud; After obtaining the internal parameter matrix based on the monocular pan-tilt camera, a three-dimensional reconstruction server is set based on the local area network of the monocular pan-tilt camera, and the three-dimensional reconstruction server is set with a timed task to construct a three-dimensional point cloud of an image at a fixed time interval; Correcting the image captured by the monocular pan-tilt camera to obtain a corrected image includes: The 3D reconstruction server controls the monocular pan-tilt camera to rotate to a preset angle through a software development kit, captures an image at each preset angle, and receives the image; Correcting the image by using distortion parameters, monocular gimbal camera attitude parameters and the internal parameter matrix to obtain a corrected image; The camera posture parameters include: rotation matrix R, Where θ is the rotation angle; The method constructs a three-dimensional point cloud of an image by using two images taken by the monocular gimbal camera before and after rotation, the rotation angle of the monocular gimbal camera, the intrinsic parameter matrix and the disparity map, including: The calculation formula of the three-dimensional point cloud is: P1=K*P P2=K*R*P Among them, P is the three-dimensional point cloud of any point in space, P1 is the coordinate of point P in the camera coordinate system, P2 is the coordinate of point P after the monocular gimbal camera is rotated, K is the intrinsic parameter matrix, and R is the rotation matrix calculated according to the rotation angle θ of the monocular gimbal camera.
2. The three-dimensional reconstruction method based on a monocular pan-tilt camera according to claim 1, characterized in that: The step of obtaining an internal parameter matrix based on a monocular gimbal camera includes: Get the feature points on the calibration plate; According to different angles and positions, the image of the calibration plate is captured to obtain the image of the calibration plate; The calibration plate image is detected by image processing technology to detect the corner points of the calibration plate; According to the corner points of the calibration plate and the actual size of the calibration plate, an intrinsic parameter matrix is calculated by a camera calibration algorithm.
3. The three-dimensional reconstruction method based on a monocular pan-tilt camera according to claim 1, characterized in that: The performing disparity calculation on two adjacent corrected images to obtain a disparity map includes: The disparity of two adjacent corrected images is calculated using a preset matching algorithm to obtain a disparity map.
4. The three-dimensional reconstruction method based on a monocular pan-tilt camera according to claim 3, characterized in that: The method of performing disparity calculation on two adjacent corrected images by using a preset matching algorithm to obtain a disparity map includes: Calculate the cost volume of each pixel of two adjacent rectified images by convolution; Calculate the aggregation cost of each pixel and its surrounding pixels according to the cost volume; Performing path optimization according to the aggregated cost; A disparity map is obtained according to the cost volume and the path optimization.
5. A three-dimensional reconstruction device based on a monocular pan-tilt camera, characterized in that: include: The acquisition module is used to obtain the intrinsic parameter matrix based on the monocular gimbal camera; A processing module is used to correct the image captured by the monocular pan-tilt camera to obtain a corrected image; perform disparity calculation on two adjacent corrected images to obtain a disparity map; construct a three-dimensional point cloud of an image through two images taken before and after the rotation of the monocular pan-tilt camera, the rotation angle of the monocular pan-tilt camera, the internal parameter matrix and the disparity map; perform unit reconstruction on the three-dimensional point clouds of all images to obtain a final three-dimensional point cloud; After obtaining the internal parameter matrix based on the monocular pan-tilt camera, a three-dimensional reconstruction server is set based on the local area network of the monocular pan-tilt camera, and the three-dimensional reconstruction server is set with a timed task to construct a three-dimensional point cloud of an image at a fixed time interval; Correcting the image captured by the monocular pan-tilt camera to obtain a corrected image includes: The 3D reconstruction server controls the monocular pan-tilt camera to rotate to a preset angle through a software development kit, captures an image at each preset angle, and receives the image; Correcting the image by using distortion parameters, monocular gimbal camera attitude parameters and the internal parameter matrix to obtain a corrected image; The camera posture parameters include: rotation matrix R, Where θ is the rotation angle; The method constructs a three-dimensional point cloud of an image by using two images taken by the monocular gimbal camera before and after rotation, the rotation angle of the monocular gimbal camera, the intrinsic parameter matrix and the disparity map, including: The calculation formula of the three-dimensional point cloud is: P1=K*P P2=K*R*P Among them, P is the three-dimensional point cloud of any point in space, P1 is the coordinate of point P in the camera coordinate system, P2 is the coordinate of point P after the monocular gimbal camera is rotated, K is the intrinsic parameter matrix, and R is the rotation matrix calculated according to the rotation angle θ of the monocular gimbal camera.
6. A computing device, characterized in that include: A processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the method according to any one of claims 1 to 4 is performed.
7. A computer-readable storage medium, characterized in that: Instructions are stored, and when the instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 4.
