A municipal engineering surveying and mapping device and a surveying and mapping method
By threshold segmentation, merging the connection domain and region division of municipal engineering images, and combining the method of feature point matching calculation, the problem of inaccurate image matching in municipal engineering surveying and mapping is solved, and the splicing quality and accuracy are improved.
Patent Information
- Application Number
- CN202510214299.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2045-02-26
AI Technical Summary
In the process of municipal engineering surveying and mapping planning, image matching only through feature points may lead to inaccurate matching, affecting the stitching quality and accuracy of the overall image.
By performing threshold segmentation on the original municipal image, the segmented connective domains are obtained; the connected domains are merged according to shape similarity and position consistency; the regions are divided by analyzing the extension of the edges of the merged connective domains; the characteristic points of each region are determined, the matching degree between regions is calculated to determine the overlapping area, and image stitching is performed.
It improves the quality and accuracy of image stitching, and ensures the accuracy and reliability of municipal engineering surveying and mapping.
Smart Images

Figure CN119737929B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of municipal surveys, and particularly to a surveying and mapping device and method for municipal engineering. Background Art
[0002] In the surveying and mapping planning process of municipal engineering, drone technology is usually used to capture detailed images of the city. This method can provide high-resolution aerial images and videos to help engineers obtain accurate geographical information and urban layouts. Drones usually automatically take a series of images at set intervals to ensure that the captured area is fully covered. These images may have overlapping parts due to different shooting positions and angles.
[0003] Currently, the method for identifying overlapping parts of images usually analyzes feature points in the images and performs feature matching based on a single feature point to obtain the overlapping area between two images. However, the buildings in an area of the city may be similar, so image matching only based on feature points may lead to inaccurate matching, thus affecting the overall image stitching quality and accuracy. Summary of the Invention
[0004] The present invention provides a surveying and mapping device and method for municipal engineering to overcome the problem in the surveying and mapping planning process of the above-mentioned prior art that image matching only based on feature points may lead to inaccurate matching, thus affecting the overall image stitching quality and accuracy.
[0005] To solve the above technical problems, the technical solution adopted by the present invention is:
[0006] A surveying and mapping method for municipal engineering, the method comprising the following steps:
[0007] Obtain an original municipal image and an overlapping image with a partially overlapping area;
[0008] Perform threshold segmentation processing on the original municipal image to obtain all connected components in the segmented municipal image;
[0009] Merge neighboring connected components according to the shape similarity and position consistency between the current connected component and neighboring connected components in the original municipal image to obtain merged connected components;
[0010] Divide the original municipal image into several regions according to the extensibility of the edges of the merged connected components;
[0011] Determine the feature points of each connected component in each region, and calculate the matching degree between the regions in the original municipal image and the regions in the overlapping image according to the feature points of each connected component in the region and the number of connected components;
[0012] Determine the overlapping area between the original municipal image and the overlapping image through the matching degree, and splice the original municipal image and the overlapping image according to the overlapping area, thereby completing the surveying and mapping of municipal engineering.
[0013] Preferably, perform threshold segmentation processing on the original municipal image, including:
[0014] Obtain the original municipal image, and the original municipal image is an RGB image;
[0015] Convert the original municipal image into a grayscale image, use Gaussian filtering to remove the noise points in the original municipal image, and use Otsu threshold segmentation to perform threshold segmentation on the denoised municipal image to obtain the segmented municipal image.
[0016] Furthermore, obtain all connected components in the segmented municipal image, including:
[0017] Obtain all connected components in the segmented municipal image, perform connected component labeling on the segmented municipal image. Specifically, for each pixel in the segmented municipal image, check whether it belongs to a connected component, starting from the upper left corner, and check row by row and column by column; for pixels with a labeling value of 1, use the depth-first search method to find all pixels with a connected labeling value of 1 and assign a unique label to obtain all connected components in the segmented municipal image.
[0018] Preferably, merge the neighboring connected components according to the shape similarity and position consistency between the current connected component and the neighboring connected components in the original municipal image to obtain the merged connected components, including:
[0019] Obtain multiple neighboring connected components of the current connected component;
[0020] According to the differences in area, perimeter, and number of corner points between the current connected component and the neighboring connected components, calculate the shape similarity between the current connected component and the neighboring connected components;
[0021] Calculate the position consistency between the current connected component and the neighboring connected components;
[0022] According to the obtained shape similarity and position consistency, calculate the possibility that the neighboring connected component and the current connected component belong to the same region;
[0023] When the possibility that the neighboring connected component and the current connected component belong to the same region is greater than or equal to the preset region threshold, it is considered that the neighboring connected component and the current connected component belong to the same region, and thus the neighboring connected component and the current connected component are merged to obtain the merged connected components.
[0024] Furthermore, calculate the position consistency between the current connected component and the neighboring connected components, including:
[0025] For each neighborhood connected component, obtain N connected components in the direction of the current connected component as reference connected components;
[0026] Extract the skeletons of the neighborhood connected component, the current connected component, and the reference connected components. Perform linear fitting on the extracted skeletons of all connected components using the least squares method so that the skeletons form a straight line;
[0027] Obtain the angle between the skeleton extension line of the neighborhood connected component and the current connected component;
[0028] Calculate the interval distance and angle between adjacent reference connected components;
[0029] Calculate the mean value of the interval distances between adjacent reference connected components according to the interval distances between adjacent reference connected components;
[0030] Obtain the distance between the neighborhood connected component and the current connected component;
[0031] Based on the angle between the skeleton extension line of the neighborhood connected component and the current connected component, the mean value of the interval distances between adjacent reference connected components, the angle between adjacent reference connected components, and the distance between the neighborhood connected component and the current connected component, calculate the position consistency between the current connected component and the neighborhood connected component.
[0032] Preferably, perform regional division on the original municipal image according to the extensibility of the merged connected component edges to obtain several regions, including:
[0033] Obtain the merged connected component edge, and the merged connected component edge represents the minimum perimeter including the current connected component and the neighborhood connected component;
[0034] Perform edge detection on the external neighborhood of the merged connected component through an edge detection algorithm, obtain the length of each edge, and filter out the edges whose length is greater than or equal to a preset length threshold;
[0035] Calculate the possibility that the current edge belongs to a road edge through the extensibility of the edge;
[0036] Normalize the possibility that the edge belongs to a road edge, and use the edges whose normalized possibility is greater than or equal to a preset edge threshold as road edges;
[0037] According to the shape similarity and position consistency between the current connected component and the neighborhood connected component, merge the neighborhood connected components on the same side of the road edge to obtain a merged connected component; the merged connected component forms a region, and the connected components within the region are all similar.
[0038] Furthermore, calculating the possibility that the current edge belongs to a road edge through the extensibility of the edge includes:
[0039] The least squares method is used to linearly fit the edge, obtain the extension direction of the edge, and obtain the reference edge of the edge in the extension direction;
[0040] According to the distance between the edge points at the ends of two adjacent edges obtained, the distance between the edge point at the end of the current edge and the edge point at the end of a certain reference edge, the distances of the pixel points of the current edge before and after linear fitting, the length of the current edge, and the number of reference edge lines, the possibility that the current edge is a road edge is calculated.
[0041] Preferably, the characteristic points of each connected component in each region are determined, including:
[0042] Any point in the connected component in the region is used as the starting point, each point on the edge is patrolled, the direction of the subsequent point relative to the current point is recorded, and the relative direction vector is converted into a specific value;
[0043] The derivative chain code of the original chain code is obtained; the derivative refers to the difference between the previous chain code and the next chain code, and is measured in multiples of a 45° counterclockwise rotation;
[0044] The pixel points with a derivative of 0 are removed, and the selected pixel points obtained thereby all have a change in the direction angle;
[0045] When the number of pixel points between the selected pixel point and the next selected pixel point is greater than or equal to the preset pixel point number threshold, multiple selected pixel points greater than or equal to the preset pixel point number threshold are selected as the characteristic points of the connected component;
[0046] Thus, the characteristic points of each connected component in the region are obtained.
[0047] Preferably, according to the characteristic points of each connected component in the region and the number of connected components, the matching degree between the region in the original municipal image and the region in the overlapping image is calculated, including:
[0048] Obtain the sum of the interior angles of the characteristic points of the connected component of a certain region in the original municipal image;
[0049] Obtain the sum of the interior angles of the characteristic points of the connected component of a certain region in the overlapping image;
[0050] The sum of the interior angles is obtained through the following steps: obtain the distances between the characteristic points in the connected component and the two adjacent characteristic points respectively and the distance between the two adjacent characteristic points is ; draw a perpendicular line h perpendicular to the line segment c, and calculate the interior angle of the characteristic point through arcsine; thus, a sequence of interior angles of the characteristic points formed by connecting all the characteristic points is obtained, and the angles in the sequence of interior angles of the characteristic points are added to obtain the sum of the interior angles between the characteristic points on a connected component ;
[0051] Obtain the number of connected components in a certain area of the original municipal image;
[0052] Obtain the number of connected components in a certain area of the overlapping image;
[0053] Calculate the matching degree between the area in the original municipal image and the area in the overlapping image based on the sum of interior angles of the characteristic points of the connected components in a certain area of the original municipal image, the sum of interior angles of the characteristic points of the connected components in a certain area of the overlapping image, the number of connected components in a certain area of the original municipal image, and the number of connected components in a certain area of the overlapping image.
[0054] A municipal engineering surveying and mapping device, comprising:
[0055] An image acquisition module for acquiring the original municipal image and an overlapping image with a partially overlapping area;
[0056] A preprocessing module for performing threshold segmentation processing on the original municipal image to obtain all connected components in the segmented municipal image;
[0057] A merging module for merging adjacent connected components according to the shape similarity and position consistency between the current connected component and the adjacent connected component in the original municipal image to obtain merged connected components;
[0058] A region division module for dividing the original municipal image according to the extensibility of the edge of the merged connected components to obtain several regions;
[0059] A matching degree calculation module for determining the characteristic points of each connected component in each region, and calculating the matching degree between the region in the original municipal image and the region in the overlapping image according to the characteristic points of each connected component in the region and the number of connected components;
[0060] An image stitching module for determining the overlapping area of the original municipal image and the overlapping image through the matching degree, and stitching the original municipal image and the overlapping image according to the overlapping area, thereby completing the municipal engineering surveying and mapping.
[0061] Compared with the prior art, the beneficial effects of the present invention are:
[0062] The present invention performs threshold segmentation processing on the acquired original municipal image to obtain all connected components in the segmented municipal image; merges the neighboring connected components based on the shape similarity and position consistency between the current connected component and the neighboring connected components in the original municipal image to obtain merged connected components; divides the original municipal image according to the extensibility of the edges of the merged connected components to obtain several regions; determines the characteristic points of each connected component in each region, and calculates the matching degree between the regions in the original municipal image and the regions in the overlapping image according to the characteristic points of each connected component in the region and the number of connected components; determines the overlapping region between the original municipal image and the overlapping image through the matching degree, and splices the original municipal image and the overlapping image according to the overlapping region, thereby completing the surveying and mapping of municipal engineering.
[0063] The distribution of buildings in a region of the original municipal image is regular. The region is divided according to the location distribution characteristics of buildings in the city, and the overlapping region is determined through the matching degree between regions. Finally, the original municipal image and the overlapping image are spliced through the overlapping region.
[0064] The present invention merges the neighboring connected components based on the shape similarity and position consistency between the neighboring connected components and the current connected component, and screens the buildings on the opposite sides of the road by analyzing the extensibility of the edges of the merged connected components, so that the buildings with similarity are distributed in the same region, achieving the purpose of regional division. Brief Description of the Drawings
[0065] Figure 1 is a flowchart of the steps of a method for surveying and mapping municipal engineering according to the present invention;
[0066] Figure 2 is a schematic diagram of the edge of the merged connected component according to the present invention;
[0067] Figure 3 is a principle block diagram of a device for surveying and mapping municipal engineering according to the present invention. Detailed Description of the Embodiments
[0068] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention. The present invention will be described in detail below in conjunction with the drawings and specific embodiments.
[0069] It should be understood that when used in this specification, the terms "comprises" and "comprising" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0070] It should also be understood that the terms used in the specification of the present invention are merely for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include the plural forms.
[0071] It should be further understood that the term "and / or" used in the specification of the present invention refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0072] Embodiment 1
[0073] As Figure 1 shown, a method for surveying and mapping of municipal engineering, the method comprising the following steps:
[0074] Obtain an original municipal image and an overlapping image with a partially overlapping area;
[0075] Perform threshold segmentation processing on the original municipal image to obtain all connected components in the segmented municipal image;
[0076] Merge the neighboring connected components according to the shape similarity and position consistency between the current connected component and the neighboring connected components in the original municipal image to obtain merged connected components;
[0077] Perform regional division on the original municipal image according to the extensibility of the edge of the merged connected components to obtain several regions;
[0078] Determine the feature points of each connected component in each region, and calculate the matching degree between the region in the original municipal image and the region in the overlapping image according to the feature points of each connected component in the region and the number of connected components;
[0079] Determine the overlapping area between the original municipal image and the overlapping image through the matching degree, and splice the original municipal image and the overlapping image according to the overlapping area, thereby completing the surveying and mapping of municipal engineering.
[0080] The distribution of buildings in a region of the original municipal image has regularity. Regional division is performed according to the location distribution characteristics of buildings in the city, and the overlapping area is determined through the matching degree between regions. Finally, the original municipal image and the overlapping image are spliced through the overlapping area.
[0081] The present invention merges the neighboring connected components according to the shape similarity and position consistency between the neighboring connected components and the current connected component, and screens the buildings on the opposite sides of the road by analyzing the extensibility of the edge of the merged connected components, so that the buildings with similarity are distributed in the same area, achieving the purpose of regional division.
[0082] In a specific embodiment, threshold segmentation processing is performed on the original municipal image, including:
[0083] Obtain the original municipal image, where the original municipal image is an RGB image;
[0084] Convert the original municipal image into a grayscale image, use Gaussian filtering to remove the noise points in the original municipal image, and use Otsu threshold segmentation to perform threshold segmentation on the denoised municipal image to obtain the segmented municipal image.
[0085] In a specific embodiment, obtaining all connected components in the segmented municipal image includes:
[0086] Perform connected component labeling on the segmented municipal image. Specifically, for each pixel in the segmented municipal image, check whether it belongs to a connected component, starting from the upper left corner and checking row by row and column by column; for a pixel with a label value of 1, if a pixel with a label value of 1 is encountered, use the depth-first search method to find all pixels with a connected label value of 1 and assign a unique label to obtain all connected components in the segmented municipal image.
[0087] In a specific embodiment, buildings, gardens, etc. in the city are regularly distributed in an area. Therefore, according to the shape similarity and position consistency of the neighborhood connected components, the neighborhood connected components are merged, and then the original municipal image can be regionally divided by analyzing the extensibility of the edges of the merged connected components.
[0088] When office buildings and industrial parks in the city are being built, their appearances need to be kept consistent. A unified exterior design can enhance the overall aesthetics of the area; for the buildings in the community in the city, in order to ensure good ventilation and lighting conditions for each household, the building spacing between each building is consistent, so that the buildings have sufficient air circulation and sunlight. Therefore, by analyzing the shape similarity and position consistency between the neighborhood connected component and the current connected component, the similarity between the neighborhood connected component and the current connected component can be determined, and the neighborhood connected component can be merged according to the shape similarity and position consistency.
[0089] In this embodiment, merging the neighborhood connected component according to the shape similarity and position consistency between the current connected component and the neighborhood connected component in the original municipal image to obtain the merged connected component includes:
[0090] Obtain multiple neighborhood connected components of the current connected component;
[0091] According to the differences in area, perimeter, and number of corner points between the current connected component and the neighborhood connected component, calculate the shape similarity between the current connected component and the neighborhood connected component;
[0092] Calculate the position consistency between the current connected component and the neighborhood connected component;
[0093] Calculate the possibility that the neighborhood connected component and the current connected component belong to the same region based on the obtained shape similarity and position consistency;
[0094] When the possibility that the neighborhood connected component and the current connected component belong to the same region is greater than or equal to the preset region threshold, it is considered that the neighborhood connected component and the current connected component belong to the same region, and thus the neighborhood connected component and the current connected component are merged to obtain the merged connected component.
[0095] In this embodiment, calculate the shape similarity between the current connected component and the neighborhood connected component according to the differences in area, perimeter, and number of corner points between the current connected component and the neighborhood connected component, as follows:
[0096] If the shapes of two connected components are similar, it means that their areas and perimeters are the same, and at the same time, the number of corner points of their connected components is the same; therefore, the similarity of the connected components is represented by the perimeter, area, and number of corner points of the neighborhood connected component and the current connected component. Calculate the neighborhood connected component and the current connected component The calculation formula for the shape similarity is as follows:
[0097] ;
[0098] In the formula: represents the neighborhood connected component; represents the current connected component; represents the area of the neighborhood connected component; represents the area of the current connected component; represents the number of corner points of the neighborhood connected component; represents the number of corner points of the current connected component, where the corner points can be obtained through the Harris corner detector; represents the perimeter of the neighborhood connected component; represents the perimeter of the current connected component; The difference in area between the neighborhood connected component and the current connected component; represents the difference in perimeter between the neighborhood connected component and the current connected component; represents the difference in the number of corner points between the neighborhood connected component and the current connected component. The larger, the greater the shape similarity between the neighborhood connected component and the current connected component .
[0099] In this embodiment, calculating the position consistency between the current connected component and the neighborhood connected component includes:
[0100] For each neighborhood connected component, obtain N connected components in the direction of the current connected component as reference connected components;
[0101] Extract the skeletons of the neighborhood connected component, the current connected component, and the reference connected component, and perform linear fitting on the skeletons of all connected components using the least squares method to make the skeletons form a straight line;
[0102] Obtain the angle between the skeleton extension line of the neighborhood connected component and the current connected component;
[0103] Calculate the interval distance and angle between adjacent reference connected components;
[0104] Calculate the mean value of the interval distances between adjacent reference connected components according to the interval distances between adjacent reference connected components;
[0105] Obtain the distance between the neighborhood connected component and the current connected component;
[0106] Based on the angle between the skeleton extension lines of the neighborhood connected component and the current connected component, the mean value of the interval distances between adjacent reference connected components, the angle between adjacent reference connected components, and the distance between the neighborhood connected component and the current connected component, calculate the position consistency between the current connected component and the neighborhood connected component.
[0107] In this embodiment, when the distances between buildings are more consistent and the building structures are aligned, it indicates that the position consistency between buildings is stronger. Therefore, the position consistency between the neighborhood connected component and the current connected component can be calculated through the distance between them, the consistency of the distances in the same direction, and the alignment degree (the angle of the extension line) between the neighborhood connected component and the current connected component. The specific process is as follows:
[0108] Obtain the reference connected components in the same direction. For the neighborhood connected component , obtain N = 3 connected components in the direction of the current connected component as the reference connected components .
[0109] Perform linear fitting on all connected components. For the neighborhood connected component , the current connected component i, and the obtained reference connected components , use the zhang-suen algorithm to extract the skeletons of the connected components. The zhang-suen algorithm is a well-known technology and will not be elaborated here. Perform linear fitting on the skeletons of all connected components using the least squares method to make the skeletons form a straight line for subsequent distance calculation.
[0110] At this time, through the distance between the reference connected components , the consistency with the distance between the neighborhood connected component and the current connected component, and the neighborhood connected component Calculate the consistency of the distributions of the alignment degree (the angle between the extension lines) with the current connected component. At this time, the more consistent the above distances are and the smaller the angle is, the more consistent the positions are between the neighborhood connected component and the current connected component. Calculate the position consistency between the neighborhood connected component and the current connected component. The formula is as follows:
[0111] ;
[0112] In the formula, represents the position where the reference connected component is located. represents the position where the reference connected component is located. represents the interval distance between adjacent reference connected components; To make the denominator non-zero; represents normalization; represents the angle between adjacent reference connected components; represents the weight of the interval distance between adjacent reference connected components. The smaller it is, the greater the weight of the current adjacent reference connected component interval distance; represents the mean value of the interval distances between adjacent reference connected components; represents the neighborhood connected component and the interval distance from the current connected component i; The smaller it is, the more consistent the interval distance between the neighborhood connected component and the current connected component is with the interval distance between the reference connected component ; represents the angle between the extension lines of the neighborhood connected component and the current connected component after extracting the skeleton. The smaller it is, the greater the alignment degree between the neighborhood connected component and the current connected component, that is, the more parallel their distribution geographical positions are.
[0113] When the possibility that the neighborhood connected component and the current connected component belong to the same region is greater than or equal to the preset region threshold, it is considered that the neighborhood connected component and the current connected component belong to the same region. Thus, the neighborhood connected component and the current connected component are merged to obtain the merged connected component, as follows:
[0114] According to the shape similarity between the obtained neighborhood connected component and the position consistency with the current connected component i , determine whether the neighborhood connected component , The larger they are, the more likely it is that the neighborhood connected component The more likely it is that the neighboring connected component belongs to the same region as the current connected component i; neighboring connected components The probability that the neighboring connected component belongs to the same region as the current connected component i . Set a regional threshold , when the neighboring connected component The probability that the neighboring connected component belongs to the same region as the current connected component i is greater than or equal to the preset regional threshold , it is considered that the neighboring connected component and the current connected component belong to the same region, that is, they are in the same region, and then the neighboring connected component and the current connected component are merged to obtain a merged connected component.
[0115] In a specific embodiment, the above-mentioned merging of adjacent similar buildings is performed. However, for some regions, the distribution shapes and positions of the buildings are similar. But they are separated by a road. At this time, they should not belong to the same region. Therefore, the original municipal image is regionally divided by the extensibility of the edges around the merged connected component.
[0116] The original municipal image is regionally divided according to the extensibility of the edge of the merged connected component, and several regions are obtained, including:
[0117] Obtain the edge of the merged connected component, and the edge of the merged connected component represents the minimum perimeter including the current connected component and the neighboring connected component, as Figure 2 shown;
[0118] Perform edge detection on the external neighborhood of the merged connected component through an edge detection algorithm, obtain the length of each edge, and filter out the edges whose length is greater than or equal to the preset length threshold;
[0119] In this embodiment, obtain the edges around the merged connected component, and the canny edge detection algorithm can be used to perform edge detection on the external neighborhood of the merged connected component. Filter out some edges that may be roads through the length of the edges, obtain the length of each edge, and set a threshold (the length is 10), so as to filter out the edges whose length is greater than or equal to the preset length threshold.
[0120] Calculate the probability that the current edge belongs to the road edge through the extensibility of the edge;
[0121] Normalize the probability that the current edge belongs to the road edge, and use the current edge whose normalized probability is greater than or equal to the preset edge threshold as the road edge;
[0122] According to the shape similarity and position consistency between the current connected component and the neighboring connected component, merge the neighboring connected components on the same side of the road edge to obtain a merged connected component; the merged connected component forms a region, and the connected components within the region are all similar.
[0123] In this embodiment, the possibility that the current edge belongs to a road edge is calculated through the extensibility of the edge, including:
[0124] The least squares method is used to linearly fit the edge to obtain the extension direction of the edge, and a reference edge of the edge is obtained in the extension direction;
[0125] According to the distance between the edge points at the ends of two adjacent edges obtained, the distance between the edge point at the end of the current edge and the edge point at the end of a certain reference edge, the distances of the pixel points of the current edge before and after linear fitting, the length of the current edge, and the number of reference edge lines, the possibility that the edge is a road edge is calculated.
[0126] In this embodiment, roads in the city generally extend along each direction, which is manifested as a continuously extending straight line in the edge. Therefore, the possibility that the current edge belongs to a road edge can be calculated through the extensibility of the edge.
[0127] Specifically, the least squares method is used to linearly fit the edge w to obtain the extension direction of the edge, and a reference edge of the edge is obtained in the extension direction. If the reference edge has a smaller interval from the neighboring edge, that is, stronger continuity, and the longer the current edge is and the more it presents a straight line, that is, the more the current edge extends, the greater the possibility that it belongs to a road edge; calculate the possibility that the current edge belongs to a road edge, and its formula is as follows:
[0128] ;
[0129] In the formula: w represents the current edge; represents the distance between the edge points at the ends of two adjacent edges; represents the distance between the edge point at the end of the current edge w and the edge point at the end of the (m - 1)-th reference edge, that is, the weight of the edge continuity. The closer it is to the current edge, the higher the reference edge continuity weight; represents the ordinates of k pixel points of the current edge w before linear fitting, represents the ordinate of the k-th pixel point of the current edge w after linear fitting; represents the distance between the k pixel points of the current edge w before linear fitting and the k-th pixel point of the current edge w after linear fitting; it should be noted that the abscissas of the k pixel points of the current edge w before linear fitting are the same as those of the k-th pixel point of the current edge w after linear fitting; T represents the length of the current edge, that is, the number of pixel points; represents the number of reference edges; The smaller it is, the more the current edge presents a straight line; The smaller it is, the longer the length of the current edge is; exp (-) represents an exponential function with a natural constant as the base, which is used to realize the normalization processing of negative correlation of data; at this time The larger the value, the more likely the current edge w is to belong to the road.
[0130] In this embodiment, the area is divided as follows: an edge threshold is set , the possibility of belonging to the edge of the road Greater than or equal to The current edge of the current connected domain is taken as the road edge. When obtaining the neighboring connected domain of the current connected domain, the neighboring connected domain on the opposite side of the road edge is not merged, that is, the connected domain on the opposite side of the road edge is no longer considered (the opposite side is not on the same side of the road edge as the merged connected domain). Finally, when the merged connected domain has no similar connected domain to merge, the merged connected domain at this time can form a region, and the connected domains in the region are similar.
[0131] In a specific embodiment, in order to analyze the structural similarity between regions, it is necessary to first determine the feature points that make the edges have obvious changes or mutations, and then determine the similarity between regions through the consistency of the feature points and the matching points. The present invention determines the feature points in the region by analyzing the turning points or direction change points in the chain code sequence.
[0132] This embodiment determines the characteristic points of each connected domain in each region, including:
[0133] Take any point in the connected domain of the region as the starting point, patrol each point on the edge, record the direction of the subsequent points relative to the current one, and convert the relative direction into a specific value;
[0134] In order to find the characteristic points on the edge, that is, the magnitude of the directional change of adjacent elements; obtain the derivative chain code of the original chain code; the derivative refers to the difference between the previous chain code and the next one, measured in multiples of 45° counterclockwise rotation;
[0135] At this time, the connected domain pixels with a derivative of 0 do not have a change in direction, so the pixels with a derivative of 0 are removed, and the selected pixels thus obtained all have a change in direction angle. The more intervals there are between a selected point and the next selected point, the more likely it is to be a feature point; therefore, the number of pixels between each selected point and the next selected point is used as the basis for whether to select it as a feature point;
[0136] When the number of pixels between the selected pixel and the next selected pixel is greater than or equal to the preset pixel number threshold ( ), selecting a plurality of selected pixels greater than or equal to a preset pixel number threshold as feature points of the connected domain;
[0137] In this way, the characteristic points of each connected component in the region are obtained.
[0138] In a specific embodiment, calculating the matching degree between the region in the original municipal image and the region in the overlapping image according to the characteristic points of each connected component in the region and the number of connected components includes:
[0139] Obtaining the sum of interior angles of the characteristic points of the connected component of a certain region in the original municipal image;
[0140] Obtaining the sum of interior angles of the characteristic points of the connected component of a certain region in the overlapping image;
[0141] The sum of interior angles is obtained through the following steps: obtaining the distances between the characteristic points in the connected component and the two adjacent characteristic points respectively , and the distance between two adjacent characteristic points is ; making a perpendicular line h to the line segment c, and calculating the interior angle of the characteristic point through arcsine; thus obtaining a sequence of interior angles of the characteristic points formed by connecting all the characteristic points, and adding the angles in the sequence of interior angles of the characteristic points to obtain the sum of interior angles between the characteristic points on a connected component ;
[0142] Obtaining the number of connected components of the connected component of a certain region in the original municipal image;
[0143] Obtaining the number of connected components of the connected component of a certain region in the overlapping image;
[0144] Calculating the matching degree between the region in the original municipal image and the region in the overlapping image according to the sum of interior angles of the characteristic points of the connected component of a certain region in the original municipal image, the sum of interior angles of the characteristic points of the connected component of a certain region in the overlapping image, the number of connected components of the connected component of a certain region in the original municipal image, and the number of connected components of the connected component of a certain region in the overlapping image.
[0145] In this embodiment, if a certain region in one image is similar to a certain region in another image, that is, the number of connected components between the two is the same, and the shapes of the corresponding connected components are also the same, the similarity of the shapes of the connected components is determined by the sum of interior angles between the characteristic points in the connected component. The specific calculation of the angles of the characteristic points in the connected component is as follows: recording the distances between the characteristic point and the two adjacent characteristic points , and connecting the two adjacent characteristic points with a distance of , making a perpendicular line h to the line segment c, and calculating the interior angle of the characteristic point through arcsine. At this time, a sequence of interior angles of the characteristic points formed by connecting all the characteristic points can be obtained, and adding the angles in the sequence can obtain the sum of interior angles between the characteristic points on a connected component .
[0146] This embodiment provides a calculation formula for calculating the matching degree between region p in the original municipal image and region q in the overlapping image, as follows:
[0147] ;
[0148] Wherein: represents the sum of interior angles of the e-th connected domain feature point of region p in the original municipal image; represents the sum of interior angles of the f-th connected domain feature point of region q in the overlapping image; represents the minimum difference between the sum of interior angles of the connected domain feature point e in region p and the connected domain feature point f in region q; The smaller it is, the stronger the morphological similarity of the connected domains between region p and region q; represents the number of connected domains of region p in the original municipal image, represents the number of connected domains of region q in the overlapping image, The smaller it is, the more consistent the number of connected domains between region p and region q. is the matching degree between region p in the original municipal image and region q in the overlapping image; represents the number of connected domain feature points of region p in the original municipal image.
[0149] In this embodiment, the overlapping region of the image is determined according to the matching degree between regions, as follows:
[0150] The matching degree between each region in the original municipal image and the region in the overlapping image is calculated , at this time The larger it is, the higher the matching degree between region p in the original municipal image and region q in the overlapping image. Set the threshold , for example, take the value of 0.7, and obtain greater than or equal to for regions p and q, then these are the overlapping regions of the municipal image.
[0151] According to the overlapping regions of the original municipal image and the overlapping image obtained above, the original municipal image and the overlapping image are spliced according to the overlapping regions, thereby completing the surveying and mapping of the municipal project. By performing regional matching after dividing the image into regions, the quality and accuracy of the splicing of the two images can be improved.
[0152] Among them, image splicing generally includes several steps: Feature Extraction, Image Registration, Warping, and Blending. The detailed implementation process of image splicing is prior art and is not within the scope of protection of the present invention, so it will not be elaborated in detail here.
[0153] Among them, feature extraction is to extract feature points in the overlapping area from the images to be stitched (original municipal images, overlapping images). Feature points can be significant points such as corner points, edges, textures, etc. Commonly used feature detectors include SlFT (Scale-Invariant Feature Transform), SURF (Speeded Up Robust Features), and ORB (Oriented FAST and Rotated BRIEF), etc.
[0154] Image registration is to establish a correspondence between the images to be stitched. By calculating the similarity measure of the feature points in the images to be stitched, corresponding feature point pairs can be found. Commonly used feature matching algorithms include brute-force matching algorithm, FLANN (Fast Library for Approximate Nearest Neighbors) algorithm, and BM (Brute-Force Matcher) algorithm, etc. These algorithms can match feature point pairs according to the similarity between feature descriptors.
[0155] Image warping is to align the images to be stitched so that they can be stitched together seamlessly. By estimating the geometric transformation relationship between adjacent images, their relative positions and poses can be determined. Commonly used geometric transformations include translation, rotation, scaling, and affine, etc. When determining the geometric transformation, an optimization algorithm needs to be used to minimize the transformation parameters in order to obtain the best stitching effect.
[0156] Image fusion is to fuse the stitched images into a complete image. During the image fusion process, the transition and fusion effects between different images need to be considered to avoid obvious stitching marks. Commonly used image fusion methods include pixel-level fusion, feature-level fusion, and decision-level fusion, etc. According to the specific application scenarios and requirements, a suitable fusion method can be selected.
[0157] Embodiment 2
[0158] Based on the municipal engineering surveying and mapping method described in Embodiment 1, this example also provides a municipal engineering surveying and mapping device, as Figure 3 shown, including:
[0159] An image acquisition module, configured to acquire an original municipal image and an overlapping image with a partially overlapping area;
[0160] A preprocessing module, configured to perform threshold segmentation processing on the original municipal image to obtain all connected components in the segmented municipal image;
[0161] A merging module, configured to merge adjacent connected components based on the shape similarity and position consistency between the current connected component and the adjacent connected components in the original municipal image to obtain merged connected components;
[0162] A region division module, configured to divide the original municipal image based on the extensibility of the edges of the merged connected components to obtain several regions;
[0163] A matching degree calculation module, configured to determine the feature points of each connected component in each region, and calculate the matching degree between the region in the original municipal image and the region in the overlapping image according to the feature points of each connected component in the region and the number of connected components;
[0164] An image stitching module, configured to determine the overlapping region between the original municipal image and the overlapping image through the matching degree, and stitch the original municipal image and the overlapping image according to the overlapping region, thereby completing the surveying and mapping of municipal engineering.
[0165] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, rather than limiting the implementation manners of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A municipal engineering surveying and mapping method, characterized in that: The method comprises the following steps: Obtaining an original municipal image and an overlapping image having a partial overlapping area; Perform threshold segmentation on the original municipal image to obtain all connected domains in the segmented municipal image; According to the shape similarity and position consistency between the current connected domain and the neighboring connected domain in the original municipal image, the neighboring connected domains are merged to obtain a merged connected domain; The original municipal image is divided into regions according to the extension of the edge of the merged connected domain to obtain several regions; Determine the characteristic points of each connected domain in each area, and calculate the matching degree between the area in the original municipal image and the area in the overlapping image according to the characteristic points of each connected domain in the area and the number of connected domains; The overlapping area between the original municipal image and the overlapping image is determined by the matching degree, and the original municipal image and the overlapping image are spliced according to the overlapping area, thereby completing the municipal engineering surveying and mapping.
2. The municipal engineering surveying and mapping method according to claim 1, characterized in that: Perform threshold segmentation on the original municipal image, including: Acquire an original municipal image, where the original municipal image is an RGB image; The original municipal image is converted into a grayscale image, and Gaussian filtering is used to remove noise points in the original municipal image. The denoised municipal image is threshold segmented using Otsu threshold segmentation to obtain the segmented municipal image.
3. The municipal engineering surveying and mapping method according to claim 2, characterized in that: Get all connected domains in the segmented municipal image, including: The connected domains of the segmented municipal image are marked. Specifically, each pixel in the segmented municipal image is checked to see whether it belongs to a connected domain. The check is performed row by row and column by column starting from the upper left corner. For pixels with a mark value of 1, a depth-first search method is used to find all pixels with a connected mark value of 1, and a unique label is assigned to obtain all connected domains in the segmented municipal image.
4. The municipal engineering surveying and mapping method according to claim 1, characterized in that: According to the shape similarity and position consistency between the current connected domain and the neighboring connected domain in the original municipal image, the neighboring connected domains are merged to obtain a merged connected domain, including: Get multiple neighboring connected domains of the current connected domain; Calculate the shape similarity between the current connected domain and the neighboring connected domain according to the difference in area, perimeter, and number of corner points between the current connected domain and the neighboring connected domain; Calculate the position consistency between the current connected domain and the neighboring connected domain; According to the obtained shape similarity and position consistency, the possibility that the neighboring connected domain and the current connected domain belong to the same region is calculated; When the possibility that the neighboring connected domain and the current connected domain belong to the same area is greater than or equal to a preset area threshold, the neighboring connected domain and the current connected domain are considered to belong to the same area, and the neighboring connected domain and the current connected domain are merged to obtain a merged connected domain.
5. The municipal engineering surveying and mapping method according to claim 4, characterized in that: Calculate the position consistency between the current connected domain and the neighboring connected domain, including: For each neighborhood connected domain, obtain its N connected domains in the direction of the current connected domain as reference connected domains; Extract the skeletons of the neighboring connected domain, the current connected domain and the reference connected domain, and use the least square method to perform linear fitting on the skeletons extracted from all connected domains so that the skeletons form a straight line; Get the angle between the neighboring connected domain and the skeleton extension line of the current connected domain; Calculate the interval distance and angle between adjacent reference connected domains; According to the interval distances between adjacent reference connected domains, the average of the interval distances between adjacent reference connected domains is calculated; Get the distance between the neighboring connected domain and the current connected domain; Based on the angle between the skeleton extension line of the neighboring connected domain and the current connected domain, the average of the interval distances of adjacent reference connected domains, the angle between adjacent reference connected domains, and the distance between the neighboring connected domain and the current connected domain, the position consistency between the current connected domain and the neighboring connected domain is calculated.
6. The municipal engineering surveying and mapping method according to claim 1, characterized in that: The original municipal image is divided into regions according to the extension of the edge of the merged connected domain, and several regions are obtained, including: Acquire a merged connected domain edge, where the merged connected domain edge represents the minimum perimeter of the current connected domain and the neighboring connected domain; Perform edge detection on the external neighborhood of the merged connected domain using an edge detection algorithm, obtain the length of each edge, and filter out edges whose length is greater than or equal to a preset length threshold; Calculate the possibility that the current edge belongs to the road edge through the extension of the edge; Normalizing the possibility that the current edge belongs to a road edge, and taking the current edge whose normalized possibility is greater than or equal to a preset edge threshold as a road edge; According to the shape similarity and position consistency between the current connected domain and the neighboring connected domain, the neighboring connected domains on the same side of the road edge are merged to obtain a merged connected domain; the merged connected domain constitutes a region, and the connected domains in the region are similar.
7. The municipal engineering surveying and mapping method according to claim 6, characterized in that: The possibility that the current edge belongs to the road edge is calculated by the extension of the edge, including: The edge is linearly fitted using the least square method to obtain the extension direction of the edge, and the reference edge of the edge is obtained in the extension direction; Based on the distance between the edge points of two adjacent edge ends, the distance between the edge point of the current edge end and a reference edge end, the distance between the pixel points of the current edge before and after linear fitting, the length of the current edge, and the number of reference edge lines, the possibility that the current edge is a road edge is calculated.
8. The municipal engineering surveying and mapping method according to claim 1, characterized in that: Determine the characteristic points of each connected domain in each region, including: Take any point in the connected domain of the region as the starting point, patrol each point on the edge, record the direction of the subsequent points relative to the current one, and convert the relative direction into a specific value; Obtaining a derivative chain code of the original chain code; the derivative refers to the difference between the previous chain code and the next chain code, measured in multiples of 45° counterclockwise rotation; Remove the pixels whose derivative is 0, so that the selected pixels all have the change of direction angle; When the number of pixels between a selected pixel and the next selected pixel is greater than or equal to a preset pixel number threshold, multiple selected pixels greater than or equal to the preset pixel number threshold are selected as feature points of the connected domain; Thus, the feature points of each connected domain in the region are obtained.
9. The municipal engineering surveying and mapping method according to claim 1, characterized in that: The matching degree between the region in the original municipal image and the region in the overlapping image is calculated based on the feature points of each connected domain in the region and the number of connected domains, including: Obtain the sum of the inner angles of the feature points of the connected domain of a certain area in the original municipal image; Get the sum of the interior angles of the feature points of the connected domain in a certain area of the overlapping image; The sum of the internal angles is obtained by the following steps: obtaining the distances between the feature points in the connected domain and two adjacent feature points respectively. , the distance between two adjacent feature points is ; Draw a perpendicular line h perpendicular to the line segment c, and calculate the internal angle of the feature point by the inverse sine; thus, the internal angle sequence of the feature points formed by the lines connecting all the feature points is obtained, and the angles in the internal angle sequence of the feature points are added to obtain the internal angle sum between the feature points on a connected domain ; Get the number of connected domains in a certain area of the original municipal image; Get the number of connected domains in a certain area of the overlapping image; The matching degree between the area in the original municipal image and the area in the overlapping image is calculated based on the sum of the inner angles of the feature points of the connected domain of a certain area in the original municipal image, the sum of the inner angles of the feature points of the connected domain of a certain area in the overlapping image, the number of connected domains of a certain area in the original municipal image, and the number of connected domains of a certain area in the overlapping image.
10. A municipal engineering surveying and mapping device, characterized in that: include: An image acquisition module, used for acquiring an original municipal image and an overlapping image with a partially overlapping area; A preprocessing module is used to perform threshold segmentation on the original municipal image and obtain all connected domains in the segmented municipal image; A merging module is used to merge the neighboring connected domains according to the shape similarity and position consistency between the current connected domain and the neighboring connected domain in the original municipal image to obtain a merged connected domain; A region division module is used to divide the original municipal image into regions according to the extension of the edge of the merged connected domain to obtain a number of regions; A matching degree calculation module is used to determine the characteristic points of each connected domain in each area, and calculate the matching degree between the area in the original municipal image and the area in the overlapping image according to the characteristic points of each connected domain in the area and the number of connected domains; The image stitching module is used to determine the overlapping area of the original municipal image and the overlapping image through the matching degree, and stitch the original municipal image and the overlapping image according to the overlapping area, thereby completing the municipal engineering surveying and mapping.
Citation Information
Patent Citations
Roof capping illegal building identification method based on region positioning and local feature matching
CN114821334A
Municipal garden area measurement method based on aerial photography of unmanned aerial vehicle
CN115272315A