Petrochemical pipeline three-dimensional reconstruction method based on multi-view optimization and storage medium
By using multi-view reconstruction technology with full-process optimization, combined with the characteristics of petrochemical pipelines, the problems of low reconstruction accuracy, weak anti-interference ability and poor adaptability in existing technologies have been solved. This has enabled high-precision and efficient 3D reconstruction of petrochemical pipelines and data storage optimization, which is suitable for high-precision 3D reconstruction of petrochemical plant areas.
Patent Information
- Application Number
- CN202610408655.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-31
- Publication Date
- 2026-06-26
AI Technical Summary
Existing multi-view reconstruction technology suffers from problems such as low reconstruction accuracy, weak anti-interference ability, poor adaptability and low efficiency in petrochemical pipeline scenarios. In particular, it is difficult to achieve high-precision 3D reconstruction under changes in lighting, dust obstruction and complex backgrounds. Furthermore, the data storage method is not suitable, resulting in insufficient integrity and reliability of the reconstructed model.
Through a comprehensive optimization design encompassing multi-view image preprocessing, feature extraction and matching optimization, camera parameter calibration and optimization, point cloud reconstruction and optimization, and 3D model construction and post-processing, combined with the structural characteristics and scenario requirements of petrochemical pipelines, improved SIFT-SURF fusion feature extraction algorithms, RANSAC algorithms, and Bundle Adjustment algorithms are employed to optimize feature matching and camera parameters, generate high-precision dense point clouds, perform texture mapping and accuracy verification, and optimize data storage methods to improve reconstruction accuracy and efficiency.
It achieves high-precision, efficient, and automated 3D reconstruction of petrochemical pipelines, improves the integrity and reliability of the reconstruction model, adapts to the reconstruction needs of petrochemical pipelines in different scenarios, and optimizes the security and scalability of data storage.
Smart Images

Figure CN122289543A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of petrochemical pipeline inspection and 3D reconstruction technology, and to a 3D reconstruction method and storage medium for petrochemical pipelines based on multi-view optimization. Background Technology
[0002] As the petrochemical industry transforms towards digitalization and intelligence, the demand for digital management of petrochemical pipelines is becoming increasingly urgent. Pipeline 3D reconstruction is a fundamental prerequisite for realizing digital management. By constructing a high-precision pipeline 3D model, functions such as pipeline visualization monitoring, fault location, life prediction, and maintenance planning can be realized, thereby improving the efficiency and safety of pipeline management.
[0003] Currently, the mainstream technologies for 3D reconstruction of petrochemical pipelines are mainly divided into three categories: laser scanning reconstruction technology, single-view reconstruction technology, and multi-view reconstruction technology. While laser scanning reconstruction technology can obtain high-precision point cloud data, it suffers from high equipment costs and complex operation. Furthermore, in the complex environment of petrochemical plants (such as dense pipelines, severe obstruction, high temperature and pressure, and flammable and explosive conditions), deploying laser scanners is difficult, hindering large-scale and efficient reconstruction. Single-view reconstruction technology uses a single image for 3D modeling, offering simple operation and low cost. However, limited by the information in a single view, it suffers from low reconstruction accuracy and poor model integrity, failing to recreate the complex spatial structure and detailed features of the pipeline, thus failing to meet the needs of refined management of petrochemical pipelines. Multi-view reconstruction technology, based on multiple images acquired from different perspectives, constructs a 3D model through feature matching, camera calibration, and point cloud reconstruction. It boasts advantages such as low equipment cost, simple operation, and wide applicability, and has become a research hotspot and mainstream development direction for 3D reconstruction of petrochemical pipelines.
[0004] However, existing multi-view reconstruction technologies, when applied to petrochemical pipeline scenarios, suffer from numerous technical shortcomings due to the inherent characteristics of petrochemical pipelines (such as smooth pipe surfaces, simple textures, and regular but densely distributed geometric shapes) and environmental interference (such as uneven lighting, dust pollution, equipment obstruction, and complex backgrounds). These shortcomings result in reconstruction accuracy and efficiency that fail to meet practical application requirements. Specific shortcomings are as follows: 1. Insufficient preprocessing of multi-view images: Multi-view images acquired in petrochemical scenes are easily affected by changes in lighting, dust occlusion, noise interference, etc., resulting in problems such as image blurring, low contrast, and obvious noise. Existing technologies only use simple filtering and grayscale processing, which cannot effectively remove noise and enhance image features, leading to difficulty in subsequent feature extraction and low matching accuracy, which in turn affects the accuracy of the reconstruction model.
[0005] 2. Low feature extraction and matching accuracy: Petrochemical pipelines have simple surface textures and repetitive geometric features (such as repeated appearance of pipe interfaces, supports, and other structures). Existing feature extraction algorithms (such as SIFT and SURF algorithms) extract a small number of feature points with low discrimination. Furthermore, the feature matching process does not consider the geometric constraints and redundant information between multiple views, which easily leads to mismatches and missed matches. This results in increased camera parameter calibration errors and deviations in point cloud reconstruction.
[0006] 3. Inadequate camera parameter calibration and optimization: In existing multi-view reconstruction technologies, camera parameter calibration often adopts the traditional checkerboard calibration method. During the calibration process, factors such as lens distortion and lighting interference in petrified scenes are not considered, and the calibrated parameters are not further optimized, resulting in large errors in the camera's intrinsic and extrinsic parameters, which in turn affects the accuracy of point cloud reconstruction. At the same time, the pose estimation between multiple views lacks global optimization, which easily leads to cumulative errors, causing problems such as misalignment and distortion in the reconstructed model.
[0007] 4. Poor point cloud reconstruction and optimization results: In the sparse point cloud reconstruction process, existing technologies do not perform redundancy removal and error correction on point pairs after feature matching, resulting in a large number of redundant and noisy points in the sparse point cloud, affecting the efficiency and accuracy of dense point cloud generation. In the dense point cloud generation process, no targeted optimization is performed based on the geometric features of the petrochemical pipeline, and there is a lack of denoising, smoothing, and hole filling processing for the dense point cloud, resulting in high noise, uneven surface, and unclear restoration of pipeline details (such as interface gaps and corrosion spots). In addition, existing technologies do not consider global stitching optimization of multi-view point clouds, which easily leads to problems such as stitching gaps and misalignments, affecting the integrity and accuracy of the 3D model.
[0008] 5. Inadequate post-processing of 3D models: Existing technologies generate mostly raw point cloud models or mesh models for pipelines without post-processing such as model simplification, texture mapping, and accuracy verification. This results in large model data volume, low rendering efficiency, poor texture reproduction, and blurred details, which cannot meet the practical application needs of pipeline digital management and fault detection. At the same time, there is a lack of effective accuracy verification methods, making it impossible to quantify the deviation between the reconstructed model and the real pipeline, and making it difficult to guarantee the reliability of the reconstructed model.
[0009] 6. Poor adaptability and practicality: Existing multi-view reconstruction methods are mostly applicable to general scenarios (such as building and object reconstruction), without taking into account the structural characteristics of petrochemical pipelines (such as cylindrical pipes, dense supports, and complex interfaces) for targeted design. They cannot adapt to the reconstruction needs of petrochemical pipelines with different diameters, layouts, and environments. Moreover, the reconstruction process is complex and has a low degree of automation, requiring a lot of manual intervention, making it difficult to achieve large-scale and efficient pipeline reconstruction, and thus lacking practicality.
[0010] 7. Insufficient compatibility of storage media: In existing technologies, the data (such as multi-view images, feature data, point cloud data, and 3D model data) in the reconstruction process is stored in a chaotic manner, without the use of efficient storage formats and compression algorithms, resulting in large data storage space and slow reading speed. At the same time, the storage media does not consider the security and scalability of data, which can easily lead to data loss, corruption and other problems, and cannot adapt to the data reading and processing needs of different devices (such as servers and terminal devices).
[0011] Furthermore, in the prior art, such as the invention patent application with publication number CN115082617A, a pipeline 3D reconstruction method based on multi-view optimization is disclosed. However, it mainly focuses on the reconstruction of images inside the pipeline and does not consider the complexity and interference factors of the external scene of the petrochemical pipeline. Moreover, the optimization measures in feature matching, point cloud optimization, and camera parameter calibration are not perfect, and the reconstruction accuracy and adaptability are difficult to meet the actual application needs of petrochemical pipelines. The invention patent application with publication number CN121414988A discloses a multi-view 3D reconstruction method, but it does not combine the characteristics of the pipeline for targeted optimization, has weak anti-interference ability, and lacks a complete accuracy verification and post-processing process, thus having limited practicality. Summary of the Invention
[0012] In view of this, the purpose of this invention is to address the aforementioned deficiencies in the existing technology by developing a multi-view optimized 3D reconstruction method and storage medium for petrochemical pipelines. Through optimized design across the entire process, including multi-view image preprocessing, feature extraction and matching, camera parameter calibration and optimization, point cloud reconstruction and optimization, and 3D model construction and post-processing optimization, combined with the structural characteristics and scenario requirements of petrochemical pipelines, the method improves reconstruction accuracy and efficiency, enhances anti-interference capabilities, and adapts to the reconstruction needs of petrochemical pipelines in different scenarios. Simultaneously, it optimizes data storage methods to ensure data security, efficiency, and scalability. This solves the problems of low reconstruction accuracy, weak anti-interference capabilities, poor adaptability, and low efficiency in existing technologies, achieving high-precision, efficient, and automated 3D reconstruction of petrochemical pipelines. It is applicable to high-precision 3D reconstruction of various petrochemical plants and oil and gas pipelines, providing reliable 3D model support for the digital management, fault detection, maintenance, and repair of petrochemical pipelines.
[0013] This invention provides a three-dimensional reconstruction method for petrochemical pipelines based on multi-view optimization, comprising the following steps: S1. Multi-view image acquisition: Using image acquisition equipment, multiple images of the target petrochemical pipeline are acquired from different angles and distances to construct a multi-view image set. S2. Multi-view image preprocessing: Preprocess each image in the multi-view image set to remove image noise, enhance image features, and unify image specifications to obtain a preprocessed multi-view image set. S3. Feature Extraction and Optimized Matching: Feature extraction is performed on each image in the preprocessed multi-view image set to obtain the feature point set and feature descriptor of each image; based on multi-view geometric constraints and feature similarity, preliminary matching is performed on the feature points of different view images to obtain initial feature matching pairs; the initial feature matching pairs are optimized to remove mismatched pairs and supplement missing matching pairs to obtain the optimal feature matching pairs. S4. Camera parameter calibration and optimization: Based on the optimal feature matching pair and the preset calibration template, the camera acquiring multi-view images is calibrated to obtain the initial intrinsic and extrinsic parameters of the camera; the initial intrinsic and extrinsic parameters of the camera are optimized to eliminate lens distortion and cumulative error, and the optimal intrinsic and extrinsic parameters of the camera are obtained. S5. Sparse Point Cloud Reconstruction and Optimization: Based on the optimal feature matching pair, optimal camera intrinsic parameters, and optimal extrinsic parameters, an improved motion recovery structure algorithm is used to generate a sparse point cloud of the target petrochemical pipeline; the sparse point cloud is then optimized to remove redundant and noise points, resulting in an optimized sparse point cloud. S6. Dense Point Cloud Generation and Optimization: Based on the optimized sparse point cloud and the preprocessed multi-view image, a dense reconstruction algorithm is used to generate a dense point cloud of the target petrochemical pipeline; the dense point cloud is optimized, including denoising, smoothing, and hole filling, to obtain the optimized dense point cloud. S7. 3D Model Construction and Post-processing: Based on the optimized dense point cloud, an initial 3D model of the target petrochemical pipeline is constructed; the initial 3D model is post-processed, including model simplification, texture mapping, and accuracy verification, to obtain the final 3D model of the target petrochemical pipeline. S8. Data storage: The multi-view image set, preprocessed image data, feature data, optimal camera parameters, optimized sparse point cloud, optimized dense point cloud, and final 3D model data are stored in a preset storage medium to complete the entire 3D reconstruction process.
[0014] Furthermore, the feature extraction method in step S3 includes: constructing a Gaussian difference pyramid and performing multi-scale extreme value detection to obtain initial feature points; after screening feature points with low contrast and weak edge response, using Taylor expansion for sub-pixel-level localization; calculating the gradient direction and magnitude of the neighborhood of the feature points, and assigning main and auxiliary directions; generating a SIFT feature descriptor (preferably 128-dimensional), and optimizing it with Haar wavelet features to obtain the final feature descriptor (preferably 144-dimensional). Furthermore, the method for optimizing the initial feature matching pair in step S3 includes: the initial feature matching adopts the nearest neighbor matching method combined with the second nearest neighbor matching method. For each feature point of the image to be matched, the feature point with the highest feature similarity in the reference image is selected as the nearest neighbor feature point, and the feature point with the second highest similarity is selected as the second nearest neighbor feature point. If the similarity ratio between the nearest neighbor feature point and the second nearest neighbor feature point is less than a preset threshold, the matching pair is considered to be a valid matching pair; otherwise, it is an invalid matching pair.
[0015] The specific process of feature extraction and optimized matching is as follows: S31. Feature Extraction: For each image in the preprocessed multi-view image set, an improved SIFT-SURF fusion feature extraction algorithm is used to extract the feature point set and feature descriptors of the image. The improved SIFT-SURF fusion feature extraction algorithm combines the anti-rotation and anti-scale change capabilities of the SIFT algorithm with the fast extraction capability of the SURF algorithm. The specific steps are as follows: S311. Constructing the Gaussian difference pyramid: Gaussian blurring is applied to the preprocessed image to obtain Gaussian images at different scales; Gaussian difference images are subtracted from each other to obtain Gaussian difference images, and a Gaussian difference pyramid is constructed. S312, Feature point detection: In the difference of Gaussian pyramid, extreme value detection is performed on each pixel. The pixel is compared with the 8 surrounding neighboring pixels and the 9 pixels in the adjacent scale above and below. If the pixel is an extreme point, it is used as the initial feature point. S313. Feature point screening and localization: Screen the initial feature points, remove feature points with low contrast and weak edge response, and use Taylor expansion to perform sub-pixel level localization on the screened feature points to improve the localization accuracy of feature points. S314. Feature point orientation assignment: Calculate the gradient direction and gradient magnitude in the neighborhood of each feature point and construct a gradient direction histogram; take the direction with the largest magnitude in the gradient direction histogram as the main direction of the feature point, and take the direction with a magnitude greater than 80% of the main direction as the auxiliary direction to improve the rotation invariance of the feature point. S315. Feature Descriptor Generation: A 16×16 neighborhood window is selected centered on the feature point; the neighborhood window is divided into 4×4 sub-windows, and the gradient magnitudes in 8 gradient directions are calculated for each sub-window to obtain a 128-dimensional feature descriptor; at the same time, the 128-dimensional feature descriptor is optimized by combining the Haar wavelet features of the SURF algorithm to increase the discriminative power of the feature descriptor, and the final feature descriptor is obtained. S316. Traverse all preprocessed images and extract the feature point set and feature descriptor for each image to obtain the {feature point set, feature descriptor} corresponding to each image. S32. Initial Feature Matching: Based on multi-view geometric constraints and feature similarity, preliminary matching of feature points in images from different views is performed to obtain initial feature matching pairs; the specific steps are as follows: S321. Select one image from the multi-view image set as the reference image, and the remaining images as images to be matched; S322. Calculate the feature descriptor similarity between each feature point in the image to be matched and all feature points in the reference image. Use Euclidean distance as the similarity metric; the smaller the Euclidean distance, the higher the feature similarity. The formula for calculating Euclidean distance is: ; in, D This represents the Euclidean distance between two feature descriptors. , These represent the first two feature descriptors. k Dimensional components; S323. Initial feature matching is performed using a combination of nearest neighbor matching and second nearest neighbor matching: For each feature point in the image to be matched, the feature point with the highest feature similarity (smallest Euclidean distance) in the reference image is selected as the nearest neighbor feature point, and the feature point with the second highest similarity is selected as the second nearest neighbor feature point; if the similarity ratio (nearest neighbor Euclidean distance / second nearest neighbor Euclidean distance) between the nearest neighbor feature point and the second nearest neighbor feature point is less than a preset threshold (the threshold value is 0.6-0.8), then the matching pair is considered a valid matching pair; otherwise, it is an invalid matching pair. S324. Combining multi-view geometric constraints, further filter the initial matching pairs: Based on the epipolar constraint principle, use the preliminary camera pose information of the reference image and the image to be matched to calculate the epipolar line of the image to be matched; for each initial matching pair, determine whether the feature points in the image to be matched are on the corresponding epipolar line. If they are on the epipolar line, retain the matching pair; otherwise, discard the matching pair; through epipolar constraints, remove some mismatched pairs to obtain the initial feature matching pairs. S33. Feature Matching Optimization: Optimize the initial feature matching pairs by removing mismatched pairs and supplementing missing pairs to obtain the optimal feature matching pairs; the specific steps are as follows: S331. Removing mismatched pairs based on the RANSAC algorithm, including: S3311. Randomly select 4 non-collinear matching pairs from the initial feature matching pairs and calculate the fundamental matrix F; S3312. Based on the fundamental matrix F, calculate the reprojection error for each initial feature matching pair; the formula for calculating the reprojection error is: ; in, e Indicates reprojection error, ( , ) represents the coordinates of feature points in the reference image, ( , () represents the coordinates of the corresponding feature point in the image to be matched. , , , , , These represent the elements of the fundamental matrix F; S3313. Set a reprojection error threshold (the threshold value is 1-3 pixels). If the reprojection error of a matching pair is less than the threshold, it is taken as an interior point; otherwise, it is taken as an exterior point. S3314. Repeat steps S3311-S3313, with the number of iterations preset to 1000-2000. Select the fundamental matrix F with the most interior points, and the corresponding interior points are the matching pairs after removing mismatches. S332. Supplement missing matching pairs, including: S3321. For the matching pairs after removing mismatches, calculate the disparity map between the reference image and the image to be matched; S3322. Based on the disparity map, analyze the unmatched regions in the image. For feature points in the unmatched regions, combine the geometric information of the surrounding matched feature points to predict their corresponding matching points. S3323. Calculate the feature similarity between the predicted matching point and the unmatched feature point. If the similarity is greater than the preset threshold, then add the matching pair as a supplementary matching pair to the matching pair set. S333. Redundant Matching Pair Removal: For the supplemented set of matching pairs, calculate the feature similarity and reprojection error of each matching pair, and remove redundant matching pairs with low feature similarity and large reprojection error; at the same time, use a clustering algorithm to perform cluster analysis on the matching pairs, remove redundant matching pairs near the cluster center, and retain representative matching pairs. S334. Global Matching Optimization: Based on global geometric constraints among multiple views, global optimization is performed on matching pairs of all views to minimize the sum of reprojection errors of all matching pairs, thus obtaining the optimal feature matching pair; the objective function of global optimization is: ; in, N Indicates the number of matching pairs. Indicates the first i The reprojection error of the matching pair is calculated; the objective function is solved by gradient descent to obtain the optimal feature matching pair.
[0016] Furthermore, the initial intrinsic parameters of the camera in step S4 include the focal length ( fx , fy ), principal point coordinates (cx , cy Radial distortion coefficient ( 、 、 ) and tangential distortion coefficient ( 、 ); The objective function for intrinsic parameter optimization is: ; in, M Indicates the number of multi-view images. Indicates the first i The number of feature points in an image Indicates the first i The first image j Reprojection error of each feature point; The objective function for extrinsic parameter optimization is: ; in, In the i-th image, the i-th... j The pixel coordinates of each feature point Represents the camera imaging projection function. 、 They represent the first i The camera rotation matrix and camera translation vector corresponding to each image. and Together constitute the first i The camera extrinsic parameters corresponding to each image Indicates the first j The spatial coordinates of each feature point K This represents the camera intrinsic parameter matrix.
[0017] The specific process of camera parameter calibration and optimization is as follows: S41. Camera parameter initialization and calibration: Based on the optimal feature matching pair and the preset checkerboard calibration template, the improved Zhang Zhengyou calibration method is used to calibrate the parameters of the camera acquiring multi-view images, obtaining the initial intrinsic and extrinsic parameters of the camera; the specific steps are as follows: S411. Calibration template preparation: Use a black and white checkerboard calibration template. The size of the checkerboard grid is 10mm×10mm. The number of rows and columns of the checkerboard grid is set according to the actual calibration requirements (e.g., 12 rows and 10 columns). Fix the calibration template on a flat surface to ensure that the calibration template is not deformed or obstructed. S412, Calibration Image Acquisition: Control the image acquisition device to acquire multiple calibration template images from different angles and distances (preferably no less than 20 images), ensuring that the calibration template is in different positions and angles in the images and covers the entire field of view of the images; S413, Corner Detection and Extraction: Corner detection is performed on each calibration template image. The Harris corner detection algorithm is combined with sub-pixel level localization to extract the corner coordinates of the checkerboard pattern. S414. Camera Intrinsic Parameter Initialization: Based on the extracted corner coordinates and combined with the camera imaging model of Zhang Zhengyou's calibration method, calculate the initial intrinsic parameters of the camera; the initial intrinsic parameters of the camera include the focal length (…). fx , fy ), principal point coordinates ( cx , cy Radial distortion coefficient ( 、 、 ) and tangential distortion coefficient ( 、 The camera imaging model is as follows: ; in,( u , v ) represents the image pixel coordinates, ( x w , y w , z w () represents the world coordinates of a point in space. z w This represents the distance from a point in space to the optical center of the camera. K This represents the camera intrinsic parameter matrix. R This represents the camera rotation matrix (external parameter). t This represents the camera translation vector (extrinsic parameter); Camera intrinsic parameter matrix K The expression is: ; S415. Camera extrinsic parameter initialization: Based on the initial camera intrinsic parameters and corner coordinates, calculate the camera extrinsic parameters (rotation matrix) corresponding to each calibration template image. R Translation vector t ); S416. Distortion Correction Verification: Using the calculated initial intrinsic parameters (including distortion coefficients), the calibration template image is distorted to verify the accuracy of the calibration results. If the lines of the checkerboard pattern in the corrected image are flat and without distortion, the initial calibration results are considered valid; otherwise, the calibration is repeated. S42. Camera Parameter Optimization: Optimize the initial intrinsic and extrinsic parameters of the camera to eliminate lens distortion and accumulated errors, obtaining the optimal intrinsic and extrinsic parameters. Specific steps are as follows: S421. Intrinsic Parameter Optimization: Based on the reprojection error of the optimal feature matching pair, optimize the initial intrinsic parameters of the camera; construct an objective function for intrinsic parameter optimization to minimize the sum of reprojection errors of all feature points. The objective function is: ; in, M Indicates the number of multi-view images. Indicates the first i The number of feature points in an image Indicates the first i The first image j The reprojection error of each feature point is calculated using the Levberg-Marquardt algorithm to solve the objective function and optimize the camera intrinsic parameters (focal length, principal point coordinates, distortion coefficients) to obtain the optimized camera intrinsic parameters. S422. Extrinsic Parameter Optimization: Based on the optimized camera intrinsic parameters and the optimal feature matching pairs, the initial extrinsic parameters of the camera are optimized. Bundle Adjustment is used to construct the objective function for extrinsic parameter optimization, minimizing the sum of reprojection errors of all feature points, while considering pose constraints between multiple views to eliminate accumulated errors in the extrinsic parameters. The objective function for extrinsic parameter optimization is: ; in, Indicates the first i The first image j The pixel coordinates of each feature point Represents the camera imaging projection function. 、 They represent the first i The camera rotation matrix and camera translation vector corresponding to each image. and Together constitute the first i The camera extrinsic parameters corresponding to each image Indicates the first j The spatial coordinates of each feature point K Let represent the camera intrinsic parameter matrix; by solving this objective function, the camera extrinsic parameters are optimized to obtain the optimized camera extrinsic parameters; S423, Global Parameter Verification: Substitute the optimized camera intrinsic and extrinsic parameters into the camera imaging model and calculate the reprojection error of all optimal feature matching pairs; if the average reprojection error is less than the preset threshold (the threshold value is 0.5-1 pixel), the optimized camera parameters are considered valid, and the optimal camera intrinsic and extrinsic parameters are obtained; otherwise, repeat steps S421-S422 until the error requirement is met. S424. Parameter storage: Store the optimal camera intrinsic and extrinsic parameters in a preset cache for subsequent steps such as sparse point cloud reconstruction and dense point cloud generation.
[0018] Furthermore, the method for preprocessing each image in the multi-view image set in step S2 includes: The image is converted to grayscale using a weighted average method. The formula for calculating the grayscale value is as follows: Gray = 0.299*R + 0.587*G + 0.114*B; Where Gray represents the grayscale value of a grayscale image, and R, G, and B represent the pixel values of the red, green, and blue channels of a color image, respectively. The filtering window size is adaptively adjusted based on the image noise intensity. An adaptive histogram equalization algorithm combined with an edge enhancement algorithm is used to enhance the denoised image. The equalized image is then fused with the edge image using the following formula: Enhanced = α*CLAHE(Gray) + β*Edge; Where Enhanced represents the enhanced image pixel value, CLAHE(Gray) represents the equalized image pixel value, Edge represents the edge image pixel value, α and β are fusion coefficients, α takes the value of 0.7-0.9, β takes the value of 0.1-0.3, and α+β=1.
[0019] The specific process of multi-view image preprocessing is as follows: S21. Image Grayscale Conversion: Each color image in the multi-view image set is converted to grayscale to reduce data volume and improve subsequent processing efficiency. A weighted average method is used for grayscale conversion, and the grayscale value calculation formula is as follows: Gray = 0.299*R + 0.587*G + 0.114*B; Where Gray represents the grayscale value of a grayscale image, and R, G, and B represent the pixel values of the red, green, and blue channels of a color image, respectively. S22. Image Denoising: Denoising is performed on the grayscale image to remove Gaussian noise, salt-and-pepper noise, and dust noise. An adaptive weighted median filtering algorithm is used for denoising. The specific steps are as follows: S221. Based on the image noise intensity, the stronger the noise, the larger the window. Set the filter window size to m×m, where m is an odd number, preferably 3, 5 or 7. S222. For each pixel (i,j) in the grayscale image, extract all pixel values within its filtering window, and calculate the median value Med, the maximum value Max, and the minimum value Min of the pixel values within the window. S223. Determine whether the gray value Gray(i,j) of the current pixel is within the range of [Min, Max]: If Gray(i,j) is within the range of [Min, Max], calculate the weighted average of the pixel values within the window and use the weighted average as the denoised gray value of the current pixel; if Gray(i,j) is not within the range of [Min, Max], use the median Med as the denoised gray value of the current pixel. S224. Traverse all pixels in the grayscale image to complete the image denoising process; S23. Image Enhancement: The Adaptive Histogram Equalization (CLAHE) algorithm combined with an edge enhancement algorithm is used to enhance the denoised image, improving its contrast and edge features to facilitate subsequent feature extraction. The specific steps are as follows: S231. Divide the denoised grayscale image into multiple sub-blocks, each sub-block having a size of 8×8 or 16×16. S232. Perform histogram equalization on each sub-block to limit the contrast gain of the histogram and avoid over-enhancement and noise amplification. S233. Use the Sobel operator to extract the edge features of the image to obtain the edge image; S234. The equalized image is fused with the edge image. The fusion formula is as follows: Enhanced = α*CLAHE(Gray) + β*Edge; Where Enhanced represents the enhanced image pixel value, CLAHE(Gray) represents the equalized image pixel value, Edge represents the edge image pixel value, α and β are fusion coefficients, α takes the value of 0.7-0.9, β takes the value of 0.1-0.3, and α+β=1; S24. Image Normalization: The enhanced image is normalized to bring its grayscale values to the range of [0, 255], unifying the grayscale range and preventing subsequent processing errors caused by differences in grayscale values. The normalization formula is: Normalized = (Enhanced - Min_Enhanced) / (Max_Enhanced - Min_Enhanced) * 255; Where Normalized represents the normalized image pixel values, Min_Enhanced represents the minimum gray value of the enhanced image, and Max_Enhanced represents the maximum gray value of the enhanced image. S25. Image size uniformity: The normalized images are processed to uniformly scale all images to a preset size (e.g., 1920×1080 pixels). Bilinear interpolation algorithm is used for scaling to ensure that there are no distortion or blurring problems after the images are scaled. S26. Image Correction: Distortion correction is performed on the images after unification to remove image distortion caused by lens distortion during image acquisition. Radial and tangential distortion correction models are used to correct the images according to preset lens distortion parameters, resulting in a preprocessed multi-view image set. Radial distortion mainly includes barrel distortion and pincushion distortion, while tangential distortion is mainly caused by lens mounting deviation. The correction model is as follows: The formula for radial distortion correction is: ; ; The formula for tangential distortion correction is: ; ; in,( x, y ) represents the pixel coordinates before correction, ( xdistorted , ydistorted () represents the corrected pixel coordinates. 、 、 The radial distortion coefficient is... 、 The tangential distortion coefficient is... r This represents the distance from a pixel to the center of the image.
[0020] Furthermore, the method for removing redundant and noisy points in step S5 includes: Redundant points are removed by combining distance judgment with DBSCAN clustering algorithm (preferred cluster radius is 0.1-0.3 mm, minimum number of cluster points is 5-10); noisy points are removed by statistical filtering algorithm (preferred screening radius is 0.5-1 mm, threshold number of neighbor points is 5-10); point cloud coordinates of cavity areas are predicted based on pipeline geometric features and multi-view image information, and point cloud completion is performed.
[0021] The specific process of sparse point cloud reconstruction and optimization is as follows: S51. Sparse Point Cloud Generation: Based on the optimal feature matching pairs, optimal camera intrinsic parameters, and optimal extrinsic parameters, an improved Structure for Motion Recovery (SfM) algorithm is used to generate a sparse point cloud of the target petrochemical pipeline; the specific steps are as follows: S511, Initial spatial point triangulation: Select the optimal feature matching pair between the reference image and the image to be matched. Based on the camera imaging model and the optimal camera parameters, use the triangulation algorithm to calculate the spatial point coordinates corresponding to each feature matching pair and generate the initial sparse point cloud. The core of the triangulation algorithm is to back-project the pixel coordinates to the three-dimensional space through the camera extrinsic parameters of the two views to solve for the spatial point coordinates. S512, Multi-view Spatial Point Expansion: The remaining images to be matched are added in sequence. Based on the optimal feature matching pair and the optimized camera extrinsic parameters, the initial sparse point cloud is expanded. The spatial point coordinates corresponding to the newly added feature matching pair are calculated and added to the sparse point cloud to gradually generate a complete target pipeline sparse point cloud. S513. Preliminary screening of sparse point cloud: Perform preliminary screening on the generated initial sparse point cloud to remove point clouds with abnormal spatial coordinates (such as coordinate values that are too large or too small) and excessive reprojection errors, and obtain a preliminary optimized sparse point cloud. S52. Sparse Point Cloud Optimization: Further optimize the initially optimized sparse point cloud by removing redundant and noisy points to improve its accuracy and completeness. The specific steps are as follows: S521. Redundant point removal: Calculate the distance between each point in the sparse point cloud and its surrounding points. If the distance between a point and multiple surrounding points is less than a preset threshold (the threshold value is 0.1-0.5mm, set according to the reconstruction accuracy requirements), then the point is considered a redundant point and is removed. At the same time, a clustering algorithm is used to perform cluster analysis on the sparse point cloud, remove redundant points in areas with excessive cluster density, and retain representative point clouds. S522. Noise Removal: A statistical filtering algorithm is used to denoise the sparse point cloud. The number of neighboring points within a preset radius (0.5-1mm) around each point is calculated. If the number of neighboring points is less than a preset threshold (5-10), the point is considered a noise point and is removed. For the remaining point cloud, the average distance between each point and its surrounding neighboring points is calculated. If the distance of a point is greater than twice the average distance, the point is considered a noise point and is removed. S523, Point Cloud Smoothing: The denoised sparse point cloud is smoothed using a Gaussian smoothing algorithm. The average coordinates of the surrounding neighboring points of each point are calculated and used as the new coordinates of the point, reducing the fluctuation of the point cloud and improving its flatness. At the same time, key feature points of the pipeline (such as interfaces and supports) are preserved to avoid feature loss due to smoothing. S524, Point Cloud Completion: Complete the smoothed sparse point cloud, analyze the hole regions in the point cloud (such as holes caused by pipe occlusion), predict the point cloud coordinates of the hole regions based on the geometric features of the surrounding point cloud and multi-view image information, generate a completed point cloud, and add it to the sparse point cloud to improve the integrity of the sparse point cloud. S525, Global Optimization: The Bundle Adjustment algorithm is used to perform global optimization on the optimized sparse point cloud. Combined with the optimal camera parameters, the sum of the reprojection errors of all point clouds is minimized, which further improves the accuracy of the sparse point cloud and obtains the optimized sparse point cloud.
[0022] Furthermore, the method for optimizing the dense point cloud in step S6 includes: combining spatial distance and gray-level similarity weights to improve the radius of the bilateral filtering window (preferably 0.5-1mm); achieving Poisson smoothing by constructing a Poisson surface of the point cloud and resampling; using a surface fitting algorithm to fill holes in the geometric features of the pipe, and supplementing the acquired images and regenerating the depth map for large-area holes.
[0023] The specific process of dense point cloud generation and optimization is as follows: S61. Dense Point Cloud Generation: Based on the optimized sparse point cloud and the preprocessed multi-view image, an improved Patch-Based Multi-View Stereo (PMVS) algorithm is used to generate a dense point cloud of the target petrochemical pipeline; the specific steps are as follows: S611, Image Patch Matching: Guided by the optimized sparse point cloud, the preprocessed multi-view image is divided into multiple image patches (each image patch is 16×16 or 32×32 pixels in size); for each image patch, in the corresponding position of other views, search for matching image patches, calculate the similarity of the image patches, and select the image patch with the highest similarity as the matching image patch; S612, Depth Map Generation: Based on the image patch matching results, calculate the depth value corresponding to each image patch and generate a depth map for each image; the depth value is calculated using a triangulation algorithm, combined with optimized camera parameters, to back-project the pixel coordinates of the image patch into three-dimensional space to solve for the depth value; S613, Depth Map Fusion: The depth maps of all views are fused using a weighted average method, which combines the similarity of image patches and the reliability of depth values to fuse the depth values of different views and obtain a global depth map. At the same time, regions with abnormal depth values and low reliability are removed to improve the accuracy of the global depth map. S614, Dense Point Cloud Generation: Based on the global depth map and optimized camera parameters, the depth map is back-projected into three-dimensional space to generate a dense point cloud of the target petrochemical pipeline; S62. Dense Point Cloud Optimization: The generated dense point cloud is optimized, including denoising, smoothing, and hole filling, to obtain an optimized dense point cloud; the specific steps are as follows: S621. Dense Point Cloud Denoising: An improved bilateral filtering algorithm is used to denoise dense point clouds. The bilateral filtering algorithm considers both spatial distance and gray-level similarity, which can remove point cloud noise while preserving the edge features of the pipes. The specific steps are as follows: S6211. Set the radius of the filter window (preferably 0.5-1mm). S6212. For each point P in the dense point cloud, extract all its neighboring points within the filtering window. S6213. Calculate the spatial distance weight and gray-level similarity weight between point P and each neighboring point; the spatial distance weight is calculated using a Gaussian function, and the gray-level similarity weight is calculated using an exponential function. S6214. Calculate the weighted average of neighboring points based on spatial distance weight and gray-level similarity weight, and use the weighted average as the new coordinates of point P. S6215. Traverse all points in the dense point cloud and complete the noise reduction process; S622, Dense Point Cloud Smoothing: The denoised dense point cloud is smoothed by using the Poisson smoothing algorithm to construct the Poisson surface of the point cloud, smoothing the surface, and then resampling to generate a smooth dense point cloud; during the smoothing process, the key details of the pipeline are preserved to avoid over-smoothing that leads to loss of details. S623. Dense Point Cloud Hole Filling: Hole filling is performed on the smoothed dense point cloud. The process involves analyzing empty areas in the point cloud (such as gaps at pipe joints or occlusions), and using a surface fitting algorithm based on the geometric features of the pipe (such as cylindrical structures) and multi-view image information to fit the surface of the empty area. Then, a hole-filling point cloud is generated and added to the dense point cloud to fill the holes. For large-area holes, image information from adjacent views is combined to supplement the collected images, and a new depth map is generated to complete the hole filling. S624. Point Cloud Simplification: The dense point cloud after hole filling is simplified by using a voxel grid filtering algorithm to divide the point cloud into multiple voxel grids (preferably with a voxel size of 0.1-0.3 mm). Each voxel grid retains a representative point (such as the center point of the voxel), removing redundant points, reducing the amount of point cloud data, and improving the efficiency of subsequent 3D model construction. At the same time, it ensures that the simplified point cloud can completely retain the geometric features and details of the pipe. S625. Accuracy Verification: Verify the accuracy of the simplified dense point cloud by randomly selecting multiple point clouds and measuring their distance from the corresponding positions of the real pipeline, and calculating the average error. If the average error is less than the preset threshold (the threshold value is 0.1-0.3mm, set according to the reconstruction accuracy requirements), the optimized dense point cloud is considered valid. Otherwise, repeat steps S621-S624 until the error requirements are met, and the optimized dense point cloud is obtained.
[0024] Furthermore, the method for post-processing the initial 3D model in step S7 includes: The model is simplified by using an edge folding simplification algorithm (preferably with a folding error threshold of 0.05-0.1mm), and the number of triangular facets is adjusted according to actual application requirements (preferably 1 million-5 million). The texture mapping includes texture image preprocessing, texture coordinate allocation, bilinear interpolation mapping, and texture smooth transition optimization.
[0025] Preferably, the average coordinate error threshold for accuracy verification is 0.1-0.3 mm, and the registration error threshold is 0.05-0.1 mm; the final 3D model is converted into one or more formats among OBJ, STL, and PLY.
[0026] The specific process of 3D model construction and post-processing is as follows: S71. Initial 3D Model Construction: Based on the optimized dense point cloud, the Poisson surface reconstruction algorithm is used to construct the initial 3D model of the target petrochemical pipeline; the specific steps are as follows: S711, Point Cloud Normal Vector Estimation: Calculate the normal vector of each point in the optimized dense point cloud. Use the least squares method to fit the plane of the neighboring points of each point. The normal vector of the plane is the normal vector of that point. At the same time, normalize the normal vector to ensure the consistency of the normal vector (pointing outwards from the pipe). S712, Poisson Surface Fitting: Based on point cloud and normal vector, construct the Poisson equation, solve the Poisson equation to obtain the implicit surface, and fit the surface shape of the pipe; by adjusting the parameters of the Poisson equation, control the smoothness and detail retention of the surface; S713, 3D Mesh Generation: The fitted implicit surface is sampled to generate a 3D mesh model, resulting in the initial 3D model of the target petrochemical pipeline; the initial 3D model is a triangular mesh model containing a large number of triangular facets, which can completely restore the geometric shape and detailed features of the pipeline. S72. Post-processing of the 3D model: Post-processing of the initial 3D model includes model simplification, texture mapping, and accuracy verification to obtain the final 3D model of the target petrochemical pipeline; the specific steps are as follows: S721. Model Simplification: The initial 3D mesh model is simplified to reduce the number of triangles, decrease the model data volume, and improve rendering and storage efficiency. An edge-folding simplification algorithm is used to evaluate each edge in the mesh model and calculate the error after edge folding. If the error after edge folding is less than a preset threshold (the threshold value is 0.05-0.1mm), the edge is folded and adjacent triangles are merged. This process is repeated until the number of triangles in the model reaches a preset value (set according to actual application requirements, such as 1 million to 5 million triangles). At the same time, key details of the pipes (such as interfaces, supports, and corrosion spots) are preserved to avoid loss of details due to simplification. S722. Texture Mapping: Texture mapping is performed on the simplified mesh model, mapping the texture information of the preprocessed multi-view image onto the surface of the mesh model to improve the realism and detail reproduction of the model; the specific steps are as follows: S7221. Texture Image Preprocessing: Extract textures from the preprocessed multi-view image to remove noise and occluded areas, resulting in a clean texture image; simultaneously, stitch the texture images together to generate a complete pipe texture image. S7222, Texture Coordinate Assignment: Assign texture coordinates to each vertex of the mesh model. Use a parameterized algorithm to map the 3D mesh model to a 2D texture space to obtain the 2D texture coordinates of each vertex. S7223, Texture Mapping: Match the stitched texture image with the texture coordinates of the mesh model. Use bilinear interpolation algorithm to map the pixel values of the texture image to each triangular facet of the mesh model to complete the texture mapping. S7224. Texture Optimization: The mapped texture is optimized to remove issues such as texture stretching, blurring, and seams. For texture seams, a smooth transition algorithm is used to make the texture stitching natural. For blurred texture areas, an image enhancement algorithm is used to enhance texture details. S723, Model Repair: Repair the textured mesh model, checking for issues such as holes, cracks, and overlapping patches. For holes and cracks, use a patch filling algorithm to fill them. For overlapping patches, remove redundant overlapping patches and retain the correct ones. At the same time, repair distorted and deformed areas in the model to ensure the integrity and accuracy of the model. S724. Accuracy Verification: Verify the accuracy of the repaired 3D model using one or a combination of the following two verification methods: Method 1: Select multiple key verification points (such as the center of the pipe interface, the top of the support, and the center of the valve), measure the coordinates of the verification points in the 3D model and the coordinates of the corresponding verification points on the actual pipe, and calculate the coordinate error; if the average coordinate error is less than the preset threshold (the threshold value is 0.1-0.3mm), the model accuracy is considered to meet the standard. Method 2: Compare the 3D model with the real pipeline. Use a point cloud registration algorithm to register the optimized dense point cloud with the surface point cloud of the 3D model and calculate the registration error. If the registration error is less than a preset threshold (the threshold value is 0.05-0.1mm), the model accuracy is considered to meet the standard. If the accuracy verification fails, return to steps S721-S723 and re-perform post-processing until the accuracy requirements are met. S725, Model Format Conversion: Converts 3D models that meet accuracy standards into preset formats (such as OBJ, STL, PLY, etc.) to suit different application scenarios (such as digital management systems, fault detection systems, CAD design systems); at the same time, it generates model thumbnails and attribute information (such as model dimensions, reconstruction time, accuracy parameters) to facilitate model management and use; S726. Final Model Output: Output the final 3D model of the target petrochemical pipeline for subsequent digital management, fault detection, maintenance and repair work.
[0027] Furthermore, the method for acquiring multiple pipe images and constructing a multi-view image set in step S1 includes: The system presets the acquisition path and acquisition interval, and acquires multiple images from multiple perspectives and distances of the petrochemical pipeline. After screening, it constructs a multi-view image set that meets the clarity requirements.
[0028] The specific process of multi-view image acquisition is as follows: S11. Preprocess the target pipeline by cleaning the surface of the target petrochemical pipeline of dust, oil stains and obstructions, and marking the key feature points of the pipeline (such as pipeline interfaces, supports, valves and elbows) to facilitate subsequent feature extraction and matching. S12. Deploy acquisition equipment: Based on the layout, length, diameter, and lighting / obstruction conditions of the target petrochemical pipeline, deploy image acquisition equipment. This equipment includes one or more of high-definition cameras, drones, and industrial cameras. The resolution of the image acquisition equipment must be no less than 1080P, the frame rate no less than 30fps, and the lens must be a fixed-focus lens with a focal length of 24-50mm. For scenarios involving high-altitude or densely packed pipelines where manual acquisition is difficult, drones equipped with high-definition cameras will be used for acquisition. For details of pipelines, such as interfaces and corrosion spots, industrial cameras will be used for close-range acquisition. S13. Multi-view Image Acquisition: Control the image acquisition device to acquire multiple images of the target petrochemical pipeline from different perspectives and distances, following a preset acquisition path and acquisition interval. The acquisition path includes one or more of the following: a circular path, a straight path, and a polygonal path. The circular path is used to acquire images of the pipeline in the circumferential direction, the straight path is used to acquire images of the pipeline in the axial direction, and the polygonal path is used to acquire images of pipelines with complex layouts. The acquisition interval is set according to the pipeline diameter and reconstruction accuracy requirements. The smaller the pipeline diameter and the higher the reconstruction accuracy requirements, the smaller the acquisition interval. The overlap rate between two adjacent images is not less than 60%. During the acquisition process, ensure the stability of the image acquisition device's posture to avoid problems such as image blurring and jitter. At the same time, record the acquisition time, acquisition position, and acquisition posture information of each image for subsequent camera parameter calibration and point cloud stitching. S14. Image Filtering: Perform preliminary filtering on the acquired multiple pipe images to remove blurry, overexposed, underexposed, and severely occluded images to obtain a qualified multi-view image set; the number of images in the multi-view image set is determined according to the complexity of the target pipe, with no less than 50 images for simple layout pipes and no less than 100 images for complex layout pipes.
[0029] This invention also provides a storage medium for storing reconstruction data of the petrochemical pipeline 3D reconstruction method based on multi-view optimization as described above. The storage medium adopts a hierarchical storage structure, dividing the reconstruction data into six categories: raw data, preprocessed data, feature data, camera parameter data, point cloud data, and 3D model data. It employs efficient compression algorithms and encryption mechanisms, supports multi-device adaptation, and has data backup and scalability functions. The raw data includes a multi-view image set, acquisition device parameters, acquisition position, and attitude information. The 3D model data includes an initial 3D model, an optimized 3D model, and model attribute information.
[0030] Compared with the prior art, the beneficial effects of the present invention are as follows: The multi-view optimized 3D reconstruction method and storage medium for petrochemical pipelines provided by this invention optimizes the entire process, including multi-view image preprocessing, feature extraction and matching, camera parameter calibration and optimization, point cloud reconstruction and optimization, and 3D model construction and post-processing. Combined with the structural characteristics and scenario requirements of petrochemical pipelines, it improves reconstruction accuracy and efficiency, enhances anti-interference capabilities, and adapts to the reconstruction needs of petrochemical pipelines in different scenarios. Simultaneously, it optimizes data storage methods, ensuring data security, efficiency, and scalability. This effectively solves the problems of low reconstruction accuracy, weak anti-interference capabilities, poor adaptability, and low efficiency in existing technologies. It enables high-precision, efficient, and automated 3D reconstruction of petrochemical pipelines, applicable to various petrochemical plants and oil and gas pipelines. It provides reliable 3D model support for the digital management, fault detection, maintenance, and repair of petrochemical pipelines, and has broad application prospects. Attached Figure Description
[0031] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention.
[0032] In the attached diagram: Figure 1 This is a step diagram of the three-dimensional reconstruction method for petrochemical pipelines based on multi-view optimization according to an embodiment of the present invention. Detailed Implementation
[0033] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and products consistent with some aspects of this disclosure as detailed in the appended claims.
[0034] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0035] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0036] The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0037] This invention provides a method for three-dimensional reconstruction of petrochemical pipelines based on multi-view optimization. (See also...) Figure 1 As shown, it includes the following steps: S1. Using image acquisition equipment, multiple images of the target petrochemical pipeline are acquired from different angles and distances to construct a multi-view image set. Specifically, the acquisition path and acquisition interval are preset, and multiple images are acquired from multiple perspectives and distances of the petrochemical pipeline. After screening, a multi-view image set that meets the clarity requirements is constructed.
[0038] The process of acquiring multi-view images is as follows: S11. Preprocess the target pipeline by cleaning the dust, oil, and other obstructions from the surface of the target petrochemical pipeline and marking the key feature points of the pipeline (pipeline interfaces, supports, valves, elbows, etc.) to facilitate subsequent feature extraction and matching. S12. Based on the layout, length, diameter, and lighting and occlusion conditions of the target petrochemical pipeline, deploy image acquisition equipment, including one or more of high-definition cameras, drones, and industrial cameras; for scenarios where it is difficult to collect images manually, such as high-altitude pipelines and dense pipelines, use drones equipped with high-definition cameras for acquisition; for pipeline details such as interfaces and corrosion spots, use industrial cameras for close-range acquisition. The image acquisition device has a resolution of no less than 1080P, a frame rate of no less than 30fps, and uses a fixed-focus lens with a focal length of 24-50mm.
[0039] S13. Multi-view Image Acquisition: Control the image acquisition device to acquire multiple images of the target petrochemical pipeline from different perspectives and distances, following a preset acquisition path and acquisition interval. The acquisition path includes one or more of the following: a circular path, a straight path, and a polyline path. The circular path is used to acquire images of the pipeline in the circumferential direction, the straight path is used to acquire images of the pipeline in the axial direction, and the polyline path is used to acquire images of pipelines with complex layouts. The acquisition interval is set according to the pipeline diameter and reconstruction accuracy requirements. The smaller the pipeline diameter and the higher the reconstruction accuracy requirements, the smaller the acquisition interval. Record the acquisition time, acquisition position, and acquisition posture information of each image for subsequent camera parameter calibration and point cloud stitching. The overlap rate between two adjacent images should not be less than 60%; during the acquisition process, the posture of the image acquisition device should be kept stable to avoid problems such as image blurring and shaking; S14. Image Filtering: Perform preliminary filtering on the acquired multiple pipe images to remove blurry, overexposed, underexposed, and severely occluded images to obtain a qualified multi-view image set; the number of images in the multi-view image set is determined according to the complexity of the target pipe, with no less than 50 images for simple layout pipes and no less than 100 images for complex layout pipes.
[0040] S2. Preprocess each image in the multi-view image set to remove image noise, enhance image features, and unify image specifications to obtain a preprocessed multi-view image set. The image is converted to grayscale using a weighted average method. The formula for calculating the grayscale value is as follows: Gray = 0.299*R + 0.587*G + 0.114*B; Where Gray represents the grayscale value of a grayscale image, and R, G, and B represent the pixel values of the red, green, and blue channels of a color image, respectively. The filtering window size is adaptively adjusted based on the image noise intensity. An adaptive histogram equalization algorithm combined with an edge enhancement algorithm is used to enhance the denoised image. The equalized image is then fused with the edge image using the following formula: Enhanced = α*CLAHE(Gray) + β*Edge; Where Enhanced represents the enhanced image pixel value, CLAHE(Gray) represents the equalized image pixel value, Edge represents the edge image pixel value, α and β are fusion coefficients, α takes the value of 0.7-0.9, β takes the value of 0.1-0.3, and α+β=1.
[0041] The process of multi-view image preprocessing is as follows: S21. Perform grayscale processing on each color image in the multi-view image set, converting the color images to grayscale images to reduce the amount of data and improve the efficiency of subsequent processing; use a weighted average method for grayscale processing, and the grayscale value calculation formula is as follows: Gray = 0.299*R + 0.587*G + 0.114*B; Where Gray represents the grayscale value of a grayscale image, and R, G, and B represent the pixel values of the red, green, and blue channels of a color image, respectively. S22. Denoising the grayscale image to remove Gaussian noise, salt-and-pepper noise, and dust noise is performed using an adaptive weighted median filtering algorithm. The specific steps are as follows: S221. Based on the image noise intensity, the stronger the noise, the larger the window. Set the filter window size to m×m, where m is an odd number, preferably 3, 5 or 7. S222. For each pixel (i,j) in the grayscale image, extract all pixel values within its filtering window, and calculate the median value Med, the maximum value Max, and the minimum value Min of the pixel values within the window. S223. Determine whether the gray value Gray(i,j) of the current pixel is within the range of [Min, Max]: If Gray(i,j) is within the range of [Min, Max], calculate the weighted average of the pixel values within the window and use the weighted average as the denoised gray value of the current pixel; if Gray(i,j) is not within the range of [Min, Max], use the median Med as the denoised gray value of the current pixel. S224. Traverse all pixels in the grayscale image to complete the image denoising process; S23. The adaptive histogram equalization (CLAHE) algorithm combined with an edge enhancement algorithm is used to enhance the denoised image, thereby improving the image's contrast and edge features to facilitate subsequent feature extraction. This includes the following steps: S231. Divide the denoised grayscale image into multiple sub-blocks, each sub-block having a size of 8×8 or 16×16. S232. Perform histogram equalization on each sub-block to limit the contrast gain of the histogram and avoid over-enhancement and noise amplification. S233. Use the Sobel operator to extract the edge features of the image to obtain the edge image; S234. The equalized image is fused with the edge image. The fusion formula is as follows: Enhanced = α*CLAHE(Gray) + β*Edge; Where Enhanced represents the enhanced image pixel value, CLAHE(Gray) represents the equalized image pixel value, Edge represents the edge image pixel value, α and β are fusion coefficients, α takes the value of 0.7-0.9, β takes the value of 0.1-0.3, and α+β=1; S24. Normalize the enhanced image to bring the grayscale values to the range of [0, 255], unifying the grayscale range and avoiding errors in subsequent processing due to differences in grayscale values. The normalization formula is: Normalized = (Enhanced - Min_Enhanced) / (Max_Enhanced - Min_Enhanced) * 255; Where Normalized represents the normalized image pixel values, Min_Enhanced represents the minimum gray value of the enhanced image, and Max_Enhanced represents the maximum gray value of the enhanced image. S25. Perform size unification processing on the normalized images, scaling all images to a preset size of 1920×1080 pixels using bilinear interpolation algorithm to ensure that the images will not have distortion or blurring after scaling. S26. Perform distortion correction on the images after unifying their size to remove image distortion caused by lens distortion during image acquisition. Using radial and tangential distortion correction models, and based on preset lens distortion parameters, correct the images to obtain a preprocessed multi-view image set. Radial distortion mainly includes barrel distortion and pincushion distortion, while tangential distortion is mainly caused by lens mounting deviation. The correction model is as follows: The formula for radial distortion correction is: ; ; The formula for tangential distortion correction is: ; ; in,( x, y ) represents the pixel coordinates before correction, ( xdistorted , ydistorted () represents the corrected pixel coordinates. 、 、 The radial distortion coefficient is... 、 The tangential distortion coefficient is... r This represents the distance from a pixel to the center of the image.
[0042] S3. Extract features from each image in the preprocessed multi-view image set to obtain the feature point set and feature descriptor for each image; perform preliminary matching of feature points in different view images based on multi-view geometric constraints and feature similarity to obtain initial feature matching pairs; optimize the initial feature matching pairs by removing mismatched pairs and supplementing missing matching pairs to obtain the optimal feature matching pairs. Specifically, a Gaussian difference pyramid is constructed and multi-scale extremum detection is performed to obtain initial feature points; after filtering feature points with low contrast and weak edge response, Taylor expansion is used for sub-pixel level localization; the gradient direction and magnitude of the neighborhood of the feature points are calculated, and the main direction and auxiliary direction are assigned; a 128-dimensional SIFT feature descriptor is generated, which is then optimized into a 144-dimensional final feature descriptor by combining Haar wavelet features. The initial feature matching uses a combination of nearest neighbor matching and second nearest neighbor matching. For each feature point in the image to be matched, the feature point with the highest feature similarity in the reference image is selected as the nearest neighbor feature point, and the feature point with the second highest similarity is selected as the second nearest neighbor feature point. If the similarity ratio between the nearest neighbor feature point and the second nearest neighbor feature point is less than a preset threshold, the matching pair is considered a valid matching pair; otherwise, it is an invalid matching pair.
[0043] The process of feature extraction and optimized matching is as follows: S31. Feature Extraction: For each image in the preprocessed multi-view image set, an improved SIFT-SURF fusion feature extraction algorithm is used to extract the feature point set and feature descriptors of the image. The improved SIFT-SURF fusion feature extraction algorithm combines the anti-rotation and anti-scale change capabilities of the SIFT algorithm with the fast extraction capability of the SURF algorithm. The specific steps are as follows: S311. Perform Gaussian blur processing on the preprocessed image to obtain Gaussian images at different scales; subtract Gaussian images at adjacent scales to obtain Gaussian difference images, and construct a Gaussian difference pyramid. S312. In the difference of Gaussian pyramid, perform extreme value detection on each pixel, compare the pixel with the 8 surrounding neighboring pixels and the 9 pixels in the adjacent scale above and below. If the pixel is an extreme value, use it as the initial feature point. S313. Filter the initial feature points, remove feature points with low contrast and weak edge response, and use Taylor expansion to perform sub-pixel level positioning of the filtered feature points to improve the positioning accuracy of the feature points. S314. Calculate the gradient direction and gradient magnitude in the neighborhood of each feature point and construct a gradient direction histogram. Take the direction with the largest magnitude in the gradient direction histogram as the main direction of the feature point, and take the direction with a magnitude greater than 80% of the main direction as the auxiliary direction to improve the rotation invariance of the feature point. S315. Select a 16×16 neighborhood window centered on the feature point; divide the neighborhood window into 4×4 sub-windows, calculate the gradient magnitude in 8 gradient directions for each sub-window, and obtain a 128-dimensional feature descriptor; at the same time, combine the Haar wavelet features of the SURF algorithm to optimize the 128-dimensional feature descriptor, increase the discriminative power of the feature descriptor, and obtain the final feature descriptor. S316. Traverse all preprocessed images and extract the feature point set and feature descriptor for each image to obtain the {feature point set, feature descriptor} corresponding to each image. S32. Based on multi-view geometric constraints and feature similarity, preliminary matching of feature points in images from different views is performed to obtain initial feature matching pairs; the specific steps are as follows: S321. Select one image from the multi-view image set as the reference image, and the remaining images as images to be matched; S322. Calculate the feature descriptor similarity between each feature point in the image to be matched and all feature points in the reference image. Use Euclidean distance as the similarity metric; the smaller the Euclidean distance, the higher the feature similarity. The formula for calculating Euclidean distance is: ; in, D This represents the Euclidean distance between two feature descriptors. , These represent the first two feature descriptors. k Dimensional components; S323. Initial feature matching is performed using a combination of nearest neighbor matching and second nearest neighbor matching: For each feature point in the image to be matched, the feature point with the highest feature similarity (smallest Euclidean distance) in the reference image is selected as the nearest neighbor feature point, and the feature point with the second highest similarity is selected as the second nearest neighbor feature point; if the similarity ratio (nearest neighbor Euclidean distance / second nearest neighbor Euclidean distance) between the nearest neighbor feature point and the second nearest neighbor feature point is less than a preset threshold (the threshold value is 0.8), then the matching pair is considered a valid matching pair; otherwise, it is an invalid matching pair. S324. Combining multi-view geometric constraints, further filter the initial matching pairs: Based on the epipolar constraint principle, use the preliminary camera pose information of the reference image and the image to be matched to calculate the epipolar line of the image to be matched; for each initial matching pair, determine whether the feature points in the image to be matched are on the corresponding epipolar line. If they are on the epipolar line, retain the matching pair; otherwise, discard the matching pair; through epipolar constraints, remove some mismatched pairs to obtain the initial feature matching pairs. S33. Optimize the initial feature matching pairs by removing mismatched pairs and supplementing missing pairs to obtain the optimal feature matching pairs; the specific steps are as follows: S331. Removing mismatched pairs based on the RANSAC algorithm, including: S3311. Randomly select 4 non-collinear matching pairs from the initial feature matching pairs and calculate the fundamental matrix F; S3312. Based on the fundamental matrix F, calculate the reprojection error for each initial feature matching pair; the formula for calculating the reprojection error is: ; in, e Indicates reprojection error, ( , ) represents the coordinates of feature points in the reference image, ( , () represents the coordinates of the corresponding feature point in the image to be matched. , , , , , These represent the elements of the fundamental matrix F; S3313. Set a reprojection error threshold (the threshold value is 3 pixels). If the reprojection error of a matching pair is less than the threshold, then it is regarded as an interior point; otherwise, it is regarded as an exterior point. S3314. Repeat steps S3311-S3313, with the number of iterations preset to 1000-2000. Select the fundamental matrix F with the most interior points, and the corresponding interior points are the matching pairs after removing mismatches. S332. Supplement missing matching pairs, including: S3321. For the matching pairs after removing mismatches, calculate the disparity map between the reference image and the image to be matched; S3322. Based on the disparity map, analyze the unmatched regions in the image. For feature points in the unmatched regions, combine the geometric information of the surrounding matched feature points to predict their corresponding matching points. S3323. Calculate the feature similarity between the predicted matching point and the unmatched feature point. If the similarity is greater than the preset threshold, then add the matching pair as a supplementary matching pair to the matching pair set. S333. Redundant Matching Pair Removal: For the supplemented set of matching pairs, calculate the feature similarity and reprojection error of each matching pair, and remove redundant matching pairs with low feature similarity and large reprojection error; at the same time, use a clustering algorithm to perform cluster analysis on the matching pairs, remove redundant matching pairs near the cluster center, and retain representative matching pairs. S334. Global Matching Optimization: Based on global geometric constraints among multiple views, global optimization is performed on matching pairs of all views to minimize the sum of reprojection errors of all matching pairs, thus obtaining the optimal feature matching pair; the objective function of global optimization is: ; in, N Indicates the number of matching pairs. Indicates the first i The reprojection error of the matching pair is calculated; the objective function is solved by gradient descent to obtain the optimal feature matching pair.
[0044] S4. Based on the optimal feature matching pair and the preset calibration template, perform parameter calibration on the camera that acquires multi-view images to obtain the initial intrinsic and extrinsic parameters of the camera; optimize the initial intrinsic and extrinsic parameters of the camera to eliminate lens distortion and cumulative error, and obtain the optimal intrinsic and extrinsic parameters of the camera. The camera's initial intrinsic parameters include focal length ( fx , fy ), principal point coordinates ( cx , cy Radial distortion coefficient ( 、 、 ) and tangential distortion coefficient ( 、 ); The objective function for intrinsic parameter optimization is: ; in, M Indicates the number of multi-view images. Indicates the first i The number of feature points in an image Indicates the first i The first image j Reprojection error of each feature point; The objective function for extrinsic parameter optimization is: ; in, In the i-th image, the i-th... j The pixel coordinates of each feature point Represents the camera imaging projection function. 、 They represent the first i The camera rotation matrix and camera translation vector corresponding to each image. and Together constitute the first i The camera extrinsic parameters corresponding to each image Indicates the first j The spatial coordinates of each feature point K This represents the camera intrinsic parameter matrix.
[0045] The specific process of camera parameter calibration and optimization is as follows: S41. Camera parameter initialization and calibration: Based on the optimal feature matching pair and the preset checkerboard calibration template, the improved Zhang Zhengyou calibration method is used to calibrate the parameters of the camera acquiring multi-view images, obtaining the initial intrinsic and extrinsic parameters of the camera, including the following steps: S411. Calibration template preparation: Use a black and white checkerboard calibration template. The size of the checkerboard grid is 10mm×10mm. The number of rows and columns of the checkerboard grid is set according to the actual calibration requirements (12 rows and 10 columns). Fix the calibration template on a flat surface to ensure that the calibration template is not deformed or obstructed. S412, Calibration Image Acquisition: Control the image acquisition device to acquire multiple calibration template images from different angles and distances, with a total of 20 images acquired, ensuring that the position and angle of the calibration template in the images are different and that the images cover the entire field of view; S413, Corner Detection and Extraction: Corner detection is performed on each calibration template image. The Harris corner detection algorithm is combined with sub-pixel level localization to extract the corner coordinates of the checkerboard pattern. S414. Camera Intrinsic Parameter Initialization: Based on the extracted corner coordinates and combined with the camera imaging model of Zhang Zhengyou's calibration method, calculate the initial intrinsic parameters of the camera; the initial intrinsic parameters of the camera include the focal length (…). fx , fy ), principal point coordinates ( cx , cy Radial distortion coefficient ( 、 、 ) and tangential distortion coefficient ( 、 The camera imaging model is as follows: ; in,( u , v ) represents the image pixel coordinates, ( x w , y w , z w () represents the world coordinates of a point in space. z w This represents the distance from a point in space to the optical center of the camera. K This represents the camera intrinsic parameter matrix. R This represents the camera rotation matrix (external parameter). t This represents the camera translation vector (extrinsic parameter); The expression for the camera intrinsic parameter matrix K is: ; S415. Based on the initial intrinsic parameters of the camera and the corner coordinates, calculate the extrinsic parameters (rotation matrix) of the camera corresponding to each calibration template image. R Translation vector t ); S416. Using the calculated initial intrinsic parameters (including distortion coefficients), perform distortion correction on the calibration template image to verify the accuracy of the calibration results. If the lines of the checkerboard in the corrected image are flat and without distortion, the initial calibration results are considered valid; otherwise, recalibrate. S42. Optimize the initial intrinsic and extrinsic parameters of the camera to eliminate lens distortion and accumulated errors, and obtain the optimal intrinsic and extrinsic parameters of the camera; the specific steps are as follows: S421. Based on the reprojection error of the optimal feature matching pair, optimize the initial intrinsic parameters of the camera; construct an objective function for intrinsic parameter optimization that minimizes the sum of the reprojection errors of all feature points. The objective function is: ; in, M Indicates the number of multi-view images. Indicates the first i The number of feature points in an image Indicates the first i The first image j The reprojection error of each feature point is calculated using the Levberg-Marquardt algorithm to solve the objective function and optimize the camera intrinsic parameters (focal length, principal point coordinates, distortion coefficients) to obtain the optimized camera intrinsic parameters. S422. Based on the optimized camera intrinsic parameters and the optimal feature matching pairs, the initial camera extrinsic parameters are optimized. Using Bundle Adjustment, an objective function for extrinsic parameter optimization is constructed to minimize the sum of reprojection errors of all feature points, while also considering pose constraints between multiple views to eliminate accumulated errors in the extrinsic parameters. The objective function for extrinsic parameter optimization is: ; in, Indicates the first i The first image j The pixel coordinates of each feature point Represents the camera imaging projection function. 、 They represent the first i The camera rotation matrix and camera translation vector corresponding to each image. and Together constitute the first i The camera extrinsic parameters corresponding to each image Indicates the first j The spatial coordinates of each feature point K Let represent the camera intrinsic parameter matrix; by solving this objective function, the camera extrinsic parameters are optimized to obtain the optimized camera extrinsic parameters; S423. Substitute the optimized camera intrinsic and extrinsic parameters into the camera imaging model and calculate the reprojection error of all optimal feature matching pairs. If the average reprojection error is less than the preset threshold (the threshold value is 0.5-1 pixel), the optimized camera parameters are considered to be valid, and the optimal camera intrinsic and extrinsic parameters are obtained. Otherwise, repeat steps S421-S422 until the error requirement is met. S424. Store the optimal camera intrinsic and extrinsic parameters in a preset cache for subsequent steps such as sparse point cloud reconstruction and dense point cloud generation.
[0046] S5. Based on the optimal feature matching pair, optimal camera intrinsic parameters, and optimal extrinsic parameters, an improved motion recovery structure algorithm is used to generate a sparse point cloud of the target petrochemical pipeline; the sparse point cloud is optimized to remove redundant points and noise points, resulting in an optimized sparse point cloud. Specifically, a distance-based judgment combined with the DBSCAN clustering algorithm is used to remove redundant points (preferably with a clustering radius of 0.1-0.3 mm and a minimum number of cluster points of 5-10); a statistical filtering algorithm is used to remove noise points (preferably with a filtering radius of 0.5-1 mm and a threshold of 5-10 neighbor points); and point cloud completion is performed based on the pipe's geometric features and multi-view image information, predicting the point cloud coordinates of the cavity area.
[0047] The process of sparse point cloud reconstruction and optimization is as follows: S51. Based on the optimal feature matching pair, optimal camera intrinsic parameters, and optimal extrinsic parameters, an improved Structure for Motion Recovery (SfM) algorithm is used to generate a sparse point cloud of the target petrochemical pipeline, as follows: S511. Select the optimal feature matching pair between the reference image and the image to be matched. Based on the camera imaging model and the optimal camera parameters, use the triangulation algorithm to calculate the spatial point coordinates corresponding to each feature matching pair and generate an initial sparse point cloud. The core of the triangulation algorithm is to back-project the pixel coordinates to the three-dimensional space through the camera extrinsic parameters of the two views to solve for the spatial point coordinates. S512. Add the remaining images to be matched in sequence. Based on the optimal feature matching pair and the optimized camera extrinsic parameters, expand the initial sparse point cloud, calculate the spatial point coordinates corresponding to the newly added feature matching pair, add them to the sparse point cloud, and gradually generate a complete target pipeline sparse point cloud. S513. Perform preliminary screening on the generated initial sparse point cloud to remove point clouds with abnormal spatial coordinates (coordinate values that are too large or too small) and excessive reprojection errors, and obtain a preliminary optimized sparse point cloud. S52. Further optimize the initially optimized sparse point cloud by removing redundant and noisy points to improve its accuracy and completeness. The specific steps are as follows: S521. Calculate the distance between each point in the sparse point cloud and its surrounding points. If the distance between a point and multiple surrounding points is less than a preset threshold (the threshold value is 0.5mm, set according to the reconstruction accuracy requirements), then the point is considered a redundant point and is removed. At the same time, a clustering algorithm is used to perform cluster analysis on the sparse point cloud, remove redundant points in areas with excessive cluster density, and retain representative point clouds. S522. A statistical filtering algorithm is used to denoise the sparse point cloud. The number of neighboring points within a preset radius (1 mm) around each point is calculated. If the number of neighboring points is less than a preset threshold (10), the point is considered a noise point and is removed. For the remaining point cloud, the average distance between each point and its surrounding neighboring points is calculated. If the distance of a point is greater than twice the average distance, the point is considered a noise point and is removed. S523. The denoised sparse point cloud is smoothed by using a Gaussian smoothing algorithm. The average coordinates of the surrounding neighboring points of each point are calculated and the average value is used as the new coordinates of the point to reduce the fluctuation of the point cloud and improve its flatness. At the same time, the key feature points of the pipeline (interfaces, supports, etc.) are preserved to avoid feature loss due to smoothing. S524. Perform completion processing on the smoothed sparse point cloud, analyze the hole regions in the point cloud (holes caused by pipe occlusion, etc.), predict the point cloud coordinates of the hole regions based on the geometric features of the surrounding point cloud and multi-view image information, generate a completed point cloud, and add it to the sparse point cloud to improve the integrity of the sparse point cloud. S525. The Bundle Adjustment algorithm is used to perform global optimization on the optimized sparse point cloud. Combined with the optimal camera parameters, the sum of the reprojection errors of all point clouds is minimized, which further improves the accuracy of the sparse point cloud and obtains the optimized sparse point cloud.
[0048] S6. Based on the optimized sparse point cloud and the preprocessed multi-view image, a dense reconstruction algorithm is used to generate a dense point cloud of the target petrochemical pipeline; the dense point cloud is optimized, including denoising, smoothing, and hole filling, to obtain the optimized dense point cloud. Specifically, by combining spatial distance and grayscale similarity weights, the radius of the bilateral filtering window is improved to 1mm; Poisson smoothing is achieved by constructing a point cloud Poisson surface and resampling; a surface fitting algorithm is used to fill holes in the geometric features of the pipe, and for large-area holes, additional images are collected and depth maps are regenerated.
[0049] The process of generating and optimizing dense point clouds is as follows: S61. Based on the optimized sparse point cloud and the preprocessed multi-view image, the improved PMVS algorithm is used to generate the dense point cloud of the target petrochemical pipeline. The steps are as follows: S611. Guided by the optimized sparse point cloud, the preprocessed multi-view image is divided into multiple image blocks (each image block is 32×32 pixels in size); for each image block, at the corresponding position in other views, a matching image block is searched, the similarity of the image blocks is calculated, and the image block with the highest similarity is selected as the matching image block. S612. Based on the image patch matching results, calculate the depth value corresponding to each image patch and generate a depth map for each image. The depth value is calculated using a triangulation algorithm. Combined with the optimized camera parameters, the pixel coordinates of the image patch are back-projected into three-dimensional space to solve for the depth value. S613. The depth maps of all views are fused using a weighted average method, which combines the similarity of image patches and the reliability of depth values to fuse the depth values of different views to obtain a global depth map. At the same time, regions with abnormal depth values and low reliability are removed to improve the accuracy of the global depth map. S614. Based on the global depth map and optimized camera parameters, the depth map is back-projected into three-dimensional space to generate a dense point cloud of the target petrochemical pipeline. S62. Optimize the generated dense point cloud, including denoising, smoothing, and hole filling, to obtain an optimized dense point cloud; the specific steps are as follows: S621. An improved bilateral filtering algorithm is used to denoise dense point clouds. The bilateral filtering algorithm considers both spatial distance and gray-level similarity, which can remove point cloud noise while preserving the edge features of the pipes. The specific steps are as follows: S6211. Set the filter window radius (the radius value is 1mm). S6212. For each point P in the dense point cloud, extract all its neighboring points within the filtering window. S6213. Calculate the spatial distance weight and gray-level similarity weight between point P and each neighboring point; the spatial distance weight is calculated using a Gaussian function, and the gray-level similarity weight is calculated using an exponential function. S6214. Calculate the weighted average of neighboring points based on spatial distance weight and gray-level similarity weight, and use the weighted average as the new coordinates of point P. S6215. Traverse all points in the dense point cloud and complete the noise reduction process; S622. The denoised dense point cloud is smoothed by using the Poisson smoothing algorithm to construct the Poisson surface of the point cloud, smoothing the surface, and then resampling to generate a smooth dense point cloud. During the smoothing process, the key details of the pipeline are preserved to avoid over-smoothing and loss of details. S623. Perform hole filling processing on the smoothed dense point cloud. Analyze the hole regions in the point cloud (pipe joint gaps, holes caused by occlusion, etc.). Based on the geometric features of the pipe (cylindrical structure) and multi-view image information, use a surface fitting algorithm to fit the surface of the hole region. Then sample to generate a hole-filling point cloud and add it to the dense point cloud to achieve hole filling. For large-area holes, combine the image information of adjacent views, supplement the acquired images, regenerate the depth map, and complete the hole filling. S624. The dense point cloud after hole filling is simplified by using a voxel grid filtering algorithm to divide the point cloud into multiple voxel grids (voxel size is 0.3mm). Each voxel grid retains a representative point (including the point at the center of the voxel) to remove redundant points, reduce the amount of point cloud data, and improve the efficiency of subsequent 3D model construction. At the same time, it ensures that the simplified point cloud can completely retain the geometric features and details of the pipe. S625. Verify the accuracy of the simplified dense point cloud by randomly selecting multiple point clouds and measuring their distance from the corresponding positions of the real pipeline, and calculating the average error. If the average error is less than the preset threshold (the threshold value is 0.3mm), the optimized dense point cloud is considered to be effective. Otherwise, repeat steps S621-S624 until the error requirement is met, and the optimized dense point cloud is obtained.
[0050] S7. Based on the optimized dense point cloud, construct an initial three-dimensional model of the target petrochemical pipeline; perform post-processing on the initial three-dimensional model, including model simplification, texture mapping, and accuracy verification, to obtain the final three-dimensional model of the target petrochemical pipeline. The model is simplified using an edge folding simplification algorithm with a folding error threshold of 0.1mm. The number of triangular facets is adjusted according to actual application requirements (1 million facets in this embodiment). The texture mapping includes texture image preprocessing, texture coordinate allocation, bilinear interpolation mapping, and texture smooth transition optimization.
[0051] The process of 3D model construction and post-processing is as follows: S71. Based on the optimized dense point cloud, the Poisson surface reconstruction algorithm is used to construct the initial three-dimensional model of the target petrochemical pipeline. The steps are as follows: S711. Calculate the normal vector of each point in the optimized dense point cloud. Use the least squares method to fit the plane of the neighboring points of each point. The normal vector of the plane is the normal vector of that point. At the same time, normalize the normal vector to ensure the consistency of the normal vector (pointing to the outside of the pipe). S712. Based on point cloud and normal vector, construct the Poisson equation, solve the Poisson equation to obtain the implicit surface, and fit the surface shape of the pipe; by adjusting the parameters of the Poisson equation, control the smoothness and detail retention of the surface. S713. Sample the fitted implicit surface to generate a three-dimensional mesh model, and obtain the initial three-dimensional model of the target petrochemical pipeline; the initial three-dimensional model is a triangular mesh model, which contains a large number of triangular facets and can completely restore the geometric shape and detailed features of the pipeline. S72. Post-process the initial 3D model, including model simplification, texture mapping, and accuracy verification, to obtain the final target petrochemical pipeline 3D model; the specific steps are as follows: S721. The initial 3D mesh model is simplified to reduce the number of triangles, decrease the model data volume, and improve the rendering and storage efficiency of the model. An edge folding simplification algorithm is used to evaluate each edge in the mesh model and calculate the error after edge folding. If the error after edge folding is less than a preset threshold of 0.1mm, the edge is folded and adjacent triangles are merged. This process is repeated until the number of triangles in the model reaches a preset value (1 million in this embodiment). At the same time, the key details of the pipeline (interfaces, supports, corrosion spots, etc.) are preserved to avoid loss of details due to simplification. S722. Perform texture mapping processing on the simplified mesh model, mapping the texture information of the preprocessed multi-view image onto the surface of the mesh model to improve the realism and detail reproduction of the model. The steps are as follows: S7221. Extract texture from the preprocessed multi-view image to remove noise and occluded areas, resulting in a clean texture image; simultaneously, stitch the texture images together to generate a complete pipe texture image. S7222. Assign texture coordinates to each vertex of the mesh model, and use a parameterized algorithm to map the three-dimensional mesh model to a two-dimensional texture space to obtain the two-dimensional texture coordinates of each vertex. S7223. Match the stitched texture image with the texture coordinates of the mesh model, and use bilinear interpolation algorithm to map the pixel values of the texture image to each triangular facet of the mesh model to complete the texture mapping. S7224. Optimize the mapped texture to remove issues such as texture stretching, blurring, and seams; for texture seams, use a smooth transition algorithm to make the texture stitching natural; for blurred texture areas, use an image enhancement algorithm to enhance texture details. S723. Repair the textured mesh model by checking for defects, cracks, overlapping patches, etc. For defects and cracks, use a patch filling algorithm to fill them. For overlapping patches, remove redundant overlapping patches and retain the correct ones. At the same time, repair the distorted and deformed areas in the model to ensure the integrity and accuracy of the model. S724. Verify the accuracy of the repaired 3D model using the following two combined verification methods: Method 1: Select multiple key verification points (pipeline interface center, support apex, valve center, etc.), measure the coordinates of the verification points in the 3D model and the coordinates of the corresponding verification points on the actual pipeline, and calculate the coordinate error; if the average coordinate error is less than the preset threshold (the threshold value is 0.3mm), the model accuracy is considered to meet the standard. Method 2: Compare the 3D model with the real pipeline, and use a point cloud registration algorithm to register the optimized dense point cloud with the surface point cloud of the 3D model, and calculate the registration error; if the registration error is less than the preset threshold (the threshold value is 0.1mm), the model accuracy is considered to meet the standard. If the accuracy verification fails, return to steps S721-S723 and re-perform post-processing until the accuracy requirements are met. S725, Model Format Conversion: Converts 3D models that meet accuracy standards into the preset OBJ format, while generating model thumbnails and attribute information (model size, reconstruction time, accuracy parameters, etc.) to facilitate model management and use. S726. Final Model Output: Output the final 3D model of the target petrochemical pipeline for subsequent digital management, fault detection, maintenance and repair work.
[0052] S8. Store the multi-view image set, preprocessed image data, feature data, optimal camera parameters, optimized sparse point cloud, optimized dense point cloud, and final 3D model data into a preset storage medium to complete the entire 3D reconstruction process.
[0053] This invention also provides a storage medium for storing reconstruction data of the petrochemical pipeline 3D reconstruction method based on multi-view optimization as described above. The storage medium adopts a hierarchical storage structure, dividing the reconstruction data into six categories: raw data, preprocessed data, feature data, camera parameter data, point cloud data, and 3D model data. It employs efficient compression algorithms and encryption mechanisms, supports multi-device adaptation, and has data backup and scalability functions. The raw data includes a multi-view image set, acquisition device parameters, acquisition position, and attitude information. The 3D model data includes an initial 3D model, an optimized 3D model, and model attribute information.
[0054] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.
[0055] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for 3D reconstruction of petrochemical pipelines based on multi-view optimization, characterized in that, Includes the following steps: S1. Using image acquisition equipment, multiple images of the target petrochemical pipeline are acquired from different angles and distances to construct a multi-view image set. S2. Preprocess each image in the multi-view image set to remove image noise, enhance image features, and unify image specifications to obtain a preprocessed multi-view image set. S3. Extract features from each image in the preprocessed multi-view image set to obtain the feature point set and feature descriptor for each image; perform preliminary matching of feature points in different view images based on multi-view geometric constraints and feature similarity to obtain initial feature matching pairs; optimize the initial feature matching pairs by removing mismatched pairs and supplementing missing matching pairs to obtain the optimal feature matching pairs. S4. Based on the optimal feature matching pair and the preset calibration template, perform parameter calibration on the camera that acquires multi-view images to obtain the initial intrinsic and extrinsic parameters of the camera; optimize the initial intrinsic and extrinsic parameters of the camera to eliminate lens distortion and cumulative error, and obtain the optimal intrinsic and extrinsic parameters of the camera. S5. Based on the optimal feature matching pair, optimal camera intrinsic parameters, and optimal extrinsic parameters, an improved motion recovery structure algorithm is used to generate a sparse point cloud of the target petrochemical pipeline; the sparse point cloud is optimized to remove redundant points and noise points, resulting in an optimized sparse point cloud. S6. Based on the optimized sparse point cloud and the preprocessed multi-view image, a dense reconstruction algorithm is used to generate a dense point cloud of the target petrochemical pipeline; the dense point cloud is optimized, including denoising, smoothing, and hole filling, to obtain the optimized dense point cloud. S7. Based on the optimized dense point cloud, construct an initial three-dimensional model of the target petrochemical pipeline; perform post-processing on the initial three-dimensional model, including model simplification, texture mapping, and accuracy verification, to obtain the final three-dimensional model of the target petrochemical pipeline. S8. Store the multi-view image set, preprocessed image data, feature data, optimal camera parameters, optimized sparse point cloud, optimized dense point cloud, and final 3D model data into a preset storage medium to complete the entire 3D reconstruction process.
2. The method of claim 1, wherein, The method for feature extraction of each image in the preprocessed multi-view image set in step S3 includes: constructing a Gaussian difference pyramid and performing multi-scale extreme value detection to obtain initial feature points; after filtering feature points with low contrast and weak edge response, using Taylor expansion for sub-pixel-level localization; calculating the gradient direction and magnitude of the neighborhood of the feature points, and assigning the main direction and auxiliary direction; generating SIFT feature descriptors, and optimizing them with Haar wavelet features to obtain the final feature descriptors.
3. The method of claim 2, wherein, The method for optimizing the initial feature matching pair in step S3 includes: the initial feature matching adopts the nearest neighbor matching method combined with the second nearest neighbor matching method. For each feature point of the image to be matched, the feature point with the highest feature similarity in the reference image is selected as the nearest neighbor feature point, and the feature point with the second highest similarity is selected as the second nearest neighbor feature point. If the similarity ratio between the nearest neighbor feature point and the second nearest neighbor feature point is less than a preset threshold, the matching pair is considered to be a valid matching pair; otherwise, it is an invalid matching pair.
4. The method of claim 1, wherein, The initial intrinsic parameters of the camera in step S4 include the focal length ( fx , fy ), principal point coordinates ( cx , cy Radial distortion coefficient ( 、 、 ) and tangential distortion coefficient ( 、 ); The objective function for intrinsic parameter optimization is: ; in, M Indicates the number of multi-view images. Indicates the first i The number of feature points in an image Indicates the first i The first image j Reprojection error of each feature point; The objective function for extrinsic parameter optimization is: ; in, In the i-th image, the i-th... j The pixel coordinates of each feature point Represents the camera imaging projection function. 、 They represent the first i The camera rotation matrix and camera translation vector corresponding to each image. and Together constitute the first i The camera extrinsic parameters corresponding to each image Indicates the first j The spatial coordinates of each feature point K This represents the camera intrinsic parameter matrix.
5. The method of claim 1, wherein, The method for preprocessing each image in the multi-view image set in step S2 includes: The image is converted to grayscale using a weighted average method. The formula for calculating the grayscale value is as follows: Gray = 0.299*R + 0.587*G + 0.114*B; Where Gray represents the grayscale value of a grayscale image, and R, G, and B represent the pixel values of the red, green, and blue channels of a color image, respectively. The filtering window size is adaptively adjusted based on the image noise intensity. An adaptive histogram equalization algorithm combined with an edge enhancement algorithm is used to enhance the denoised image. The equalized image is then fused with the edge image using the following formula: Enhanced = α*CLAHE(Gray) + β*Edge; Where Enhanced represents the enhanced image pixel value, CLAHE(Gray) represents the equalized image pixel value, Edge represents the edge image pixel value, α and β are fusion coefficients, α takes the value of 0.7-0.9, β takes the value of 0.1-0.3, and α+β=1.
6. The method of claim 1, wherein, The method for removing redundant and noise points in step S5 includes: Redundant points are removed by combining distance judgment with DBSCAN clustering algorithm; noise points are removed by statistical filtering algorithm; and point cloud coordinates of cavity areas are predicted based on pipeline geometric features and multi-view image information to complete the point cloud.
7. The method of claim 1, wherein, The method for optimizing the dense point cloud in step S6 includes: improving the radius of the bilateral filtering window by combining spatial distance and gray-level similarity weights; achieving Poisson smoothing by constructing a Poisson surface of the point cloud and resampling; using a surface fitting algorithm to fill holes in the geometric features of the pipe, and supplementing the acquired images and regenerating the depth map for large-area holes.
8. The method of claim 1, wherein, The method for post-processing the initial 3D model in step S7 includes: The model is simplified using an edge-folding simplification algorithm, and the number of triangular faces is adjusted according to actual application requirements. The texture mapping includes texture image preprocessing, texture coordinate allocation, bilinear interpolation mapping, and texture smooth transition optimization.
9. The method of claim 1, wherein, The method for acquiring multiple pipe images and constructing a multi-view image set in step S1 includes: The system presets the acquisition path and acquisition interval, and acquires multiple images from multiple perspectives and distances of the petrochemical pipeline. After screening, it constructs a multi-view image set that meets the clarity requirements.
10. A storage medium for storing reconstruction data of the petrochemical pipeline three-dimensional reconstruction method based on multi-view optimization as described in any one of claims 1-9, characterized in that, The storage medium adopts a hierarchical storage structure, dividing the reconstructed data into six categories: raw data, preprocessed data, feature data, camera parameter data, point cloud data, and 3D model data. It employs efficient compression algorithms and encryption mechanisms, supports multi-device adaptation, and has data backup and scalability functions. The raw data includes multi-view image sets, acquisition device parameters, acquisition location, and attitude information. The 3D model data includes the initial 3D model, the optimized 3D model, and model attribute information.
Citation Information
Patent Citations
Pipeline three-dimensional reconstruction method and device based on multi-view optimization and storage medium
CN115082617A
Multi-view three-dimensional reconstruction method combining feature enhancement and weight optimization
CN121414988A
