# Algorithm of 3D Virtual Reconstruction of Ancient Buildings in Qing Dynasty Based on Image Sequence

Authors: Chuan Lu
Journal: Security and Communication Networks
 (2021)

---

## Abstract

Aiming at the problem of low accuracy and poor integrity of traditional Qing Dynasty ancient architecture 3D virtual reconstruction algorithm, a 3D virtual reconstruction algorithm of Qing Dynasty ancient architecture based on image sequence is proposed. Acquire the sequence images of ancient buildings in the Qing Dynasty through the pinhole camera model, analyze the projective space and reconstruction space of the sequence images, redefine the similarity measurement coefficient according to the improved 2DPCA-SIFT feature matching algorithm, match the feature points of the ancient architecture images in the Qing Dynasty, and use random sampling to be consistent. The algorithm solves the basic matrix, removes the interference error in the image reconstruction process, and realizes the design of the three-dimensional reconstruction algorithm through image sequence fusion. The experimental results show that, compared with the existing methods, the completeness of the three-dimensional virtual reconstruction 3D model of ancient Qing Dynasty buildings constructed by the designed algorithm is 87.26% on average, and the completeness and accuracy of the 3D model construction of the subparts of the ancient Qing Dynasty buildings of this method are better. The height of the building fully shows that the designed building has good performance in the construction of the three-dimensional model of ancient buildings in the Qing Dynasty.


---

## Body

## 1. Introduction

With the development of the economy and the gradual improvement of people’s living standards, people are paying more and more attention to the protection of historical sites. After a long period of weathering, corrosion, and man-made destruction, the historic sites will be damaged. How to reconstruct these damaged monuments and ensure the similarity between the reconstructed monuments and the original monuments has become a core issue that needs to be studied in the field of ancient building restoration. At present, the virtual simulation reconstruction of ancient buildings is mainly achieved through two methods. One is to scan and measure physical buildings, convert them into digital information, and build a basic model, then continue to render the basic model, and finally get the restoration results. The ancient buildings are preserved in digital form; the second is to directly construct and process the model based on historical data to obtain the restoration results and compare the restoration results with the ancient buildings in order to guide the restoration work of the ancient buildings.There are three main ways to construct 3D models in the current generation. One is to use 3D modelling software to construct 3D models, such as CAD, 3ds Max, SketchUp, etc., and use some basic geometric elements (e.g., cubes, cylinders, etc.) through a series of geometric operations. Construct a three-dimensional model [1]. This method generally uses the two-dimensional GIS data generated by the ground total station survey or aerial photogrammetry method, the paper map, and the two-dimensional plane data provided by CAD and other height auxiliary data to carry out geometric interactive modelling to reconstruct the ancient building model. This modelling method has low cost, mature development, and wide application. However, due to a large number of ancient buildings in the city and different shapes and structures, it is very time-consuming to reconstruct ancient buildings through interactive methods and requires high professional skills for operators. Another way is to obtain three-dimensional data through equipment. Digital photogrammetry technology obtains three-dimensional geometric information and surface texture information of urban ancient buildings from large-scale aerial images and high-resolution satellite remote sensing images or uses three-dimensional laser scanners to directly obtain three-dimensional space coordinates and colors of sampling points on the surface of the ground object information. This method has a large number of research results, but due to the high cost of data acquisition and the use conditions, it is easy to be restricted by the application environment and the nature of the object being measured. It is mainly used for professional urban surveys and engineering with high investment intensity. Design and more and more city management and social services require simpler, flexible, efficient, and low-cost 3D city modelling technology. Another method is an image-based modelling method, using ordinary digital cameras as image acquisition equipment to directly reconstruct a “photo-level” highly realistic model from the image, due to its low cost, high efficiency, and low labour intensity. It has become a powerful tool for geometric information analysis and extraction and model making that attracts increasing attention and adoption in many fields, especially ground close-up images, which can reflect the geometric details of the ancient building surface and have realistic texture information. It is the current photogrammetry that research hotspots in the field of computer vision [2]. The collection of photos is the most important step in the entire 3D reconstruction process. However, in the image-based modelling method, an ordinary digital camera is used for image collection, which has more requirements for the resolution, clarity, overlap, and shooting light of the captured images.With the development of people’s research and protection of ancient architecture, the three-dimensional point cloud model of ancient architecture is becoming more and more important, how to restore the three-dimensional coordinates of ancient buildings easily, quickly, and low-costly, and how to construct the cloud model is a hot and difficult research point in academic circles. Previous people have done a lot of research in the field of 3D point cloud generation in ancient buildings: literature [3] directly uses steel rulers to measure wood components, combined with high-resolution photographs, using computer-aided design (CAD) and geographic information system (GIS) software to achieve 3D reconstruction of the antique architectural landscape. The three-dimensional fine modelling of Song Tower of the Haiji Temple was completed by ground lidar and unmanned aerial survey data [4], and the three-dimensional reconstruction of the golden roof of the 13th Dalai Lama Temple in Potala Palace was completed using nearsighted photogrammetry technology and scale measurement, using 3ds Max software [5]. Although the three-dimensional point cloud accuracy of the ancient building obtained by the above method is high, the data acquisition process is complex, the workload is large, and the cost is high, which cannot meet the simple, fast, and low-cost realization of the three-dimensional point cloud generation of the ancient building.At present, scholars in related fields have researched the three-dimensional virtual reconstruction algorithm of ancient buildings. Literature [6] proposed the ancient building reconstruction based on three-dimensional laser scanning and drone tilt photography technology, combined with three-dimensional laser scanning and tilt photogrammetry technology. The feature point matching algorithm is used to realize the accurate fusion of multisource data so as to realize the construction of a complete three-dimensional model of ancient buildings indoors and outdoors. Literature [7] proposes a research plan that combines three-dimensional laser scanning technology and UAV aerial survey technology to reconstruct ancient buildings. Based on the internal and external point cloud data and image data of ancient buildings obtained by 3D laser scanners and drones, the point cloud data is used to generate orthophotos and draw flat, vertical, and cross-sectional views, creating 3D models, and finally take the buildings on the spot. Dimensional data is a reference analysis to get the drawings and model errors. The reconstruction method of damaged monuments is a hot issue that needs to be studied in the field of ancient building restoration. Traditional algorithms are used to reconstruct damaged monuments. If the damaged parts are large or worn, there will be fewer restorable features. In the traditional visual restoration method, when the restoration features are severely worn or damaged, it is difficult to ensure the continuity of the restoration features, which leads to unsatisfactory reconstruction effects, thereby reducing the authenticity of the reconstruction of damaged monuments. Modelling with this type of method is significantly more efficient than traditional methods. However, the combination of 3D laser scanning and drone tilt photography still has some problems to be solved, such as improved model effect and precision in the improved model, but there are some problems of texture distortion in individual locations.Aiming at the problems of the above methods, this paper proposes a three-dimensional virtual reconstruction algorithm of ancient buildings in the Qing Dynasty based on image sequences. Traditional SIFT algorithms need to locate both local extremum points in scale space and local extremum points in two-dimensional plane space to determine the location of local extremum points and use the selected local extremum points as key points. Calculates the position information of the key, calculates the gradient direction of all points adjacent to the key, determines the main direction of the key, and completes the invariance of the operator geometry transformation and rotation. Traditional SIFT algorithms use Euclidean distance to determine similarity measurements between key measuring points. In addition, PCA theory must break down the sparse matrix, but the decomposition process will make the image vector size too high, and the calculation process is too complex; after the reduction of dimension damage to the original image, the spatial topology cannot be Fan Ying image set nonlinear structure. The improved 2DPCA-SIFT algorithm overcomes these well. Moreover, it redefines the similarity measurement coefficient value with the support of the BRISK descriptor index, thus rematching the image features of ancient Qing dynasties.


## 2. Projective Space and Reconstruction Space of the Architectural Image

### 2.1. How to Obtain Sequence Images

The use of sequence images to restore the three-dimensional model of ancient buildings in the Qing Dynasty is based on the use of cameras or video cameras to shoot the same object from different angles. Currently, the most widely used model is the pinhole camera model, and projective geometry is the mathematical basis for constructing projective space. The use of sequence images to restore the three-dimensional model of ancient buildings in the Qing Dynasty is based on the use of cameras or video cameras to shoot the same object from different angles. Currently, the most widely used model is the pinhole camera model, and projective geometry is the mathematical basis for constructing projective space [8].The acquisition of serial images only needs a digital camera to shoot the same object from different angles, and what is produced is a set of serial images of the same object. In the shooting process, in order to preserve most of the features of the object, the same object is rotated at a smaller angle each time it is shot. The sequence of images generated in this way can be based on the transformation relationship between the points in the image, and the three-dimensional information of the points can be obtained through the conversion between the coordinate systems.


### 2.2. Projective Space

For the homogeneity of three-dimensional points in the projective space, a simple matrix expression can be used to express the imaging model, and the geometric parameters of the camera can also be obtained by matrix expressions. Projective geometry mainly includes vector space, projective space, projective transformation, projection, affine space, Euclidean space, and Euclidean transformation. The easiest space to understand can be considered as Euclidean space. At present, the technologies used in the field of 3D reconstruction are all based on Euclidean space [9]. But at the same time, Euclidean space has many restrictions, which limit the hierarchical expression of the structure in the space, which makes it impossible to operate the internal space well in the experiment [10]. The space structure in the phase reflection space, in general, and its restrictive conditions are the least, so this space can be used in subsequent experiments [11].LetRn be the array space of the real number domain. For any two vectors a=a1,…,an and b=b1,…,bn in Rn, define their inner products as follows:(1)a,b=a1b1+…+anbn.The real vector space that defines the inner product is called Euclidean space.The nonsingular linear transformation from Euclidean spaceEn to itself is called Euclidean transformation. Each Euclidean transformation will produce a subgroup of the affine transformation. An Euclidean transformation TE can be expressed by the following formula:(2)TE∼R101.Among them,R is an orthogonal matrix.


### 2.3. Reconstruction Space

At present, the most commonly used methods for constructing the world coordinate system are based on the theory of Euclidean geometry. However, the affine coordinate system and the projective coordinate system to construct the world coordinate system can simplify the problem. Therefore, the construction of a three-dimensional space can be achieved in three steps: the first step is to obtain the projective reconstruction based on the information of the corresponding points between the images, and thus the projection matrix of the camera under the constraints of the projective theory can be obtained; the second step is based on the projective reconstruction. The corresponding projective space can be upgraded to affine reconstruction by determining the information of the infinity plane; the third step is based on the affine reconstruction information obtained in the second step and some restrictions, so formula (3) is the equation of the cone image, and then the parameters in the camera are obtained to complete the Euclidean reconstruction. However, there is another situation. Based on the known information of the projective reconstruction in advance, the projective reconstruction can be directly upgraded to Euclidean reconstruction according to the actual constraints.(1)
Projective Reconstruction. Determine in advance a pair of corresponding points xi⟷xi' of the two images to obtain a unique matrix F that conforms to(3)xi'Fxi=0.The projective reconstruction can be obtained according to the basic matrix. The above formula can prove that when a pair of corresponding points between the images are known, a projective reconstruction can be obtained, but some information (calibration information of the camera) is not needed. However, when the projective reconstruction is obtained by this method, only the information of the projective reconstruction can be obtained, and there is a projective transformation between the actual metric reconstruction and the projective reconstruction [12].(2)
Affine Reconstruction. Finding the position information of the infinity plane is actually taking corresponding measures to determine the affine reconstruction, and the infinity plane is related to the background, position, and calibration information. Generally, let π∞=0,0,0,1T be the infinity plane at a certain position. However, the invariance of the infinity plane cannot be restricted by projective transformation. Therefore, in space, the position of the infinity plane is arbitrary [13].Therefore, the first step should be to determine the spatial position of the infinity plane so that the projective space can be upgraded to the affine space. If the location information of the target object is determined in advance, the above process is not difficult to do. But if you can find a 4-dimensional vector and use it to represent a plane under the projective space whereπ is located, you can use it to find the projective transformation from π to 0,0,0,1T. Due to the different manifestations of the projective transformation in the plane where it is located, the corresponding transformation matrix H must be calculated, which conforms to H−T=0,0,0,1T. The transformation process is shown as follows:(4)H=I|0πT.The above process is to determine the infinity plane position information. By using the transformation matrixH, the point information and the calibration information of the camera can be used to upgrade the projective reconstruction to the affine reconstruction.(3)
Measurement Reconstruction. The essence of measurement reconstruction is to identify the absolute conic. Because the absolute quadratic curve is a planar quadratic curve on the infinity plane, as long as the relevant information is found, the position information of the infinity plane can be determined. According to the theory of hierarchical reconstruction, the first is to calculate the projective reconstruction, upgrade it to affine reconstruction, and then use the result of affine reconstruction to upgrade to metric reconstruction [14]. As the result of calculating the affine reconstruction already includes the relevant information of the infinity plane, the absolute conic can be obtained directly. If the absolute conic has been found, the next step is to calculate the projective transformation in the Euclidean coordinate system to complete the metric reconstruction.


## 2.1. How to Obtain Sequence Images

The use of sequence images to restore the three-dimensional model of ancient buildings in the Qing Dynasty is based on the use of cameras or video cameras to shoot the same object from different angles. Currently, the most widely used model is the pinhole camera model, and projective geometry is the mathematical basis for constructing projective space. The use of sequence images to restore the three-dimensional model of ancient buildings in the Qing Dynasty is based on the use of cameras or video cameras to shoot the same object from different angles. Currently, the most widely used model is the pinhole camera model, and projective geometry is the mathematical basis for constructing projective space [8].The acquisition of serial images only needs a digital camera to shoot the same object from different angles, and what is produced is a set of serial images of the same object. In the shooting process, in order to preserve most of the features of the object, the same object is rotated at a smaller angle each time it is shot. The sequence of images generated in this way can be based on the transformation relationship between the points in the image, and the three-dimensional information of the points can be obtained through the conversion between the coordinate systems.


## 2.2. Projective Space

For the homogeneity of three-dimensional points in the projective space, a simple matrix expression can be used to express the imaging model, and the geometric parameters of the camera can also be obtained by matrix expressions. Projective geometry mainly includes vector space, projective space, projective transformation, projection, affine space, Euclidean space, and Euclidean transformation. The easiest space to understand can be considered as Euclidean space. At present, the technologies used in the field of 3D reconstruction are all based on Euclidean space [9]. But at the same time, Euclidean space has many restrictions, which limit the hierarchical expression of the structure in the space, which makes it impossible to operate the internal space well in the experiment [10]. The space structure in the phase reflection space, in general, and its restrictive conditions are the least, so this space can be used in subsequent experiments [11].LetRn be the array space of the real number domain. For any two vectors a=a1,…,an and b=b1,…,bn in Rn, define their inner products as follows:(1)a,b=a1b1+…+anbn.The real vector space that defines the inner product is called Euclidean space.The nonsingular linear transformation from Euclidean spaceEn to itself is called Euclidean transformation. Each Euclidean transformation will produce a subgroup of the affine transformation. An Euclidean transformation TE can be expressed by the following formula:(2)TE∼R101.Among them,R is an orthogonal matrix.


## 2.3. Reconstruction Space

At present, the most commonly used methods for constructing the world coordinate system are based on the theory of Euclidean geometry. However, the affine coordinate system and the projective coordinate system to construct the world coordinate system can simplify the problem. Therefore, the construction of a three-dimensional space can be achieved in three steps: the first step is to obtain the projective reconstruction based on the information of the corresponding points between the images, and thus the projection matrix of the camera under the constraints of the projective theory can be obtained; the second step is based on the projective reconstruction. The corresponding projective space can be upgraded to affine reconstruction by determining the information of the infinity plane; the third step is based on the affine reconstruction information obtained in the second step and some restrictions, so formula (3) is the equation of the cone image, and then the parameters in the camera are obtained to complete the Euclidean reconstruction. However, there is another situation. Based on the known information of the projective reconstruction in advance, the projective reconstruction can be directly upgraded to Euclidean reconstruction according to the actual constraints.(1)
Projective Reconstruction. Determine in advance a pair of corresponding points xi⟷xi' of the two images to obtain a unique matrix F that conforms to(3)xi'Fxi=0.The projective reconstruction can be obtained according to the basic matrix. The above formula can prove that when a pair of corresponding points between the images are known, a projective reconstruction can be obtained, but some information (calibration information of the camera) is not needed. However, when the projective reconstruction is obtained by this method, only the information of the projective reconstruction can be obtained, and there is a projective transformation between the actual metric reconstruction and the projective reconstruction [12].(2)
Affine Reconstruction. Finding the position information of the infinity plane is actually taking corresponding measures to determine the affine reconstruction, and the infinity plane is related to the background, position, and calibration information. Generally, let π∞=0,0,0,1T be the infinity plane at a certain position. However, the invariance of the infinity plane cannot be restricted by projective transformation. Therefore, in space, the position of the infinity plane is arbitrary [13].Therefore, the first step should be to determine the spatial position of the infinity plane so that the projective space can be upgraded to the affine space. If the location information of the target object is determined in advance, the above process is not difficult to do. But if you can find a 4-dimensional vector and use it to represent a plane under the projective space whereπ is located, you can use it to find the projective transformation from π to 0,0,0,1T. Due to the different manifestations of the projective transformation in the plane where it is located, the corresponding transformation matrix H must be calculated, which conforms to H−T=0,0,0,1T. The transformation process is shown as follows:(4)H=I|0πT.The above process is to determine the infinity plane position information. By using the transformation matrixH, the point information and the calibration information of the camera can be used to upgrade the projective reconstruction to the affine reconstruction.(3)
Measurement Reconstruction. The essence of measurement reconstruction is to identify the absolute conic. Because the absolute quadratic curve is a planar quadratic curve on the infinity plane, as long as the relevant information is found, the position information of the infinity plane can be determined. According to the theory of hierarchical reconstruction, the first is to calculate the projective reconstruction, upgrade it to affine reconstruction, and then use the result of affine reconstruction to upgrade to metric reconstruction [14]. As the result of calculating the affine reconstruction already includes the relevant information of the infinity plane, the absolute conic can be obtained directly. If the absolute conic has been found, the next step is to calculate the projective transformation in the Euclidean coordinate system to complete the metric reconstruction.


## 3. Sequence Image Matching Reconstruction Based on Improved 2DPCA-SIFT Feature Matching Algorithm

### 3.1. Improved 2DPCA-SIFT Feature Matching Algorithm

In the process of 3D reconstruction, it is necessary to acquire a large number of points in the image, but not all of these points can be helpful to the reconstruction during reconstruction. Only the points that are significantly different from the surroundings are the points that are needed. These points are called feature points. If the two-dimensional coordinates of these feature points can be obtained in the two images, respectively, then three-dimensional reconstruction can be carried out. The traditional SIFT algorithm needs to locate the local extreme points in the scale space and the two-dimensional plane space at the same time to determine the location of the local extreme points and use the selected local extreme points as the key points. The position information of the key point is calculated, and the gradient direction of all points in the neighborhood of the key point is calculated to determine the main direction of the key point, and then the invariance of the geometric transformation and rotation of the operator can be completed [15].The PCA algorithm can solve the problem of correlation between images and achieve data compression [16]. However, the PCA theory has several key technologies that need to be improved. First, a nonsparse matrix must be decomposed. The decomposition process will make the image vector dimension too high, make the calculation process too complicated, and damage the original image after dimensionality reduction. The spatial topological structure cannot yet reflect the nonlinear structure contained in the image set, so the improved 2DPCA-SIFT algorithm can solve the above problems well.BRISK descriptor calculation is a necessary processing link for the improvement of SIFT algorithm. The BRISK descriptor keeps good rotation invariance and scale invariance at all times. When specific information instructions are executed, due to the existence of descriptor indicators, the improvement of SIFT algorithm has strong controllability.In the actual calculation process, the BRISK descriptor can only be obtained by neighborhood sampling; that is to say, in the pixel block centred on the feature point, the specific position of the BRISK descriptor is determined by concentric circles, and all samples are required. The points must be equally spaced on the circumference [17]. In addition, in order to completely eliminate the transmission differences between the image data of ancient buildings in the Qing Dynasty, all sampling points should be filtered separately. The specific BRISK description subsampling mode is shown in Figure 1.Figure 1
BRISK description subsampling model based on improved SIFT algorithm.LetΩ represent the sampling point pair set; pi, pj, respectively, represent two different SIFT improvement basis vectors; and i, j represent two different images’ data information. Combining the above physical quantities, the BRISK descriptor calculation expression can be defined as(5)gΩ=1/N∑i=1δmax⋅pi∑j=1δminpj2.Among them,N represents the number of information elements in the sampling point pair set Ω, δmax represents the maximum distance threshold, and δmin represents the minimum distance threshold.The traditional SIFT algorithm uses the Euclidean distance to determine the degree of similarity measurement between key surveying points, while the improved SIFT algorithm redefines the similarity measurement coefficient value with the support of the BRISK descriptor index, thereby making the image characteristics of ancient buildings in the Qing Dynasty. The points get rematched. The specific definition of mapping feature point matching is as follows:(6)D=∑a⟶b+∞gΩfb−a2λΔT.Among them,a, b are the corresponding feature point descriptors of ancient architecture images in the Qing Dynasty, f represents the SIFT algorithm improvement trend value, λ represents the centralized action authority value of the BRISK descriptor, and ΔT represents the unit matching time of the feature points.


### 3.2. Reconstruction of Sequence Image Matching to Remove Error Interference

In actual situations, the reconstruction of serial images will be interfered with by many factors, such as environmental factors and factors that obscure ancient buildings. These interference factors will have some influence on the final reconstruction results. In order to achieve a more perfect reconstruction model of the ancient building target object and improve the accuracy and stability of the matching, the experiment in this chapter uses the 8-point method to calculate the basic matrix of the ancient building as the initial value. The random sampling consensus algorithm (RANSAC iterative algorithm) is used to solve the basic matrix until the final basic matrix is stable. The process is shown in Figure2.Figure 2
Flow chart of error interference removal algorithm.The specific operation process is as follows:The first step is to extract 8 sets of corresponding points uniformly and randomly from the obtained feature point pairs. The second step uses these 8 sets of corresponding points to find the minimum value of the basic matrix. Evaluate the basic matrix. If the distance is small enough, the corresponding points correspond to each other. The last step is to rebuild and fit all the points according to the results obtained in the above steps to solve a new basic matrix. If not, then go back to the first step and continue to solve until the fundamental matrix is ​​stable.The random sampling consensus algorithm is an algorithm based on fitting data, which has strong stability. The first step of the random sampling consensus algorithm is to determine an objective function corresponding to the actual situation according to the problem to be solved. The second step is to iterate continuously to initialize the value of the parameters in the actual problem. The third step is to initialize in the second step. Based on this, the initial values ​​obtained are classified into “inner points” that meet the model parameters and “outer points” that do not meet the model parameters. The last step is to use the obtained “inner points” and “outer points” pairs in turn. The model is reevaluated, and finally, accurate matching points are obtained to eliminate mismatched points.After obtaining a large amount of three-dimensional point information of the target object, the relevant theories of image processing must be used to further process these points of the basic matrix, and a more realistic target object model can be obtained. At present, the gridding and rendering technology using three basic matrix dimensional points is the most widely used method in the field of 3D reconstruction. In the final process of the three-dimensional reconstruction of the basic matrix, the information of these points needs to be constructed into a surface, and the triangle theory is called the basic matrix is ​​the simplest surface element. The method chosen for the experiment in this chapter is the simplest and most mature triangulation method. The final result of the basic matrix 3D reconstruction is to obtain a realistic 3D model of the reconstructed object, but texture mapping is the best way to reflect the realism of the 3D model. Therefore, after obtaining a large number of useful three-dimensional points of the target object and the basic matrix, texture can be added to the surface of these target objects.The more widely used method is forward texture mapping. Forward texture mapping can be summarized as mapping the texture space to the screen space, which means that the points corresponding to the two-dimensional image are mapped to the three-dimensional points in the three-dimensional space. It is called texture scanning. Forward texture mapping is the conversion process between the two-dimensional function of the image and the three-dimensional space function, and finally, it can be reflected in the image space by using the projection method.First, assume thatV represents texture coordinates, x,y is screen coordinates, and F is a forward mapping function; that is, forward texture mapping can be expressed by(7)F:R2⟶R2,u,v⟶x,y=ku,v,lu,v.According to the above, the forward texture mapping scans the lines in the space. After each scan line in the texture space, after mutual projection in the dimensional space, it can make full use of the texture pixels stored in the memory to speed up the graphics generation speed.


## 3.1. Improved 2DPCA-SIFT Feature Matching Algorithm

In the process of 3D reconstruction, it is necessary to acquire a large number of points in the image, but not all of these points can be helpful to the reconstruction during reconstruction. Only the points that are significantly different from the surroundings are the points that are needed. These points are called feature points. If the two-dimensional coordinates of these feature points can be obtained in the two images, respectively, then three-dimensional reconstruction can be carried out. The traditional SIFT algorithm needs to locate the local extreme points in the scale space and the two-dimensional plane space at the same time to determine the location of the local extreme points and use the selected local extreme points as the key points. The position information of the key point is calculated, and the gradient direction of all points in the neighborhood of the key point is calculated to determine the main direction of the key point, and then the invariance of the geometric transformation and rotation of the operator can be completed [15].The PCA algorithm can solve the problem of correlation between images and achieve data compression [16]. However, the PCA theory has several key technologies that need to be improved. First, a nonsparse matrix must be decomposed. The decomposition process will make the image vector dimension too high, make the calculation process too complicated, and damage the original image after dimensionality reduction. The spatial topological structure cannot yet reflect the nonlinear structure contained in the image set, so the improved 2DPCA-SIFT algorithm can solve the above problems well.BRISK descriptor calculation is a necessary processing link for the improvement of SIFT algorithm. The BRISK descriptor keeps good rotation invariance and scale invariance at all times. When specific information instructions are executed, due to the existence of descriptor indicators, the improvement of SIFT algorithm has strong controllability.In the actual calculation process, the BRISK descriptor can only be obtained by neighborhood sampling; that is to say, in the pixel block centred on the feature point, the specific position of the BRISK descriptor is determined by concentric circles, and all samples are required. The points must be equally spaced on the circumference [17]. In addition, in order to completely eliminate the transmission differences between the image data of ancient buildings in the Qing Dynasty, all sampling points should be filtered separately. The specific BRISK description subsampling mode is shown in Figure 1.Figure 1
BRISK description subsampling model based on improved SIFT algorithm.LetΩ represent the sampling point pair set; pi, pj, respectively, represent two different SIFT improvement basis vectors; and i, j represent two different images’ data information. Combining the above physical quantities, the BRISK descriptor calculation expression can be defined as(5)gΩ=1/N∑i=1δmax⋅pi∑j=1δminpj2.Among them,N represents the number of information elements in the sampling point pair set Ω, δmax represents the maximum distance threshold, and δmin represents the minimum distance threshold.The traditional SIFT algorithm uses the Euclidean distance to determine the degree of similarity measurement between key surveying points, while the improved SIFT algorithm redefines the similarity measurement coefficient value with the support of the BRISK descriptor index, thereby making the image characteristics of ancient buildings in the Qing Dynasty. The points get rematched. The specific definition of mapping feature point matching is as follows:(6)D=∑a⟶b+∞gΩfb−a2λΔT.Among them,a, b are the corresponding feature point descriptors of ancient architecture images in the Qing Dynasty, f represents the SIFT algorithm improvement trend value, λ represents the centralized action authority value of the BRISK descriptor, and ΔT represents the unit matching time of the feature points.


## 3.2. Reconstruction of Sequence Image Matching to Remove Error Interference

In actual situations, the reconstruction of serial images will be interfered with by many factors, such as environmental factors and factors that obscure ancient buildings. These interference factors will have some influence on the final reconstruction results. In order to achieve a more perfect reconstruction model of the ancient building target object and improve the accuracy and stability of the matching, the experiment in this chapter uses the 8-point method to calculate the basic matrix of the ancient building as the initial value. The random sampling consensus algorithm (RANSAC iterative algorithm) is used to solve the basic matrix until the final basic matrix is stable. The process is shown in Figure2.Figure 2
Flow chart of error interference removal algorithm.The specific operation process is as follows:The first step is to extract 8 sets of corresponding points uniformly and randomly from the obtained feature point pairs. The second step uses these 8 sets of corresponding points to find the minimum value of the basic matrix. Evaluate the basic matrix. If the distance is small enough, the corresponding points correspond to each other. The last step is to rebuild and fit all the points according to the results obtained in the above steps to solve a new basic matrix. If not, then go back to the first step and continue to solve until the fundamental matrix is ​​stable.The random sampling consensus algorithm is an algorithm based on fitting data, which has strong stability. The first step of the random sampling consensus algorithm is to determine an objective function corresponding to the actual situation according to the problem to be solved. The second step is to iterate continuously to initialize the value of the parameters in the actual problem. The third step is to initialize in the second step. Based on this, the initial values ​​obtained are classified into “inner points” that meet the model parameters and “outer points” that do not meet the model parameters. The last step is to use the obtained “inner points” and “outer points” pairs in turn. The model is reevaluated, and finally, accurate matching points are obtained to eliminate mismatched points.After obtaining a large amount of three-dimensional point information of the target object, the relevant theories of image processing must be used to further process these points of the basic matrix, and a more realistic target object model can be obtained. At present, the gridding and rendering technology using three basic matrix dimensional points is the most widely used method in the field of 3D reconstruction. In the final process of the three-dimensional reconstruction of the basic matrix, the information of these points needs to be constructed into a surface, and the triangle theory is called the basic matrix is ​​the simplest surface element. The method chosen for the experiment in this chapter is the simplest and most mature triangulation method. The final result of the basic matrix 3D reconstruction is to obtain a realistic 3D model of the reconstructed object, but texture mapping is the best way to reflect the realism of the 3D model. Therefore, after obtaining a large number of useful three-dimensional points of the target object and the basic matrix, texture can be added to the surface of these target objects.The more widely used method is forward texture mapping. Forward texture mapping can be summarized as mapping the texture space to the screen space, which means that the points corresponding to the two-dimensional image are mapped to the three-dimensional points in the three-dimensional space. It is called texture scanning. Forward texture mapping is the conversion process between the two-dimensional function of the image and the three-dimensional space function, and finally, it can be reflected in the image space by using the projection method.First, assume thatV represents texture coordinates, x,y is screen coordinates, and F is a forward mapping function; that is, forward texture mapping can be expressed by(7)F:R2⟶R2,u,v⟶x,y=ku,v,lu,v.According to the above, the forward texture mapping scans the lines in the space. After each scan line in the texture space, after mutual projection in the dimensional space, it can make full use of the texture pixels stored in the memory to speed up the graphics generation speed.


## 4. Realization of the Algorithm of Three-Dimensional Reconstruction of Ancient Buildings in the Qing Dynasty

According to the abovementioned matching and reconstruction of the sequence images of ancient buildings in the Qing Dynasty, the accuracy of image reconstruction is improved. After the matching images are obtained, one point of the damaged part of the building in the two sequence images is taken, and the two points are merged to realize the whole process of 3D reconstruction. The fusion process is divided into two parts: one is to determine the consistent corresponding point set in the sequence image, and the other is to solve the transformation matrix to complete the fusion of the two matrix point sets.P1, P2, respectively, represent the two sequence image systems, count the number of damaged parts in the photo D of the ancient building at the corresponding points in P1, P2, and the specific implementation method is that, for each image K in D, read it in the two sequence images. The corresponding point in the system is defined as Pk1, Pk2. Then calculate the pixel position of P1, P2, projected on K, and record the projected point coordinates of the three-dimensional point in the common plane. The calculation formula is(8)xi=PXi.In the formula,Xi represents the three-dimensional point coordinates, P represents the camera matrix corresponding to the image K, and xi represents the two-dimensional point coordinates on which Xi is projected.The result of projectingP1, P2 to image K is marked as K1, K2. The projected pixel coordinates calculated by formula (8) are not integers, so it is necessary to round the coordinates of each pixel in the image. After rounding, compare and analyze the coordinate positions of the pixels in the two images and record them. Pixels with overlapping coordinate values are output, and the overlapping pixels form a point set A; then, the points in this set are matching points. In this way, a consistent point pair between the whole point and the local point can be obtained.In order to achieve accurate alignment of the coordinates of all points in the corresponding point set, it is necessary to find a similarity transformationT. Since the corresponding points of the two sequence images are known, the solution of T is solved using an explicit solution. Transformation T is a combination of three parameters, namely, the translation vector L, the scaling factor s, and the optimal rotation matrix R′. From this, the solution problem can be converted into a minimized objective function as follows:(9)EPk1,Pk2=Pk1−s⋅Pk2⋅R′+L.Then, solve the corresponding transformation by the following method:(1)
Solve the translation vectorL.First, calculate the geometric center ofP1, P2 by the following formula:(10)O=∑i=1NXi/N.In formula (10), O represents the geometric center, N represents the number of points, and then through the obtained O1, O2, the translation vector L can be calculated as follows:(11)L=O1−O2.In the actual operation process, the coordinate normalization method is used to translate the center point of the two sequence image systems to the originO. Therefore, formula (11) can also be transformed into the following form:(12)L=O1−O2+O−O1.(2)
Solve the optimal rotation matrixR′.Without considering the scaling factor, formula (12) can be further simplified as follows:(13)EPk1,Pk2=Pk1−Pk2⋅R.In order to ensure that the system coordinates remain unchanged during the selection and transformation process, the selection matrix should satisfy the constraint ofdetR=1. The optimal rotation matrix R′ is solved by OPP algorithm as follows:(14)R′=U⋅VT.In the formula,U, V, respectively, represent the eigenvector matrix.(3)
Solve for scaling factors.The scaling factor can be obtained directly according to formula (14):(15)s=trPk1T⋅Pk2⋅R′/trPk2T⋅Pk2.In the formula,tr⋅ represents the matrix trace [7]. After the scaling, translation and rotation transformation are completed by the above method; the point cloud in the sequence image system P2 is converted to the P1 sequence image system by the following formula:(16)P˜2=s⋅P2⋅R′+L.As a result, the fusion of the two sequence image point clouds is completed, and the three-dimensional virtual reconstruction algorithm of ancient buildings in the Qing Dynasty is realized.


## 5. Experimental Analysis

In order to verify the effectiveness of the three-dimensional virtual reconstruction algorithm of Qing Dynasty ancient buildings designed in this paper based on image sequences, the experiment environment is simulated in MATLAB software, and the algorithm of literature [4], literature [5], and literature [6] and the algorithm of literature [7] are used as the experimental comparison methods to design simulation comparison experiments.


### 5.1. Selection of Experimental Subjects

The experiment object took the ancient Qing Dynasty building Summer Palace corridor Ru Pavilion as an example. Kuru Pavilion is located on the east embankment south of the newly built gate of the Summer Palace. It is commonly known as Bafang Pavilion. It sets against each other in space with the Seventeen-Hole Bridge and Nanhu Island. Kuo Routing sits north and faces south. The building area is 384.95 square meters, and the plane is octagonal, with 3 rooms on each side, surrounded by corridors, double eaves, eight ridges, and round treasure roofs. There are 42 pillars in the pavilion. There is a wooden plaque on each side of the pavilion (8 pieces in total) on which Qianlong imperial poetry is engraved. The schematic diagram of the experimental object is shown in Figure3.Figure 3
The corridor of the Summer Palace, an ancient building in the Qing Dynasty, is like a pavilion.


### 5.2. Experimental Procedure

The performance of the method is shown by the completeness and accuracy of the ancient building 3D model construction. The analysis process of the specific experimental results is as follows: reconstruction of the patch according to 7 × 7 blocks, using Unity 3D tools and EditSpline and other methods to composite modelling and processing wireframes, using literature [4], literature [5], and literature [6] algorithm, literature [7] algorithm, and the designed algorithm to realize the three-dimensional virtual reconstruction process, and obtain the three-dimensional virtual reconstruction renderings of the ancient building Summer Palace corridor Rutting of the Qing Dynasty and the completeness and accuracy of the reconstruction Perform analysis.


### 5.3. Analysis of Experimental Results

According to the above-selected experimental objects and experimental instrument parameter settings, the ancient building three-dimensional model construction experiment was carried out. The literature [4], literature [5], and literature [6] algorithm, the literature [7] algorithm, and the designed algorithm were used to perform three-dimensional virtual reconstruction of the summer palace corridor Rutting Pavilion. The effect comparison chart of this method is shown in Figure 4.Figure 4
Three-dimensional virtual reconstruction renderings of the corridor rutting of the ancient summer palace building in the Qing Dynasty with different methods. (a) Reference [4] algorithm. (b) Reference [5] algorithm. (c) Reference [6] algorithm. (d) Reference [7] algorithm. (e) Designed algorithm.
(a)(b)(c)(d)(e)Analyzing Figure4, it can be seen that, using the algorithms of literatures [4–7] to perform three-dimensional virtual reconstruction of the corridors of ancient buildings in the Qing Dynasty, the completeness of the front reconstruction model is better, but the definition is poor, especially the wall part of the frontal model reconstructed by literature [4]. The performance of the overhead model is poor and the texture information is lost. The reconstruction of the three-dimensional model of the corridor of the Summer Palace obtained by the designed algorithm is relatively complete and clear, such as pavilions, towers, and top views, which proves that the three-dimensional virtual reconstruction effect of the algorithm is excellent.The experiment divides the experimental object into 8 subparts, uses the literature [4], literature [5], and literature [6] algorithm, the literature [7] algorithm, and the designed algorithm to model it in three dimensions, and compares the built model with the actual building to calculate the integrity of the built model. Table 1 shows the completeness data of three-dimensional model construction of ancient buildings.Table 1
Data table of completeness of three-dimensional model construction of ancient buildings.
The number of the subparts of the experiment objectModel construction completenessReference [4] algorithm (%)Reference [5] algorithm (%)Reference [6] algorithm (%)Reference [7] algorithm (%)Designed algorithm (%)166.8567.4567.5679.8582.2267.3367.3568.2370.1285.3359.6763.7660.1275.4286.7453.6762.7459.8480.1088.9565.7868.4563.5475.2085.4662.5462.3562.9169.5889.1761.7863.7360.9871.5988.1858.7556.7859.5873.5192.4Average value62.0564.0862.8574.4287.26According to the data in Table1, for each subpart of the ancient building, the completeness of the three-dimensional model of the designed algorithm is higher than that of the existing method. Through the comparison of average values, it is found that compared with the algorithm in literature [4], literature [5], and literature [6] and the algorithm in literature [7], the completeness of the 3D model of the designed algorithm is improved by 25.21%, 23.18%, 24.41%, and 12.84%, which fully shows that the designed algorithm has better performance in the construction of the ancient building 3D model.In order to further verify the effectiveness of the method in this paper, the accuracy of the ancient building 3D model construction of the method in this paper, the algorithm in literature [4], literature [5], and literature [6] and the algorithm in literature [7] are compared and analyzed. The comparison result is shown in Figure 5.Figure 5
Comparison results of model construction accuracy.According to Figure5, the accuracy of constructing the 3D model of ancient Qing Dynasty architecture in this paper is up to 100%, while the accuracy of constructing the 3D model of ancient Qing Dynasty in literature [4] algorithm, literature [5] algorithm, and literature [6] algorithm and document [7] is only 71%, 78%, 70%, and 80%. It shows that the construction accuracy of the ancient Qing Dynasty three-dimensional model of the method in this paper is higher than that of the existing methods. It is because the method in this paper preprocesses the sequence image data of the target ancient building, and the sequence image is based on the improved 2DPCA-SIFT feature matching algorithm. Perform matching reconstruction, and use the RANSAC iterative algorithm to remove the interference error in the sequence image reconstruction process, use the consistent corresponding point set in the sequence image to solve the transformation matrix, complete the fusion of the two matrix point sets, and realize the three-dimensional virtual reconstruction of ancient buildings in the Qing Dynasty. Algorithm design improves the accuracy of construction.


## 5.1. Selection of Experimental Subjects

The experiment object took the ancient Qing Dynasty building Summer Palace corridor Ru Pavilion as an example. Kuru Pavilion is located on the east embankment south of the newly built gate of the Summer Palace. It is commonly known as Bafang Pavilion. It sets against each other in space with the Seventeen-Hole Bridge and Nanhu Island. Kuo Routing sits north and faces south. The building area is 384.95 square meters, and the plane is octagonal, with 3 rooms on each side, surrounded by corridors, double eaves, eight ridges, and round treasure roofs. There are 42 pillars in the pavilion. There is a wooden plaque on each side of the pavilion (8 pieces in total) on which Qianlong imperial poetry is engraved. The schematic diagram of the experimental object is shown in Figure3.Figure 3
The corridor of the Summer Palace, an ancient building in the Qing Dynasty, is like a pavilion.


## 5.2. Experimental Procedure

The performance of the method is shown by the completeness and accuracy of the ancient building 3D model construction. The analysis process of the specific experimental results is as follows: reconstruction of the patch according to 7 × 7 blocks, using Unity 3D tools and EditSpline and other methods to composite modelling and processing wireframes, using literature [4], literature [5], and literature [6] algorithm, literature [7] algorithm, and the designed algorithm to realize the three-dimensional virtual reconstruction process, and obtain the three-dimensional virtual reconstruction renderings of the ancient building Summer Palace corridor Rutting of the Qing Dynasty and the completeness and accuracy of the reconstruction Perform analysis.


## 5.3. Analysis of Experimental Results

According to the above-selected experimental objects and experimental instrument parameter settings, the ancient building three-dimensional model construction experiment was carried out. The literature [4], literature [5], and literature [6] algorithm, the literature [7] algorithm, and the designed algorithm were used to perform three-dimensional virtual reconstruction of the summer palace corridor Rutting Pavilion. The effect comparison chart of this method is shown in Figure 4.Figure 4
Three-dimensional virtual reconstruction renderings of the corridor rutting of the ancient summer palace building in the Qing Dynasty with different methods. (a) Reference [4] algorithm. (b) Reference [5] algorithm. (c) Reference [6] algorithm. (d) Reference [7] algorithm. (e) Designed algorithm.
(a)(b)(c)(d)(e)Analyzing Figure4, it can be seen that, using the algorithms of literatures [4–7] to perform three-dimensional virtual reconstruction of the corridors of ancient buildings in the Qing Dynasty, the completeness of the front reconstruction model is better, but the definition is poor, especially the wall part of the frontal model reconstructed by literature [4]. The performance of the overhead model is poor and the texture information is lost. The reconstruction of the three-dimensional model of the corridor of the Summer Palace obtained by the designed algorithm is relatively complete and clear, such as pavilions, towers, and top views, which proves that the three-dimensional virtual reconstruction effect of the algorithm is excellent.The experiment divides the experimental object into 8 subparts, uses the literature [4], literature [5], and literature [6] algorithm, the literature [7] algorithm, and the designed algorithm to model it in three dimensions, and compares the built model with the actual building to calculate the integrity of the built model. Table 1 shows the completeness data of three-dimensional model construction of ancient buildings.Table 1
Data table of completeness of three-dimensional model construction of ancient buildings.
The number of the subparts of the experiment objectModel construction completenessReference [4] algorithm (%)Reference [5] algorithm (%)Reference [6] algorithm (%)Reference [7] algorithm (%)Designed algorithm (%)166.8567.4567.5679.8582.2267.3367.3568.2370.1285.3359.6763.7660.1275.4286.7453.6762.7459.8480.1088.9565.7868.4563.5475.2085.4662.5462.3562.9169.5889.1761.7863.7360.9871.5988.1858.7556.7859.5873.5192.4Average value62.0564.0862.8574.4287.26According to the data in Table1, for each subpart of the ancient building, the completeness of the three-dimensional model of the designed algorithm is higher than that of the existing method. Through the comparison of average values, it is found that compared with the algorithm in literature [4], literature [5], and literature [6] and the algorithm in literature [7], the completeness of the 3D model of the designed algorithm is improved by 25.21%, 23.18%, 24.41%, and 12.84%, which fully shows that the designed algorithm has better performance in the construction of the ancient building 3D model.In order to further verify the effectiveness of the method in this paper, the accuracy of the ancient building 3D model construction of the method in this paper, the algorithm in literature [4], literature [5], and literature [6] and the algorithm in literature [7] are compared and analyzed. The comparison result is shown in Figure 5.Figure 5
Comparison results of model construction accuracy.According to Figure5, the accuracy of constructing the 3D model of ancient Qing Dynasty architecture in this paper is up to 100%, while the accuracy of constructing the 3D model of ancient Qing Dynasty in literature [4] algorithm, literature [5] algorithm, and literature [6] algorithm and document [7] is only 71%, 78%, 70%, and 80%. It shows that the construction accuracy of the ancient Qing Dynasty three-dimensional model of the method in this paper is higher than that of the existing methods. It is because the method in this paper preprocesses the sequence image data of the target ancient building, and the sequence image is based on the improved 2DPCA-SIFT feature matching algorithm. Perform matching reconstruction, and use the RANSAC iterative algorithm to remove the interference error in the sequence image reconstruction process, use the consistent corresponding point set in the sequence image to solve the transformation matrix, complete the fusion of the two matrix point sets, and realize the three-dimensional virtual reconstruction of ancient buildings in the Qing Dynasty. Algorithm design improves the accuracy of construction.


## 6. Conclusion

This paper designs a three-dimensional virtual reconstruction algorithm for ancient buildings in the Qing Dynasty based on image sequences. Experimental results show the completeness of the three-dimensional virtual reconstruction 3D model of ancient Qing dynasty architecture constructed by the designed algorithm has been significantly improved. The completeness and accuracy of the three-dimensional model construction of the subparts of the ancient Qing dynasty architecture of this method are high, which fully shows that the designed algorithm is in the ancient architecture of the Qing Dynasty. The performance in 3D model construction is better.The primary limitation to the generalization of these results is that the reconstruction efficiency of our algorithm is not high enough; however, we believe that there is a possibility of improvement. In the future, we will carry out our work based on this.



---

*Source: 8388480-2021-12-31.xml*