Method, device, equipment and storage medium for repairing window deformation on building facade
By extracting and mapping three-dimensional straight lines and point features in the building facade model, the window model is constructed and merged, which solves the problem of reduced geometric accuracy caused by window deformation in the existing technology, and achieves comprehensive repair of the model and improvement of visual effects.
Patent Information
- Application Number
- CN202410727244.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-06-06
AI Technical Summary
The existing technology is difficult to completely eliminate the problem of reduced geometric accuracy caused by window deformation in the building facade model, and can only achieve the repair effect of slight adjustments.
By extracting the 3D linear features and 3D point features of the window area from the original image and initial model of the building facade, projecting them onto the facade plane, mapping and constructing a 3D window model, and merging them into the initial model to repair the window deformation.
Complete repair of the window deformation in the building facade model was achieved, eliminating the problem of reduced geometric accuracy and improving the visual effect.
Smart Images

Figure CN118314308B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image restoration, and in particular to a method, device, equipment and storage medium for repairing window deformation on a building facade. Background Art
[0002] The reconstruction result of building facades, as the main part of urban buildings, directly affects the visual effect of the entire urban building complex. The oblique photography 3D model is an important data body in the future urban digitization. However, due to the reduction of image quality, weak texture phenomenon, and the concave and convex structure in the window area, the model geometric deformation and texture distortion often occur in the window area of the building facade.
[0003] In order to solve the model geometric deformation and texture distortion phenomena in the window area of the building facade, the existing technology generally uses post-production software to repair the model geometric deformation and texture distortion phenomena in the window area of the reconstructed building model manually by relying on post-production software.
[0004] However, post-production software can generally only achieve a slight adjustment repair effect on the established building facade model, and the deformed window facade greatly reduces the visual effect of the overall building model. It is difficult to completely eliminate the reduction in geometric accuracy caused by window deformation by only processing with post-production software. Summary of the invention
[0005] In view of this, it is necessary to provide a method, device, equipment and storage medium for repairing window deformation of a building facade, so as to solve the problem that the post-production software in the prior art is difficult to completely eliminate the reduced geometric accuracy caused by the window deformation of the building facade model.
[0006] In order to solve the above problems, the present invention provides a method for repairing window deformation on a building facade, comprising:
[0007] Extracting 3D straight line features and 3D point features of the window area based on the original image of the building facade and the initial model of the building facade;
[0008] Projecting the 3D straight line features and the 3D point features onto the plane where the facade is located to obtain 2D features, and obtaining a 3D window model based on the 2D feature mapping;
[0009] The three-dimensional window model is merged into the initial building facade model to repair the window deformation and obtain the building facade target model.
[0010] In a possible implementation, extracting three-dimensional straight line features of the window area according to the original image of the building facade and the initial model of the building facade includes:
[0011] Extract line segments from the window area in the original image of the building facade to obtain a two-dimensional simplified straight line of the window;
[0012] Determine the main direction of windows and image depth map based on the initial model of the building facade;
[0013] According to the image depth map, point sampling and back-projection are performed on the two-dimensional simplified straight line of the window to obtain three-dimensional straight line sampling points;
[0014] The 3D straight line sampling points are constrained according to the main direction of the window to determine the 3D straight line features of the window area.
[0015] In a possible implementation, line segment extraction is performed on the window area in the original image of the building facade to obtain a two-dimensional simplified straight line of the window, including:
[0016] Extract the feature description vector of the initial straight line in the window area from the original image of the building facade;
[0017] The initial straight line clusters of multiple window areas are obtained by performing mean shift clustering based on the feature description vector;
[0018] The straight lines in the initial straight line clusters of multiple window areas are optimized to obtain two-dimensional simplified straight lines of the windows.
[0019] In a possible implementation, extracting 3D point features of the window area based on the original image of the building facade and the initial model of the building facade includes:
[0020] Determine the four corner points of the windows based on the initial model of the building facade;
[0021] Based on the four corner points of the windows, multiple independent window image blocks are cropped from the original image of the building facade;
[0022] Extract and match feature points of multiple independent window image blocks, and calculate feature point description vectors;
[0023] Multi-frame triangulation processing is performed on the feature point description vector to extract the three-dimensional point features of the window area.
[0024] In a possible implementation, feature point extraction and matching are performed on multiple independent window image blocks, and feature point description vectors are calculated, including:
[0025] Determine the window reference independent image block according to the number of valid pixels in each window independent image block;
[0026] Align the feature points of the remaining window independent image blocks to the window benchmark independent image block and then perform feature point extraction and matching;
[0027] The matched feature points are screened and the feature point description vectors are calculated.
[0028] In a possible implementation, the three-dimensional line features and the three-dimensional point features are projected onto the plane where the facade is located to obtain two-dimensional features, and a three-dimensional window model is obtained based on the two-dimensional feature mapping, including:
[0029] Calculate the point 2D features and line 2D features of the 3D straight line features and 3D point features on the plane where the facade is located according to the feature representation of the plane where the facade is located;
[0030] Construct the initial window edge topological relationship based on point 2D features and line 2D features;
[0031] Optimize the feature position in the initial window edge topology relationship based on coordinate scaling;
[0032] The optimized initial window edge topological relationship is mapped to obtain a three-dimensional window model.
[0033] In a possible implementation, the feature position in the initial window edge topological relationship is optimized based on coordinate scaling, including:
[0034] Assign different coordinate scaling factors to point 2D features and line 2D features;
[0035] The feature positions in the initial window edge topological relationship are scaled based on the coordinate scaling factor.
[0036] The present invention also provides a window deformation repair device for a building facade, comprising:
[0037] A feature extraction module, used for extracting 3D straight line features and 3D point features of the window area according to the original image of the building facade and the initial model of the building facade;
[0038] A projection mapping module, used for projecting three-dimensional straight line features and three-dimensional point features onto the plane where the facade is located to obtain two-dimensional features, and obtaining a three-dimensional window model based on the two-dimensional feature mapping;
[0039] The merging module is used to merge the three-dimensional window model into the initial building facade model to repair the window deformation and obtain the building facade target model.
[0040] In a third aspect, the present invention further provides a window deformation repair device for a building facade, comprising a memory and a processor, wherein:
[0041] Memory, used to store programs;
[0042] The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the method for repairing window deformation on the facade of a building in any of the above implementations.
[0043] In a fourth aspect, the present invention further provides a computer-readable storage medium for storing computer-readable programs or instructions, which, when executed by a processor, can implement the steps of the method for repairing window deformation on a building facade in any of the above-mentioned implementations.
[0044] The beneficial effects of the present invention are as follows: the present invention provides a method for repairing window deformation of a building facade, determines the three-dimensional straight line features and three-dimensional point features of the window area from the original image of the building facade and the initial model of the building facade, determines the two-dimensional features of the window area based on the three-dimensional straight line features and the three-dimensional point features, reconstructs the window model through the two-dimensional feature mapping of the window area to obtain a three-dimensional window model, and then merges the three-dimensional window model into the initial model of the building facade to replace the deformed window area model in the initial model of the building facade, thereby realizing the repair of the window deformation in the initial model of the building facade, obtaining the target model of the building facade, and completely eliminating the problem of reduced geometric accuracy caused by the window deformation of the building facade model. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A schematic flow chart of an embodiment of a method for repairing window deformation on a building facade provided by the present invention;
[0046] Figure 2 The present invention provides Figure 1 A schematic flow chart of an embodiment of step S101;
[0047] Figure 3 The present invention provides Figure 2 A flow chart of an embodiment of step S201;
[0048] Figure 4 The present invention provides Figure 1 A schematic flow chart of an embodiment of step S102;
[0049] Figure 5 The present invention provides Figure 4 A schematic diagram of a flow chart of an embodiment of step S403;
[0050] Figure 6 The present invention provides Figure 1 A schematic flow chart of an embodiment of step S103;
[0051] Figure 7 A schematic structural diagram of an embodiment of a window deformation repair device for a building facade provided by the present invention;
[0052] Figure 8 A schematic structural diagram of a window deformation repair device for a building facade provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0053] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0054] See also Figure 1 , Figure 1 A flow chart of an embodiment of a method for repairing window deformation on a building facade provided by the present invention is provided. A specific embodiment of the present invention discloses a method for repairing window deformation on a building facade, comprising:
[0055] S101, extracting 3D straight line features and 3D point features of the window area according to the original image of the building facade and the initial model of the building facade;
[0056] S102, projecting the three-dimensional straight line features and the three-dimensional point features onto the plane where the facade is located to obtain two-dimensional features, and obtaining a three-dimensional window model based on the two-dimensional feature mapping;
[0057] S103, merging the three-dimensional window model into the initial building facade model to repair the window deformation and obtain a building facade target model.
[0058] In the above embodiment, by comparing the original image of the building facade and the initial model of the building facade, the deformation and bending phenomenon of the three-dimensional straight line in the window area in the initial model of the building facade is very obvious. In order to maintain the straight line features of the window and keep the model true, it is necessary to extract the straight three-dimensional line features of the window area and improve the deformation phenomenon.
[0059] The building facade refers to the interface where the building is in direct contact with the external space of the building, as well as the image and composition it presents, or a general term for the components and their combination methods at the interface between the internal and external spaces of the building.
[0060] After extracting the 3D straight line features and 3D point features, how to use these features to obtain a 3D window model that expresses the geometric structure of the window is the key. Since the window area has certain planar characteristics, the 3D features are first projected to the plane where the facade is located, and then the projected point and line 3D features are used to construct the topological connection relationship of the 2D points and lines through constraints, and then the topological relationship is mapped to the 3D space to complete the generation of the 3D window model.
[0061] After obtaining the three-dimensional window model, it is necessary to replace the window model in the initial model of the building facade with the three-dimensional window model, and to repair the window deformation by merging the three-dimensional window model into the initial model of the building facade to obtain the target model of the building facade.
[0062] Compared with the prior art, the present embodiment provides a method for repairing window deformation of a building facade, which determines the three-dimensional straight line features and three-dimensional point features of the window area from the original image of the building facade and the initial model of the building facade, determines the two-dimensional features of the window area based on the three-dimensional straight line features and the three-dimensional point features, reconstructs the window model through the two-dimensional feature mapping of the window area to obtain a three-dimensional window model, and then merges the three-dimensional window model into the initial model of the building facade to replace the deformed window area model in the initial model of the building facade, thereby realizing the repair of the window deformation in the initial model of the building facade, obtaining the target model of the building facade, and completely eliminating the problem of reduced geometric accuracy caused by the window deformation of the building facade model.
[0063] See also Figure 2 , Figure 2 A flow chart of an embodiment of extracting three-dimensional straight line features of a window area provided by the present invention. In some embodiments of the present invention, extracting three-dimensional straight line features of a window area based on an original image of a building facade and an initial model of a building facade includes:
[0064] S201, extracting line segments from the window area in the original image of the building facade to obtain a two-dimensional simplified straight line of the window;
[0065] S202, determining the main direction of the window and the image depth map according to the initial model of the building facade;
[0066] S203, performing point sampling and back-projection on the two-dimensional simplified straight line of the window according to the image depth map to obtain three-dimensional straight line sampling points;
[0067] S204: Constrain the three-dimensional straight line sampling points according to the main direction of the window to determine the three-dimensional straight line features of the window area.
[0068] In the above embodiment, the LSD algorithm is used to extract three-dimensional straight line features from the window area image. The advantage of this algorithm is that the extraction results are rich, the probability of missing is small, and no strategy is needed to supplement the straight lines. However, the corresponding cost is that the algorithm retains many fragmented line segments and there are redundant line segments. These fragmented or redundant straight lines are not conducive to the subsequent construction of feature topological relationships. Therefore, it is necessary to merge some fragmented straight lines and filter out redundant straight lines, and it is necessary to simplify the two-dimensional straight lines.
[0069] The three-dimensional straight line sampling points are determined based on the back-projection strategy of image depth, where the image depth comes from the existing initial model of the building facade. The depth value of the pixel under the perspective of a single image is obtained from the initial model of the building facade based on the rendering method. The final back-projected three-dimensional straight line sampling points are consistent with the deformation of the initial model of the building facade. Therefore, the straight lines located in the deformation area of the model are also deformed. These feature lines are helpful to repair the deformation of the windows in the initial model of the building facade after correction.
[0070] The edges that make up the window are mostly horizontal and vertical, and parallel to the plane of the facade. This is an important prior for correcting the three-dimensional straight line features of the window. The horizontal and vertical directions of the facade window and the plane normal are the main directions of the window. This prior can be described as a constraint that the three-dimensional characteristic lines of the window must be perpendicular or parallel to the main direction.
[0071] One thing that can be determined is that the vertical direction of the building must be the direction of the plumb line. When the house is constructed, the plumb line is the ruler of the vertical direction. Therefore, the method in this paper stipulates that the normal vector of the vertical direction in the world coordinate system is , It has practical significance. At the same time, in the 3D model of the large scene, the average normal and The orientation of the facade is the second direction that is easy to determine. Based on the point cloud of the entire wall, the plane fitting algorithm based on RANSAC can accurately find the position of the plane where the wall is located. Assume that the plane equation of the facade is , then the facade orientation can be expressed as Based on the vertical direction and the horizontal direction of the wall normal, the right-hand rule can be used to find , so far the three main directions of the facade windows have been determined.
[0072] Depth is the vertical distance from a point to the center of the camera, that is, the projection distance of the line connecting the point and the center of the camera on the main optical axis of the camera. The depth of the image comes from the existing initial model of the building facade. The rendering-based method obtains the depth value of the pixel from the perspective of a single image from the initial model of the building facade. The three-dimensional feature lines finally back-projected are consistent with the deformed initial model of the building facade. Therefore, the straight lines located in the deformed area of the initial model of the building facade are also deformed. These feature lines are helpful for model repair only after correction.
[0073] Take one end point of the simplified two-dimensional straight line of the window as the origin, the direction pointing to the other end point as the x-axis, and the depth value as the y-coordinate to draw a scatter plot, fit the straight line and calculate the goodness of fit. Through the scatter plot, the straight line is divided into three situations: no deformation, small deformation and severe deformation according to the change of depth with the straight line. The straight line without deformation generally appears in the plane part around the window, and its depth value changes evenly with the straight line, and the goodness of fit of the fitted straight line is above 0.99; the depth of the straight line with small deformation is linear as a whole, but there will be points where the depth value suddenly changes. Before and after the mutation point, the slope of the change is inconsistent, indicating that the straight line is segmented. It is affected by the mutation point, and its goodness of fit is above 0.95; the straight line with severe deformation mostly appears inside the window, distributed in an arc shape, and there is no linear law for the change of its depth with the straight line. Much lower than 0.9.
[0074] In order to make the final reconstruction result have a better sense of planarity and avoid generating narrow and uneven triangular surfaces, all two-dimensional simplified straight lines are constrained by the plane where the facade is located, except for the straight lines perpendicular to the facade. The basic idea is to divide the window lines into three categories: outside the facade, near the facade, and inside the facade according to the distance from each line to the facade, and find three suitable planes to reposition these window lines so that these window lines have planarity and a more regular feel. One point to note here is that the processing of the lines is actually achieved by processing the three-dimensional sampling points of each line. After the three-dimensional points are processed as a set of points that meet the main direction constraints, the final window ridges are generated by straight line fitting to finally determine the three-dimensional straight line features of the window area.
[0075] See also Figure 3 , Figure 3 The present invention provides Figure 2 FIG. 1 is a flow chart of an embodiment of step S201 in FIG. 1 . In some embodiments of the present invention, line segment extraction is performed on the window area in the original image of the building facade to obtain a two-dimensional simplified straight line of the window, including:
[0076] S301, extracting a feature description vector of an initial straight line in a window area from an original image of a building facade;
[0077] S302, performing mean shift clustering based on the feature description vector to obtain initial straight line clusters of multiple window areas;
[0078] S303, optimizing the straight lines in the initial straight line clusters of the plurality of window regions to obtain two-dimensional simplified straight lines for the windows.
[0079] In the above embodiment, the basic features of the straight line (segment) are direction and position. In the pixel coordinate system of the original image of the building facade, its direction We can use the two-dimensional normal vector Indicates that the position can be expressed as the midpoint describe. a,b,x,y The vector dimension of the four parameters is too high, and the midpoint is too strict as a position feature. Next, we start from the normal vector and midpoint of the line to obtain a more concise and effective line feature description vector.
[0080] First, the direction parameter is simplified. As a preferred embodiment, horizontal right is specified as the starting direction (radian is 0), then the direction feature of the line segment can be directly expressed as an angle Let the normal vector is a positive number, then the normal vector of the line segment must be in the first and fourth quadrants, and the angle The value of is between -90° and 90°, so , only one angle parameter is required It can represent the direction of the line segment.
[0081] Based on the direction and midpoint of the line segment, a lower-dimensional position feature is obtained to meet the classification requirements. Remember the direction of each straight line , the normal direction of the line and midpoint coordinates Then the midpoint coordinates Projected onto the normal of the straight line, the projection value is recorded as , the projection formula is , the projection value As the position feature of the line segment, the feature description vector of the straight line segment can be obtained as .
[0082] After obtaining the feature description vector that can express the direction and position characteristics of the straight line, the feature description vector is regarded as a two-dimensional coordinate point. At this time, each straight line in the window area corresponds to a point on the plane. The points corresponding to the straight lines with the same characteristics tend to be close in space to form a point cluster with a certain density, and there is a certain distance between the points corresponding to the straight lines in different directions and positions. The mapping relationship between the straight lines and the points is saved, and the classification problem of the straight lines can be transformed into the common point cloud clustering problem.
[0083] Since the initial straight line clusters in the window area are not certain, a point cloud clustering algorithm that can automatically determine the number of categories is needed. Mean shift clustering meets this requirement. It is a density-based clustering method. Taking plane points as an example, it starts with a circular window centered at a random point and a certain radius as the kernel. In the iterative process, the kernel is continuously moved to a denser area until there is no directional movement so that the kernel can accommodate more points, and the number of categories is automatically discovered. The cluster center converges to the point with the highest density, which is an important reason for using this algorithm to classify point clouds. At the same time, when using this algorithm, the window and its structure often have a fixed size, which provides a certain basis for determining the search window radius parameter.
[0084] Redundancy and breakage of lines often occur in a set of similar lines. Line clustering methods are used to group lines with the same characteristics into an initial line cluster, and then the lines are optimized within the initial line cluster, which can effectively avoid the possible influence of lines of other classes and greatly reduce the complexity of line simplification. Next, the initial line cluster is processed in sequence to merge broken lines, reclassify lines within the class, and eliminate redundant lines, so as to obtain a two-dimensional simplified line of the window with high integrity and concise expression.
[0085] One of the reasons for the generation of fragmented line segments is the breakage of long line segments. There are many reasons for the breakage of lines, such as low image resolution, complex scene features and unclear features, etc. This is a common phenomenon. For such fragmented line segments, they can be retained by merging.
[0086] From the LSD line extraction results, the directions of the broken line segments that originally belonged to a straight line are very close, and their position features are also highly consistent, so they are likely to be classified into an initial straight line cluster, which greatly reduces the difficulty of finding the broken line and improves the accuracy. In the initial straight line cluster, the characteristic vector distance is used as the basis for judging the broken line, and a combined search strategy is adopted to find the broken lines that originally belonged to the same straight line. Then, the two endpoints with the farthest distance among the multiple endpoints of the broken line are used as the endpoints of the merged result to complete the merging of the broken broken line segments.
[0087] After merging the fragmented broken straight lines, the interference of short lines is eliminated, and the lines with closer midpoints in each initial straight line cluster are re-divided into new straight line clusters to prepare for the subsequent removal of redundant straight lines.
[0088] Unlike the straight line in the mathematical sense, the line in the real world has width, which is reflected in the image as a line with a certain pixel width. If this ridge-like edge is not processed, straight lines will be extracted on both sides of the real position of the straight line, resulting in straight line redundancy and inaccurate line position. However, there are many straight line redundancies in the LSD line extraction results, and it is necessary to extract the exact position of the straight line from the line pair to achieve the purpose of removing straight line redundancy. From the straight line clustering results, these redundant straight lines that appear in pairs are mostly divided into one category. Therefore, we focus on the category with two straight lines in the class, find the redundant line pairs by the length of the line segment and the proximity of the midpoint, and obtain the endpoints of the refined straight line by taking the midpoint of the same side endpoint. After the breakline merging, the reclassification of the straight lines in the class and the de-redundancy of the straight lines, some extra fragmented straight lines are removed by the length threshold to obtain the final window two-dimensional simplified straight line of the LSD straight line extraction result.
[0089] See also Figure 4 , Figure 4 A flow chart of an embodiment of extracting 3D point features of a window area provided by the present invention. In some embodiments of the present invention, extracting 3D point features of a window area based on an original image of a building facade and an initial model of a building facade includes:
[0090] S401, determining the four corner points of the window according to the initial model of the building facade;
[0091] S402, cropping the original image of the building facade based on the four corner points of the windows to obtain multiple independent window image blocks;
[0092] S403, extracting and matching feature points of multiple window independent image blocks, and calculating feature point description vectors;
[0093] S404, performing multi-frame triangulation processing on the feature point description vector to extract the three-dimensional point features of the window area.
[0094] In the above embodiments, windows are an important part of buildings. Common buildings in life often have unified design and construction of facade windows. The windows of the same building are often of the same type or several types. Therefore, these windows have strong similarities in the image. In the three-dimensional reconstruction process, windows at different positions on the facade but with similar structures are prone to mismatching. In order to eliminate this mismatching phenomenon, the corresponding areas of the window area in different images are deducted, and then the image blocks containing only the single window after deduction are used for image matching. This processing avoids the mismatching of different features of similar structures from the source of the data, reduces the difficulty of matching, and improves the feasibility of matching specific areas of low-resolution images.
[0095] The coordinates of the four corner points of the deformed window are obtained from the initial model of the building facade, and the four corner points of the window are projected onto each image to obtain the pixel coordinates of the four corner points on each image. Next, the four corner points are connected into a rectangle in order in each image, and the pixels in the rectangle are selected using the cross product method and saved into a new image to complete the cropping of the window image block to obtain multiple independent window image blocks.
[0096] The cross product method is used to determine whether a vertex is inside a convex polygon. For a convex polygon, if a point is always on the left side of a directed edge (counterclockwise, positive) of the polygon, then the point must be inside the polygon. At the same time, the properties of the vector cross product are used to determine the relationship between the point and the given edge (the point is on the left, right, or on the edge). The starting point of any counterclockwise directed edge is O, the end point is A, and the point to be determined is P. If point P is inside the polygon, according to the right-hand rule, The direction of is always perpendicular to the plane and upward, and is positive. If point P is outside the polygon, there is a directed edge such that Less than 0.
[0097] See also Figure 5 , Figure 5 The present invention provides Figure 4 FIG. 4 is a flow chart of an embodiment of step S403 in FIG. 4 . In some embodiments of the present invention, feature point extraction and matching are performed on multiple independent window image blocks, and feature point description vectors are calculated, including:
[0098] S501, determining a window reference independent image block according to the number of valid pixels in each window independent image block;
[0099] S502, aligning feature points of the remaining window independent image blocks to the window reference independent image block and then extracting and matching feature points;
[0100] S503: Screen the matched feature points and calculate the feature point description vector.
[0101] In the above embodiment, before the image alignment, it is necessary to first select the window reference independent image block. The shooting direction of the window reference independent image block should be as perpendicular to the wall as possible and the higher the resolution, the better. Accordingly, this article determines the window reference independent image block according to the angle between the shooting angle and the facade direction during imaging and the number of pixels of the window independent image block. The number of effective pixels of each window independent image block is calculated according to the angle between the camera direction and the facade direction and the number of pixels of the corresponding window independent image block, and the window independent image block with the largest number of effective pixels is taken as the window reference independent image block for the homography matrix alignment image block.
[0102] The SIFT method is used to extract feature points from the independent image blocks of the windows, and the nearest neighbor matching algorithm is used to perform a rough match between the feature points of the remaining independent image blocks of the windows and the feature points of the independent image blocks of the window benchmark. Then, a threshold is determined based on the maximum value of the vector distance of the matching pairs. Only matches with a distance below the threshold are considered good matches. Generally speaking, the distance threshold can only remove matching points with large errors, and the remaining matches still contain a large number of mismatched pairs, which need to be removed first.
[0103] Based on the image matching technology, the image points with the same name between images are obtained. From the camera imaging model, it can be seen that when the internal and external orientation elements are known but the depth is unknown, a pixel determines a ray in space, and a pair of matching points determine two rays in space, which theoretically originate from the same point. Therefore, the ray intersection method is used to obtain the three-dimensional coordinates of the point corresponding to the image point. This method of obtaining three-dimensional coordinates from two-dimensional pixels is the forward intersection in space, also called triangulation.
[0104] Under ideal conditions, the spatial rays starting from the matching points intersect at the points, and the solution can be obtained. However, in practical applications, there are certain errors between the internal and external parameters of the camera and the coordinates of the matching points. It is difficult to obtain accurate three-dimensional feature point description vectors by simple two-frame triangulation. Therefore, during triangulation, the least squares adjustment method is used to solve a point using the matching points in all image blocks, and the multi-view images are fully utilized to constrain the solution process, so as to obtain more accurate three-dimensional coordinates. After the three-dimensional coordinates are solved, the average projection error is used to evaluate the solution results. When the projection error is too large, it is considered that this set of solutions has problems and is eliminated. Finally, a certain number of sparse three-dimensional feature points in the window area are obtained. These three-dimensional feature points are near the initial model of the building facade, and the position is relatively accurate, but the distribution is biased to one side of the window. This is because the images containing this window are mostly taken from left to right, so there are more details on the right side of the window, and the extracted three-dimensional feature point description vectors are also richer.
[0105] See also Figure 6 , Figure 6 The present invention provides Figure 1 In some embodiments of the present invention, the three-dimensional straight line features and the three-dimensional point features are projected onto the plane where the facade is located to obtain two-dimensional features, and a three-dimensional window model is obtained based on the two-dimensional feature mapping, including:
[0106] S601, calculating the point 2D features and line 2D features of the 3D straight line features and the 3D point features on the plane where the facade is located according to the feature representation of the plane where the facade is located;
[0107] S602, constructing an initial window edge line topological relationship according to the point two-dimensional features and the line two-dimensional features;
[0108] S603, optimizing the feature positions in the initial window edge topological relationship based on coordinate scaling;
[0109] S604, mapping the optimized initial window edge topology relationship to obtain a three-dimensional window model.
[0110] In the above embodiments, central projection is the most common projection method in life. If the projection center of the central projection method is moved to infinity so that the projection lines become parallel straight lines, the projection of the object will not be affected by the change in distance. This projection method in which the projection lines are parallel to each other is called parallel projection. For example, the shadow formed by an object on the ground under the irradiation of sunlight is the result of parallel projection. Parallel projection has good projection properties. Its projection size has nothing to do with the distance between the object and the projection plane. The elements parallel to the projection plane can maintain the same size, proportional relationship and parallelism before and after projection.
[0111] The three-dimensional straight line features generated by the principal direction constraint are parallel or perpendicular to the principal direction. Therefore, parallel projection can be used to reduce the three-dimensional straight line features and three-dimensional point features while maintaining the original information of the features as much as possible. This is a major advantage of parallel projection. In addition, the orthographic projection method in parallel projection is used to realize the projection of the features to the plane where the facade is located.
[0112] Here we use the plane normal vector A point through which the plane passes Determine the plane where the facade lies. , and its projection point on the plane is denoted as , then the projection point calculation method is derived as follows:
[0113] Plane Normal and the straight line in the plane Vertical and Projection Lines Parallel, using the parallel-perpendicular relationship, we can get the following equation:
[0114] ;
[0115] ;
[0116] The simultaneous equations yield:
[0117] ;
[0118] Finally Substituting in, we can get the projection point .
[0119] After projecting the three-dimensional straight line features and three-dimensional point features onto the three-dimensional space plane, all the two-dimensional point features and two-dimensional line features are on the plane, but are still in the three-dimensional space. Their analytical expression is still the coordinates of three numbers. Next, the points on the space plane are further processed using rigid transformation.
[0120] Taking the concave window as an example, the structure of the window is divided into ① the part recessed into the wall, ② the wall part and ③ the connecting part. These structures are often composed of ridges. The three disassembled parts are used to combine the connection relationship between the elements of the window. The construction of the initial window ridge topological relationship is similar to the above combination process. First, the line features of the recessed wall part are often close to the center. These line two-dimensional features are connected together to form ① when the network is constructed because of the close distance in space; secondly, the line two-dimensional features on the wall are relatively closer to the outside, and because of the close distance, they form the structure of ② when the network is constructed; finally, ① is inside ②, and the connecting part ③ is naturally generated. Combining ①, ② and ③ together generates the initial window ridge topological relationship of the entire window. In fact, the generation of topological relationships is carried out as a whole, and the corresponding connection relationship is directly generated according to the spatial relationship between point and line elements. From the above analysis, it can be seen that the key to constructing the topological relationship of window ridge features in the plane is to keep the features of ① and ② at a certain distance as much as possible to avoid mutual interference. At the same time, ① should be inside ② to ensure that ③ can be correctly generated, which is also the main basis for optimizing the position of plane features in the following.
[0121] From the analysis of the initial window edge topological relationship construction, it can be seen that in order to construct the correct topological relationship between line features, the line features in the concave part, on the wall and on the convex part need to strictly maintain a certain inside-outside nested relationship, otherwise errors will occur and incorrect topological connection relationships will be generated. The stacked and misplaced features need to be moved to inside-outside nested positions, while the positional relationship between the feature lines in each part (such as concave and convex) should not be changed excessively, so as to achieve the purpose of unlocking the stacked elements.
[0122] In some embodiments of the present invention, the feature positions in the initial window edge topological relationship are optimized based on coordinate scaling, including:
[0123] Assign different coordinate scaling factors to point 2D features and line 2D features;
[0124] The feature positions in the initial window edge topological relationship are scaled based on the coordinate scaling factor.
[0125] In the above embodiment, image coordinate scaling can realize image enlargement and reduction, which is essentially to enlarge or reduce the distance from the pixel to the origin along the positive direction of the x-axis and the y-axis to several times of the original. Scaling does not change the relative position relationship between the original pixels. Similarly, the scaling of the plane coordinates will not change the relative position relationship between the plane features. At the same time, the inside and outside of the nested relationship in the present invention are relative to a certain center point. The closer to the center is called the inside, and the opposite is called the outside. Therefore, the coordinate is enlarged based on the center point of the rectangular bounding box of the window feature line, so that all elements can maintain the relative position relationship unchanged as they move away from the center.
[0126] The coordinate scaling factor is a key parameter that determines the position of the feature line after scaling transformation. Therefore, the present invention assigns different coordinate scaling factors to elements at different distances from the plane, so that the features far from the wall (taking the concave window as an example) are magnified to a small extent and move away from the center slowly, while the features on the wall are magnified to a large extent and move away from the center quickly. Therefore, after a certain amount of magnification, the feature lines near the concave wall naturally fall inside the previous feature lines. At the same time, the coordinate scaling transformation can maintain the positional relationship between elements at the same distance from the wall.
[0127] Therefore, the distance from all point features (including the endpoints of the line) projected onto the plane to the facade plane is calculated, with those outside the wall as positive and those inside the wall as negative. The point with the shortest vertical distance (the point with the greatest degree of concavity) is found and its distance is used as the reference distance. The distance of all points minus the reference distance is taken as the coordinate scaling factor of each feature point. The original features can be enlarged based on this coordinate scaling factor to solve the problem of feature stacking and dislocation. This scaling method can effectively solve the problem of stacking and dislocation while maintaining the relative position relationship between features, optimize the feature positions in the initial window edge topological relationship, and establish an accurate topological relationship between two-dimensional features.
[0128] In order to better implement the window deformation repair method for the building facade in the embodiment of the present invention, based on the window deformation repair method for the building facade, correspondingly, please refer to Figure 7 , Figure 7 This is a schematic structural diagram of an embodiment of a window deformation repair device for a building facade provided by the present invention. The embodiment of the present invention provides a window deformation repair device 700 for a building facade, comprising:
[0129] A feature extraction module 701 is used to extract 3D straight line features and 3D point features of the window area based on the original image of the building facade and the initial model of the building facade;
[0130] A projection mapping module 702 is used to project the 3D straight line features and the 3D point features onto the plane where the facade is located to obtain 2D features, and obtain a 3D window model based on the 2D feature mapping;
[0131] The merging module 703 is used to merge the three-dimensional window model into the initial building facade model to repair the window deformation and obtain the building facade target model.
[0132] It should be noted here that: the device 700 provided in the above embodiment can implement the technical solutions described in the above method embodiments. The specific implementation principles of the above modules or units can refer to the corresponding contents in the above method embodiments, which will not be repeated here.
[0133] See also Figure 8 , Figure 8 A schematic diagram of the structure of a window deformation repair device for a building facade provided by an embodiment of the present invention. Based on the above-mentioned window deformation repair method for a building facade, the present invention also provides a window deformation repair device for a building facade, which can be a computing device such as a mobile terminal, a desktop computer, a notebook, a PDA, and a server. The window deformation repair device 800 for a building facade includes a processor 801, a memory 802, and a display 803. Figure 8 Only some components of the window deformation repair device for the building facade are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
[0134] In some embodiments, the memory 802 may be an internal storage unit of the window deformation repairing device 800 for a building facade, such as a hard disk or memory of the window deformation repairing device 800 for a building facade. In other embodiments, the memory 802 may also be an external storage device of the window deformation repairing device 800 for a building facade, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the window deformation repairing device 800 for a building facade. Further, the memory 802 may also include both an internal storage unit and an external storage device of the window deformation repairing device 800 for a building facade. The memory 802 is used to store application software and various data of the window deformation repairing device 800 installed on the building facade, such as a program code of the window deformation repairing device 800 installed on the building facade. The memory 802 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a window deformation repair program 804 for a building facade is stored in the memory 802 , and the window deformation repair program 804 for a building facade can be executed by the processor 801 , thereby implementing the window deformation repair method for a building facade of each embodiment of the present application.
[0135] In some embodiments, the processor 801 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 802, such as executing a method for repairing window deformation on a building facade.
[0136] In some embodiments, the display 803 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 803 is used to display information of the window deformation repairing device 800 on the building facade and to display a visual user interface. The components 801-803 of the window deformation repairing device 800 on the building facade communicate with each other through a system bus.
[0137] In one embodiment, when the processor 801 executes the window deformation repairing program 804 for the building facade in the memory 802 , the steps in the above method for repairing the window deformation of the building facade are implemented.
[0138] This embodiment further provides a computer-readable storage medium, on which a window deformation repair program for a building facade is stored. When the window deformation repair program for a building facade is executed by a processor, the following steps are implemented:
[0139] Extracting 3D straight line features and 3D point features of the window area based on the original image of the building facade and the initial model of the building facade;
[0140] Projecting the 3D straight line features and the 3D point features onto the plane where the facade is located to obtain 2D features, and obtaining a 3D window model based on the 2D feature mapping;
[0141] The three-dimensional window model is merged into the initial building facade model to repair the window deformation and obtain the building facade target model.
[0142] In summary, the present embodiment provides a method for repairing window deformation of a building facade, which determines the three-dimensional straight line features and three-dimensional point features of the window area from the original image of the building facade and the initial model of the building facade, determines the two-dimensional features of the window area based on the three-dimensional straight line features and the three-dimensional point features, reconstructs the window model through the two-dimensional feature mapping of the window area to obtain a three-dimensional window model, and then merges the three-dimensional window model into the initial model of the building facade to replace the deformed window area model in the initial model of the building facade, thereby realizing the repair of the window deformation in the initial model of the building facade, obtaining the target model of the building facade, and completely eliminating the problem of reduced geometric accuracy caused by the window deformation of the building facade model.
[0143] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0144] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for repairing window deformation on a building facade, characterized in that: include: Extracting 3D straight line features and 3D point features of the window area based on the original image of the building facade and the initial model of the building facade; Projecting the three-dimensional straight line features and the three-dimensional point features onto the plane where the facade is located to obtain two-dimensional features, and obtaining a three-dimensional window model based on the two-dimensional feature mapping; Merging the three-dimensional window model into the initial building facade model to repair the window deformation and obtain a building facade target model; The projecting of the three-dimensional straight line feature and the three-dimensional point feature onto the plane where the facade is located to obtain a two-dimensional feature, and obtaining a three-dimensional window model based on the two-dimensional feature mapping, comprises: Calculate the point two-dimensional features and line two-dimensional features of the three-dimensional straight line features and the three-dimensional point features on the plane where the facade is located according to the feature representation of the plane where the facade is located; Constructing an initial window edge line topological relationship according to the point two-dimensional features and the line two-dimensional features; Optimizing the feature positions in the initial window edge topological relationship based on coordinate scaling; The optimized initial window edge topological relationship is mapped to obtain a three-dimensional window model.
2. The method for repairing window deformation of a building facade according to claim 1, characterized in that: The method of extracting the three-dimensional straight line features of the window area according to the original image of the building facade and the initial model of the building facade includes: Extracting line segments from the window area in the original image of the building facade to obtain a two-dimensional simplified straight line of the window; Determine the main direction of the window and the image depth map according to the initial model of the building facade; Perform point sampling and back-projection on the two-dimensional simplified straight line of the window according to the image depth map to obtain three-dimensional straight line sampling points; The three-dimensional straight line sampling points are constrained according to the main direction of the window to determine the three-dimensional straight line features of the window area.
3. The method for repairing window deformation of a building facade according to claim 2, characterized in that: The extracting line segments from the window area in the original image of the building facade to obtain a two-dimensional simplified straight line of the window includes: Extracting a feature description vector of an initial straight line in a window area from the original image of the building facade; Performing mean shift clustering based on the feature description vector to obtain initial straight line clusters of multiple window areas; The straight lines in the initial straight line clusters of the plurality of window regions are optimized to obtain two-dimensional simplified straight lines of the windows.
4. The method for repairing window deformation of a building facade according to claim 1, characterized in that: The 3D point features of the window area are extracted based on the original image of the building facade and the initial model of the building facade, including: Determine the four corner points of the window according to the initial model of the building facade; Based on the four corner points of the windows, a plurality of independent window image blocks are obtained by cropping the original image of the building facade; Extracting and matching feature points of the plurality of independent window image blocks, and calculating feature point description vectors; The feature point description vector is subjected to multi-frame triangulation processing to extract three-dimensional point features of the window area.
5. The method for repairing window deformation of a building facade according to claim 4, characterized in that: The extracting and matching feature points of the plurality of independent window image blocks and calculating feature point description vectors include: Determine a window reference independent image block according to the number of valid pixels in each of the window independent image blocks; Aligning the feature points of the remaining window independent image blocks to the window reference independent image block, and then extracting and matching the feature points; The matched feature points are screened and the feature point description vectors are calculated.
6. The method for repairing window deformation of a building facade according to claim 1, characterized in that: The optimizing process of the feature position in the initial window edge topological relationship based on coordinate scaling includes: Assigning different coordinate scaling factors to the point two-dimensional features and the line two-dimensional features; The characteristic position in the initial window edge topological relationship is scaled based on the coordinate scaling factor.
7. A window deformation repair device for a building facade, characterized in that: include: A feature extraction module, used for extracting 3D straight line features and 3D point features of the window area according to the original image of the building facade and the initial model of the building facade; A projection mapping module, used for projecting the three-dimensional straight line features and the three-dimensional point features onto the plane where the facade is located to obtain two-dimensional features, and obtaining a three-dimensional window model based on the two-dimensional feature mapping; A merging module, used for merging the three-dimensional window model into the initial building facade model to repair the window deformation and obtain a building facade target model; The projecting of the three-dimensional straight line feature and the three-dimensional point feature onto the plane where the facade is located to obtain a two-dimensional feature, and obtaining a three-dimensional window model based on the two-dimensional feature mapping, comprises: Calculate the point two-dimensional features and line two-dimensional features of the three-dimensional straight line features and the three-dimensional point features on the plane where the facade is located according to the feature representation of the plane where the facade is located; Constructing an initial window edge line topological relationship according to the point two-dimensional features and the line two-dimensional features; Optimizing the feature positions in the initial window edge topological relationship based on coordinate scaling; The optimized initial window edge topological relationship is mapped to obtain a three-dimensional window model.
8. A device for repairing window deformation on a building facade, characterized in that: comprising a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the method for repairing window deformation of a building facade as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: Used to store computer-readable programs or instructions, which, when executed by a processor, can implement the steps of the method for repairing window deformation on a building facade as described in any one of claims 1 to 6.
