A picture processing method, apparatus, device and medium

By iteratively adjusting the building segmentation results and optimizing the building outline using a rectangular algorithm and an intersection-union ratio threshold, the problem of insufficient robustness in the segmentation of non-rectangular buildings in remote sensing images was solved, achieving higher segmentation accuracy and robustness.

CN115661658BActive Publication Date: 2025-11-21ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211382990.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-07
Publication Date
2025-11-21
Estimated Expiration
2042-11-07

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively handle the irregular contours of non-rectangular buildings, especially in remote sensing images, resulting in insufficient robustness.

Method used

By iteratively adjusting the building segmentation results, the maximum inscribed rectangle and minimum bounding rectangle algorithms are used, combined with the intersection-union ratio threshold and building edge extraction algorithm, to optimize the building outline and improve the accuracy of the segmentation results.

Benefits of technology

It improves the robustness of image segmentation for both regular and irregular buildings, especially the segmentation accuracy of non-right-angled polygonal buildings, and simplifies the building outline optimization process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115661658B_ABST
    Figure CN115661658B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a picture processing method, device, equipment and medium, the method comprising: performing feature extraction on a picture to be processed including buildings to obtain original segmentation results of each building; for the original segmentation results of each building, establishing a corresponding first segmentation result according to the size of the original segmentation result, and determining a target region with different label values in the original segmentation result and the first segmentation result, adjusting the label value corresponding to the target region in the first segmentation result to obtain a second segmentation result, iterating the second segmentation result as the first segmentation result until the iteration end condition is met; calculating the intersection over union using the original segmentation result and the second segmentation result, and determining the segmentation result of the building based on the relationship between the intersection over union and the set threshold; and determining the picture segmentation result based on the segmentation result of each building. The present disclosure can segment pictures including regular and / or irregular buildings, and improve the robustness of picture processing.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of image processing, and particularly relates to a picture processing method and device, equipment and medium. BACKGROUND

[0002] In the field of remote sensing, building extraction has always been a popular direction. In the extraction of buildings, due to the problem of algorithm accuracy, the extracted building contour may present irregular phenomena. Therefore, it is particularly important to optimize the building contour and regularize the optimized contour in the reconstruction of buildings. In the current research status, most studies focus on how to accurately extract the segmentation result of the building contour to improve the IOU (Intersection over Union), but there are few studies on the regularization of buildings.

[0003] Most of the current solutions assume that all buildings in remote sensing pictures are rectangular, and other more complex shapes are still processed using this solution, which cannot maintain high robustness. SUMMARY

[0004] The present disclosure provides a picture processing method, device, equipment and medium, which can segment pictures including regular and / or irregular buildings, thereby improving the robustness of picture processing.

[0005] According to a first aspect of an embodiment of the present disclosure, a picture processing method is provided, which comprises:

[0006] performing feature extraction on a to-be-processed picture including buildings to obtain original segmentation results of the buildings, wherein the original segmentation results include building part pixels labeled as a first label value and background part pixels labeled as a second label value;

[0007] for the original segmentation results of the buildings, establishing a corresponding first segmentation result according to the size of the original segmentation result, determining a target region with different label values in the original segmentation result and the first segmentation result, adjusting the label value corresponding to the target region in the first segmentation result to obtain a second segmentation result, and performing an iteration operation on the second segmentation result as the first segmentation result until a set iteration end condition is met, wherein the first segmentation result includes building part pixels labeled as the first label value;

[0008] calculating an intersection over union using the original segmentation result and the second segmentation result obtained after the iteration end condition is met, and determining a segmentation result of the building based on the relationship between the intersection over union and a set threshold value;

[0009] Based on the segmentation result of each building, a picture segmentation result corresponding to the picture to be processed is determined.

[0010] The disclosure adjusts the label value in the first segmentation result based on the original segmentation result of the building and the label value in the first segmentation result, and iteratively operates the obtained segmentation result as the first segmentation result to obtain a second segmentation result that satisfies an iteration end condition, so that the segmentation result of the building can be regularized. And for each building, the intersection-over-union between the original segmentation result and the second segmentation result is determined in relation to the set threshold value, and the segmentation result of each building is determined, and then the picture segmentation result of the entire picture is obtained. Therefore, the disclosure can segment pictures including regular and / or irregular buildings, thereby improving the robustness of picture processing, and in particular, pictures including buildings with non-right-angle polygons have higher robustness.

[0011] In a possible implementation, the determination of the target region with different label values in the original segmentation result and the first segmentation result comprises:

[0012] If the current iteration number is odd, a first region labeled as a second label value in the original segmentation result and a first label value in the first segmentation result is determined;

[0013] The maximum inscribed rectangle algorithm is used to determine the maximum inscribed rectangle of the first region to obtain the target region;

[0014] The adjustment of the label value of the target region in the first segmentation result to obtain a second segmentation result comprises:

[0015] The label value of the target region in the first segmentation result is labeled as the second label value, and the first segmentation result after the labeling is taken as the second segmentation result.

[0016] The disclosure uses iterative operation to repeatedly perform XOR operation on the original segmentation result and the first segmentation result, uses the maximum inscribed rectangle algorithm to determine the target region, and takes the target region in the first segmentation result as the background part to obtain the second segmentation result, so that the label value in the second segmentation result can be continuously adjusted, the second segmentation result of the building can be regularized, and the accuracy of the second segmentation result can be improved.

[0017] In a possible implementation, the determination of the target region with different label values in the original segmentation result and the first segmentation result comprises:

[0018] If the current iteration number is even, a second region labeled as a first label value in the original segmentation result and a second label value in the first segmentation result is determined;

[0019] The minimum circumscribed rectangle algorithm is used to determine a minimum circumscribed rectangle of the second region, and a region of the minimum circumscribed rectangle is taken as the target region;

[0020] The adjusting of the label value corresponding to the target region in the first segmentation result to obtain the second segmentation result comprises:

[0021] The label value corresponding to the target region in the first segmentation result is labeled as the first label value, and the first segmentation result after the labeling is taken as the second segmentation result.

[0022] The disclosure repeatedly performs the exclusive or operation on the original segmentation result and the first segmentation result by using the iterative operation, determines the target region by using the minimum circumscribed rectangle algorithm, takes the target region in the first segmentation result as the building part to obtain the second segmentation result, thereby being capable of continuously adjusting the label value in the second segmentation result, normalizing the second segmentation result of the building, and improving the accuracy of the second segmentation result.

[0023] In a possible implementation manner, the iteration end condition comprises:

[0024] The pixel value of the target region is less than a set pixel threshold; and / or

[0025] A set number of iterations is reached.

[0026] In a possible implementation manner, before the corresponding first segmentation result is established according to the size of the original segmentation result, the method further comprises:

[0027] A building contour extraction algorithm is used to perform building contour extraction on the original segmentation result to obtain first pixel coordinates of each end point in the building contour;

[0028] Based on the first pixel coordinates of the each end point, lengths of each edge in the building contour are determined;

[0029] Based on the lengths of each edge, a target edge with the longest length is determined, and an angle between the target edge and a straight line in the horizontal direction is determined;

[0030] The original segmentation result is rotated according to the determined angle.

[0031] The disclosure determines the angle between the longest edge in the building contour and the straight line in the horizontal direction, and rotates the original segmentation result based on the determined angle, thereby ensuring that the original segmentation result is in the positive direction, and further simplifying subsequent operations.

[0032] In a possible implementation, after the second segmentation result is obtained, the method further includes:

[0033] Reversely rotating the second segmentation result according to the determined angle.

[0034] In a possible implementation, the determining the segmentation result of the building based on the relationship between the intersection-over-union ratio and the set threshold value includes:

[0035] If the intersection-over-union ratio is not greater than the threshold value, the first pixel coordinates of the redundant end points in the building contour are removed based on the first pixel coordinates of the end points by using a Douglas-Peucker algorithm;

[0036] The label values in the original segmentation result are adjusted based on the first pixel coordinates of the removed end points, to obtain the segmentation result of the building.

[0037] The disclosure determines that the regularization degree of the second segmentation result is lower than that of the original segmentation result based on the relationship between the intersection-over-union ratio and the set threshold value, and thus the original segmentation result is further regularized to obtain the segmentation result of the building, thereby improving the accuracy of the segmentation result of the building.

[0038] In a possible implementation, the determining the segmentation result of the building based on the relationship between the intersection-over-union ratio and the set threshold value includes:

[0039] If the intersection-over-union ratio is greater than the threshold value, second pixel coordinates of the end points of the building contour are obtained by performing building edge extraction on the second segmentation result using a building edge extraction algorithm;

[0040] The second pixel coordinates of the end points of the building contour are adjusted by using a Gaussian Markov model or a Gaussian-Hermite model;

[0041] The label values in the second segmentation result are adjusted based on the adjusted second pixel coordinates of the end points, to obtain the segmentation result of the building.

[0042] The disclosure determines that the regularization degree of the second segmentation result is higher than that of the original segmentation result based on the relationship between the intersection-over-union ratio and the set threshold value, and thus the second segmentation result is further regularized to obtain the segmentation result of the building, thereby improving the accuracy of the segmentation result of the building.

[0043] In a possible implementation, the determining the picture segmentation result corresponding to the picture to be processed based on the segmentation result of each building includes:

[0044] According to the segmentation result of each building and the size of the picture to be processed, a position of the segmentation result of each building in the picture to be processed is determined;

[0045] According to the determined position and the segmentation result of each building, a picture processing result with the same size as the picture to be processed is obtained.

[0046] The present disclosure ensures the accuracy of the position of the segmentation result of a building in a picture processing result by determining the position of the segmentation result of each building in a picture to be processed.

[0047] According to a second aspect of the embodiments of the present disclosure, a picture processing apparatus is provided, which comprises:

[0048] An obtaining module is configured to perform feature extraction on a picture to be processed including buildings, and obtain original segmentation results of the buildings, wherein the original segmentation results include building part pixels labeled as a first label value and background part pixels labeled as a second label value;

[0049] An iteration module is configured to, for the original segmentation results of the buildings, establish a corresponding first segmentation result according to the size of the original segmentation result, determine a target region with different label values in the original segmentation result and the first segmentation result, adjust the label value of the target region in the first segmentation result, obtain a second segmentation result, and perform an iteration operation on the second segmentation result as the first segmentation result until a set iteration end condition is met, wherein the first segmentation result includes building part pixels labeled as the first label value;

[0050] A first determination module is configured to calculate an intersection over union based on the original segmentation result and the second segmentation result obtained after the iteration end condition is met, and determine the segmentation result of the building based on the relationship between the intersection over union and a set threshold.

[0051] A second determination module is configured to determine a picture segmentation result corresponding to the picture to be processed based on the segmentation result of each building.

[0052] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, which comprises a processor, and a memory for storing processor executable instructions, wherein the processor executes the executable instructions to implement the steps of the picture processing method.

[0053] According to a fourth aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, which stores computer instructions, and the instructions are executed by a processor to implement the steps of the picture processing method. BRIEF DESCRIPTION OF DRAWINGS

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained based on these drawings without creative labor.

[0055] Figure 1 is a schematic diagram of an application scenario according to an example embodiment;

[0056] Figure 2 is a flowchart of a picture processing method according to an example embodiment;

[0057] Figure 3 is a schematic diagram of a method for determining an original segmentation result according to an example embodiment;

[0058] Figure 4 is a schematic diagram of an instance segmentation network according to an example embodiment;

[0059] Figure 5 is a flowchart of a method for rotating an original segmentation result according to an example embodiment;

[0060] Figure 6 is a schematic diagram of a method for rotating an original segmentation result according to an example embodiment;

[0061] Figure 7 is a flowchart of a specific method for obtaining a second segmentation result according to an example embodiment;

[0062] Figure 8 is a schematic diagram of a method for obtaining a second segmentation result when the iteration number is 1 according to an example embodiment;

[0063] Figure 9 is another schematic diagram of a method for obtaining a second segmentation result when the iteration number is 1 according to an example embodiment;

[0064] Figure 10 is a schematic diagram of a method for obtaining a second segmentation result when the iteration number is 2 according to an example embodiment;

[0065] Figure 11 is a flowchart of a specific method for obtaining a segmentation result of a building according to an example embodiment;

[0066] Figure 12 is a schematic diagram of a method for obtaining a segmentation result of a building according to an example embodiment;

[0067] Figure 13Fig. 6 is a schematic diagram illustrating another example of obtaining a segmentation result of a building according to an example embodiment;

[0068] Figure 14 Fig. 7 is a schematic diagram illustrating a curve to be processed in a building contour according to an example embodiment;

[0069] Figure 15 Fig. 8 is a schematic diagram illustrating processing the curve to be processed using Douglas-Peucker algorithm according to an example embodiment;

[0070] Figure 16 Fig. 9 is a schematic diagram illustrating a first curve and a second curve obtained according to an example embodiment;

[0071] Figure 17 Fig. 10 is a schematic diagram illustrating an expansion of a Gaussian Markov Model formula according to an example embodiment;

[0072] Figure 18 Fig. 11 is a schematic diagram illustrating a method of determining a picture segmentation result corresponding to a picture to be processed according to an example embodiment;

[0073] Figure 19 Fig. 12 is a schematic diagram illustrating a picture processing apparatus according to an example embodiment;

[0074] Figure 20 Fig. 13 is a schematic diagram illustrating an electronic device of a picture processing method according to an example embodiment;

[0075] Figure 21 Fig. 14 is a schematic diagram illustrating a program product of a picture processing method according to an example embodiment. DETAILED DESCRIPTION

[0076] In order to make the objects, technical solutions and advantages of the present disclosure clearer, the following will further describe the present disclosure with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present disclosure.

[0077] The following explains some words appearing in the text:

[0078] 1. In the embodiments of the present disclosure, the term "and / or" describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can mean that there are three cases of A alone, A and B together, and B alone. The character " / " generally represents an "or" relationship between the associated objects before and after it.

[0079] 2、The terms "first", "second", etc. in the description and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein.

[0080] The application scenarios described in the embodiments of the present disclosure are for more clearly illustrating the technical solutions of the embodiments of the present disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. It can be known by those skilled in the art that, with the appearance of new application scenarios, the technical solutions provided by the embodiments of the present disclosure are also applicable to similar technical problems. In the description of the present disclosure, unless otherwise specified, the meaning of "a plurality of" is two or more than two.

[0081] In the field of remote sensing, building extraction has always been a popular direction. In the extraction of buildings, due to the problem of algorithm accuracy, the extracted building contour may present irregular phenomena. Therefore, it is particularly important to optimize and regularize the building contour in the reconstruction of buildings. In the current research status, most researches are focused on how to accurately extract the mask of the building contour to improve the IOU, but the research on the regularization of buildings is relatively less. Most of the current schemes assume that all buildings in remote sensing pictures are rectangular, and other more complex shapes are still processed using this scheme, which cannot maintain high robustness.

[0082] Therefore, in order to solve the above problems, the present disclosure provides a picture processing method, device, equipment and medium, which can segment pictures including regular and / or irregular buildings, thereby improving the robustness of picture processing.

[0083] Firstly refer to Figure 1 which is an application scenario diagram of the embodiments of the present disclosure, including a collector 11 and a server 12. The collector 11 can be a camera, a remote sensing device, a camera of a mobile phone / computer, a video recorder, etc., which is used for collecting pictures; the server 12 is used for segmenting buildings in the pictures collected by the collector 11.

[0084] In the embodiments of the present disclosure, the server 12 performs feature extraction on the to-be-processed picture including buildings collected by the collector 11 to obtain original segmentation results of the buildings, wherein the original segmentation results include building part pixels labeled as a first label value and background part pixels labeled as a second label value; for the original segmentation results of the buildings, a corresponding first segmentation result is established according to the size of the original segmentation result, and a target region with different label values in the original segmentation result and the first segmentation result is determined, the label value corresponding to the target region in the first segmentation result is adjusted to obtain a second segmentation result, and the second segmentation result is taken as the first segmentation result for iterative operation until a set iteration end condition is met, wherein the first segmentation result includes building part pixels labeled as a first label value; the intersection over union is calculated by using the original segmentation result and the second segmentation result obtained after the iteration end condition is met, and based on the relationship between the intersection over union and a set threshold, the segmentation result of the building is determined; and based on the segmentation result of each building, a picture segmentation result corresponding to the to-be-processed picture is determined.

[0085] In some embodiments, a picture processing method provided by the present disclosure is described below by specific embodiments, as shown in FIG. 1, which includes the following steps: Figure 2

[0086] Step 201, performing feature extraction on a to-be-processed picture including buildings to obtain original segmentation results of the buildings;

[0087] The to-be-processed picture can be a high-resolution remote sensing picture, and the to-be-processed picture can include one building or multiple buildings. The original segmentation result includes building part pixels labeled as a first label value and background part pixels labeled as a second label value, for example, building part pixels are labeled as 1 and background part pixels are labeled as 0.

[0088] In step 201, the to-be-processed picture can be input into an instance segmentation network for feature extraction to obtain original segmentation results of the buildings output by the instance segmentation network, wherein the instance segmentation network can be a Mask R-CNN (a kind of instance segmentation network), an FCIS (Fully convolutional Instance Segmentation) network or the like.

[0089] ​In step 202, for the original segmentation result of each building, a first segmentation result corresponding to the size of the original segmentation result is established, and a target region with different label values in the original segmentation result and the first segmentation result is determined. The label value of the target region in the first segmentation result is adjusted to obtain a second segmentation result. The second segmentation result is used as the first segmentation result for iterative operation until a set iteration end condition is met.

[0090] The first segmentation result includes building part pixels labeled as a first label value. The iteration end condition includes: a pixel value of a target region is less than a set pixel threshold value; and / or a set iteration number is reached. The pixel threshold value can be 100, and the set iteration number can be 10 or other values.

[0091] In step 203, an intersection-over-union is calculated using the original segmentation result and the second segmentation result obtained after the iteration end condition is met, and based on a relationship between the intersection-over-union and a set threshold value, a segmentation result of the building is determined.

[0092] The set threshold value can be 0.95 or other values.

[0093] The intersection-over-union between the original segmentation result and the second segmentation result obtained after the iteration end condition is met can be calculated by the following formula: Wherein, A is each pixel value in the original segmentation result, and B is each pixel value in the second segmentation result.

[0094] In step 204, based on the segmentation result of each building, a picture segmentation result corresponding to the picture to be processed is determined.

[0095] The disclosure adjusts the label value in the first segmentation result based on the label value in the original segmentation result and the first segmentation result of the building, adjusts the label value in the first segmentation result, and iterates the obtained segmentation result as the first segmentation result to obtain a second segmentation result that meets the iteration end condition, so that the segmentation result of the building can be normalized. And for each building, the intersection-over-union between the original segmentation result and the second segmentation result is determined based on the relationship between the set threshold value, and the segmentation result of each building is determined, and then the picture segmentation result of the whole picture is obtained. Therefore, the disclosure can segment the picture including regular and / or irregular buildings, thereby improving the robustness of picture processing, and especially having high robustness for pictures including buildings with non-right-angle polygons.

[0096] The specific steps of the picture processing method provided above will be described in detail as follows:

[0097] First, feature extraction is performed on the images to be processed, including buildings, to obtain the original segmentation results of each building;

[0098] like Figure 3 As shown, taking an image to be processed containing two buildings, namely building A and building B, the image to be detected is input into an instance segmentation network for feature extraction, and the original segmentation result A of building A and the original segmentation result B of building B are obtained from the output of the instance segmentation network.

[0099] This disclosure takes into account situations where there are other buildings such as attics on the roof, multiple buildings, or densely packed buildings, and semantic segmentation is not feasible. Therefore, it employs instance segmentation to segment individual buildings, such as... Figure 4 As shown, a centermask can be used as the basic instance segmentation network framework. The encoder part of the centermask uses VoVNetV2 (an efficient object detection backbone network) and FPN (Feature Pyramid Networks) as the main feature extraction networks. Each time the feature is passed through a pooling layer, the scale is reduced by one, resulting in five feature layers of different scales. The detection part uses FCOS (Fully Convolutional One-Stage Object Detection) to extract bounding boxes. The semantic part incorporates a SAG-Mask (Spatial Attention-Guided Mask) network structure to predict the original 28x28 segmentation result and scale it to the corresponding size of the bounding boxes. The loss function involved in the training of the instance segmentation network consists of four parts: object classification loss, center location loss, regression loss, and mask loss. The specific training process of the instance segmentation network is existing technology and will not be elaborated here.

[0100] Secondly, for the original segmentation results of each building, a corresponding first segmentation result is established according to the size of the original segmentation result, and a target region with different marker values ​​in the original segmentation result and the first segmentation result is determined. The marker values ​​corresponding to the target region in the first segmentation result are adjusted to obtain a second segmentation result. The second segmentation result is used as the first segmentation result for iterative operation until the set iteration end condition is met.

[0101] Before establishing the corresponding first segmentation result based on the size of the original segmentation result, in order to simplify the subsequent operation process, it is necessary to rotate the original segmentation result, such as... Figure 5 As shown, the specific steps include:

[0102] Step 501: Use a building edge extraction algorithm to extract the building contour from the original segmentation result to obtain the first pixel coordinates of each endpoint in the building contour;

[0103] The building edge extraction algorithm described above can be either OpenCV (Open Source Computer Vision Library) or other building edge extraction algorithms. When using the OpenCV algorithm, the findcontours function in the OpenCV algorithm is used to retrieve the building contours from the original segmentation results to obtain the first pixel coordinates of each endpoint.

[0104] Step 502: Determine the length of each side in the building outline based on the first pixel coordinates of each endpoint;

[0105] Since the first pixel coordinates of each endpoint are determined, and each edge consists of two endpoints, the Euclidean distance between the two endpoints is the length of the edge.

[0106] Step 503: Based on the length of each side, determine the target side with the longest length, and determine the angle between the target side and the straight line in the horizontal direction;

[0107] The aforementioned angle can be the cosine value between the target edge and the straight line in the horizontal direction.

[0108] Step 504: Rotate the original segmentation result according to the determined angle.

[0109] For example, such as Figure 6 As shown, the building outline includes five endpoints, with the first pixel coordinates of each endpoint being a1, a2, a3, a4, and a5. Based on a1 and a2, the length of the first edge is determined to be d1; based on a2 and a3, the length of the second edge is determined to be d2; based on a3 and a4, the length of the third edge is determined to be d3; based on a4 and a5, the length of the fourth edge is determined to be d4; and based on a5 and a1, the length of the fifth edge is determined to be d5. Since the length of the second edge is greater than the lengths of the other edges, the target edge is the second edge. The angle α between the second edge and the horizontal line is calculated, and the original segmentation result is rotated clockwise by angle α with a2 as the center.

[0110] After obtaining the second segmentation result, the process also includes:

[0111] The second segmentation result is rotated in the opposite direction according to the determined angle.

[0112] When the iteration end condition is reaching a set iteration number, the specific process of the method for obtaining the second segmentation result through the iteration operation is as shown in Figure 7 , which comprises:

[0113] Step 701, determining the current iteration number;

[0114] Step 702, judging whether the set iteration number is reached, if not, executing step 703, and if yes, executing step 711;

[0115] Step 703, judging whether the current iteration number is odd, if yes, executing steps 704-706, and if not, executing steps 707-709;

[0116] Step 704, determining a first region labeled as a second label value in the original segmentation result and labeled as a first label value in the first segmentation result;

[0117] The first region is a region not belonging to the building part in the original segmentation result but belonging to the building part in the first segmentation result.

[0118] Step 705, using a maximum inscribed rectangle algorithm to determine the maximum inscribed rectangle of the first region to obtain the target region;

[0119] The specific process of using the maximum inscribed rectangle algorithm to determine the maximum inscribed rectangle of the first region is prior art, which will not be described here.

[0120] Step 706, labeling the label value corresponding to the target region in the first segmentation result as the second label value, and taking the first segmentation result after the labeling as the second segmentation result;

[0121] For example, the current iteration number is 1, as shown in Figure 8 , a first region 1 labeled as a second label value in an original segmentation result 1 and labeled as a first label value in a first segmentation result 1 is determined. A maximum inscribed rectangle algorithm is used to determine the maximum inscribed rectangle of the first region 1 to obtain a target region 1. The label value corresponding to the target region 1 in the first segmentation result 1 is labeled as the second label value, thereby obtaining a second segmentation result 1.

[0122] For example, the current iteration number is 1, as shown in Figure 9As shown, the first region 21 and the first region 22 are determined, which are labeled as the second label value in the original segmentation result 2 and labeled as the first label value in the first segmentation result 2. The maximum inscribed rectangle of the first region 21 is determined by using the maximum inscribed rectangle algorithm, and the target region 21 is obtained. The maximum inscribed rectangle of the first region 22 is determined by using the maximum inscribed rectangle algorithm, and the target region 22 is obtained. The label value corresponding to the target region 21 and the target region 22 in the first segmentation result 2 is labeled as the second label value, and thus the second segmentation result 2 is obtained.

[0123] In step 707, a second region is determined, which is labeled as the first label value in the original segmentation result and labeled as the second label value in the first segmentation result.

[0124] The above-mentioned second region is a region that belongs to the building part in the original segmentation result but does not belong to the building part in the first segmentation result.

[0125] In step 708, the minimum circumscribed rectangle of the second region is determined by using the minimum circumscribed rectangle algorithm, and the region of the minimum circumscribed rectangle is taken as the target region.

[0126] The specific process of determining the minimum circumscribed rectangle of the second region by using the minimum circumscribed rectangle algorithm is a prior art, which is not described here again.

[0127] In step 709, the label value corresponding to the target region in the first segmentation result is labeled as the first label value, and the first segmentation result after the labeling is taken as the second segmentation result.

[0128] For example, the current iteration number is 2, and the first iteration number is 1, as shown in FIG. 6. Figure 10 As shown, the second region 3 is determined, which is labeled as the first label value in the original segmentation result 3 and labeled as the second label value in the first segmentation result 3. The minimum circumscribed rectangle of the second region 3 is determined by using the minimum circumscribed rectangle algorithm, and the target region 3 is obtained. The label value corresponding to the target region 3 in the first segmentation result 3 is labeled as the first label value, and thus the second segmentation result 3 is obtained.

[0129] In step 710, the second segmentation result is taken as the first segmentation result, and step 701 is continued to be executed.

[0130] In step 711, the second segmentation result is obtained.

[0131] Then, the intersection-over-union ratio is calculated by using the original segmentation result and the second segmentation result obtained after the iteration end condition is met, and the segmentation result of the building is determined based on the relationship between the intersection-over-union ratio and the set threshold.

[0132] The specific steps of the method for determining the segmentation result of the building are as follows, as shown in FIG. 7. Figure 11As shown, it includes:

[0133] Step 1101: Calculate the intersection-union ratio using the original segmentation result and the second segmentation result obtained after satisfying the iteration termination condition;

[0134] Step 1102: Determine whether the intersection-union ratio is greater than the threshold. If yes, proceed to steps 1103-1105; otherwise, proceed to steps 1106-1107.

[0135] Step 1103: Use a building edge extraction algorithm to extract the building edges from the second segmentation result to obtain the second pixel coordinates of each endpoint of the building outline;

[0136] The building edge extraction algorithm mentioned above can be the OpenCV algorithm or other building edge extraction algorithms.

[0137] Step 1104: Using a Gauss Markov model or a Gauss Helmholtz model, adjust the second pixel coordinates of each endpoint of the building outline to obtain the adjusted second pixel coordinates of each endpoint.

[0138] Step 1105: Based on the adjusted second pixel coordinates of each endpoint, adjust the marker value in the second segmentation result to obtain the segmentation result of the building;

[0139] For example, such as Figure 12 As shown, the second pixel coordinates of each endpoint of the building outline are h1, h2, h3, h4 and h5, respectively. If the second pixel coordinates of each endpoint of the building outline are adjusted using a Gaussian Markov model, the adjusted second pixel coordinates of each endpoint are h1', h2, h3, h4 and h5, respectively. The region where the marker value needs to be adjusted is determined, and the marker value in the region is adjusted from the second marker value to the first marker value, thereby obtaining the segmentation result of the building.

[0140] For example, such as Figure 13 As shown, the second pixel coordinates of each endpoint of the building outline are g1, g2, g3 and g4 respectively. If the second pixel coordinates of each endpoint of the building outline are adjusted using a Gaussian Markov model, the adjusted second pixel coordinates of each endpoint are g1', g2, g3 and g4 respectively. The region where the marker value needs to be adjusted is determined, and the marker value in the region is adjusted from the first marker value to the second marker value, thereby obtaining the segmentation result of the building.

[0141] Step 1106: Based on the first pixel coordinates of each endpoint, use the Douglas-Pokal algorithm to remove the pixel coordinates of redundant endpoints in the building outline to obtain the first pixel coordinates of each endpoint after removal.

[0142] The above-mentioned Douglas-Peucker algorithm is an algorithm for approximating a curve as a series of points and reducing the number of points, which connects the first and last end points of a curve to be processed to form a virtual straight line, calculates the distance of each contour vertex to the virtual straight line, compares the maximum value with the line difference δ. If the maximum value is less than the line difference δ, it indicates that the line segment is low in bending degree and can be approximated to a straight line, i.e., all the vertices except the first and last end points are deleted. If the maximum value is greater than the line difference δ, it indicates that the line segment is high in bending degree. The maximum value vertex is used as a boundary to divide the original curve into two segments, and the above step is performed again until compression is not possible, and finally the fitted building contour is obtained.

[0143] For example, if a curve to be processed in a building contour is as shown in FIG. 7, the curve to be processed includes 7 end points. As shown in FIG. 8, a straight line is obtained by connecting the end point 1 and the end point 7, the distance c1 of the end point 2 to the straight line is calculated, the distance c2 of the end point 3 to the straight line is calculated, the distance c3 of the end point 4 to the straight line is calculated, the distance c4 of the end point 5 to the straight line is calculated, and the distance c6 of the end point 6 to the straight line is calculated. It is determined that c3 is the longest, and if c3 < δ, it is determined that the end points 2, 3, 4, 5 and 6 are redundant end points, and these end points are deleted. If c3 > δ, as shown in FIG. 9, the end point 4 is used as a boundary, a first straight line is obtained by connecting the end point 1 and the end point 4, a second straight line is obtained by connecting the end point 4 and the end point 7, and the above step is performed again until compression is not possible, and finally the fitted curve is obtained. Figure 14 Figure 15 Figure 16

[0144] Step 1107, based on the first pixel coordinates of the removed end points, adjusting the label values in the original segmentation result to obtain the segmentation result of the building.

[0145] The above-mentioned step 1104 adjusts the pixel coordinates of the end points of the building contour by using a Gaussian Markov model.

[0146] The formula of the Gaussian Markov model is as follows:

[0147] Aβ = γ + e with E(e) = 0, D(e) = σ 2 P -1 ;

[0148] Wherein, A is a design matrix, β is an unknown quantity, γ is an observation value, e is a system error, which satisfies the expectation of 0, the same variance and uncorrelated, P -1 is an n-order unit matrix, and σ 2 is a constant, which is 1 by default.

[0149] X i ​​​= [x i ,y i ] T where i = 1,..., I denotes the boundary points, the building can be represented as P j = P(X j ,Y j ), this can be used as a model β = [P j ] T , j = 1,..., J, where X represents the x-axis value of the point, Y represents the y-axis value of the point.

[0150] The observation value γ is constructed, and the observation value γ is composed of the following parts:

[0151] F d(i,j) = d 2 (i,j) ;

[0152]

[0153]

[0154] F Y(j) = Y j - Y j 0 ;

[0155] where F d(i,j) represents the distance from the ith endpoint to the jth building edge, and the formula for calculating d(i,j) is as follows:

[0156]

[0157] where F α(j) represents the interior angle of the jth building edge, and the interior angle is 90° or 270°, that is F X(j) F Y(j) represents the vector of the jth endpoint, that is, the offset of the jth endpoint relative to the origin.

[0158] Combined with the following Taylor first-order expansion formula:

[0159]

[0160] where o[(x-x0) 1 ] is the Peano remainder.

[0161] It is known that e is minimized, that is, f(x) = 0, so we get:

[0162]

[0163] Therefore, the design matrix A can be obtained

[0164] Based on the above formula, we can obtain the following: Figure 17 The expansion formula in the equation is solved using the least squares method, yielding β as the increment. These increments are then added to the pixel coordinates of each endpoint to obtain the adjusted pixel coordinates of each endpoint. The specific method of using the least squares method is existing technology and will not be elaborated here. Furthermore, the method of adjusting the pixel coordinates of each endpoint of the building outline using the Gauss-Holmatt model is similar to the method of adjusting the pixel coordinates of each endpoint of the building outline using the Gauss-Markov model, and will not be elaborated here either.

[0165] Finally, based on the segmentation results of each building, the image segmentation result corresponding to the image to be processed is determined.

[0166] Based on the segmentation results of each building and the size of the image to be processed, determine the position of the segmentation results of each building in the image to be processed;

[0167] Based on the determined location and the segmentation results of each building, an image processing result with the same size as the image to be processed is obtained.

[0168] For example, such as Figure 18 As shown, an image to be processed can yield two segmentation results, segmentation result A and segmentation result B. Based on segmentation result A and the size of the image to be processed, the position A of segmentation result A within the image to be processed is determined. Similarly, based on segmentation result B and the size of the image to be processed, the position B of segmentation result B within the image to be processed is determined. Based on the determined positions A and B, and segmentation results A and B, the processed image is filled to the same size as the image to be processed. The size of the building segmentation result is the same as the original segmentation result. Furthermore, when determining the original segmentation result, its position within the image to be processed is recorded; this position is the location of the building segmentation result within the image to be processed. This position can be represented as (x, y, w, h), where (x, y) are the coordinates of the top-left corner of the original segmentation result in the coordinate system of the image to be processed, w is the width of the original segmentation result, and h is the height of the original segmentation result. The size of the image to be processed can be obtained based on its attributes; therefore, the location of the building segmentation result within the image to be processed can be calculated based on the building segmentation result. Therefore, the pixels of the building are labeled as 1, and the pixels of other background parts are labeled as 0, to obtain the image processing result.

[0169] In some embodiments, based on the same inventive concept, the present disclosure also provides an image processing apparatus. Since this apparatus is the same as the apparatus in the method of the present disclosure, and the principle of the apparatus in solving the problem is similar to that of the method, the implementation of the apparatus can refer to the implementation of the method, and the repeated parts will not be described again.

[0170] As shown in Figure 19 the above apparatus includes the following modules:

[0171] The obtaining module 191 is configured to perform feature extraction on a picture to be processed including buildings, and obtain an original segmentation result of each building, wherein the original segmentation result includes building part pixels labeled as a first label value and background part pixels labeled as a second label value.

[0172] The iteration module 192 is configured to, for the original segmentation result of each building, establish a corresponding first segmentation result according to the size of the original segmentation result, determine a target region with different label values in the original segmentation result and the first segmentation result, adjust the label value of the target region in the first segmentation result, obtain a second segmentation result, and perform an iteration operation on the second segmentation result as the first segmentation result until a set iteration end condition is met, wherein the first segmentation result includes building part pixels labeled as the first label value.

[0173] The first determination module 193 is configured to calculate an intersection over union based on the original segmentation result and the second segmentation result obtained after the iteration end condition is met, and determine a segmentation result of the building based on the relationship between the intersection over union and a set threshold.

[0174] The second determination module 194 is configured to determine a picture segmentation result corresponding to the picture to be processed based on the segmentation result of each building.

[0175] As an optional implementation, the iteration module 192 is configured to:

[0176] If the current iteration number is odd, a first region labeled as the second label value in the original segmentation result and labeled as the first label value in the first segmentation result is determined.

[0177] A maximum inscribed rectangle of the first region is determined using a maximum inscribed rectangle algorithm to obtain the target region.

[0178] The iteration module 192 is configured to:

[0179] The label value of the target region in the first segmentation result is labeled as the second label value, and the first segmentation result after the labeling is completed is taken as the second segmentation result.

[0180] As an optional implementation, the iteration module 192 is configured to:

[0181] If the current iteration number is a complex number, it is determined that a second region labeled as a first label value in the original segmentation result and labeled as a second label value in the first segmentation result;

[0182] The minimum circumscribed rectangle algorithm is used to determine the minimum circumscribed rectangle of the second region, and the area of the minimum circumscribed rectangle is taken as the target region;

[0183] The iteration module 192 is configured to:

[0184] The label value corresponding to the target region in the first segmentation result is labeled as the first label value, and the first segmentation result after the labeling is completed is taken as the second segmentation result.

[0185] As an optional implementation, the iteration end condition includes:

[0186] The pixel value of the target region is less than a set pixel threshold; and / or

[0187] The set number of iterations is reached.

[0188] As an optional implementation, before the corresponding first segmentation result is established according to the size of the original segmentation result, the iteration module 192 is further configured to:

[0189] The building contour extraction algorithm is used to perform building contour extraction on the original segmentation result to obtain first pixel coordinates of each endpoint in the building contour;

[0190] Based on the first pixel coordinates of the endpoints, the length of each edge in the building contour is determined;

[0191] Based on the length of each edge, a target edge with the longest length is determined, and an angle between the target edge and a straight line in the horizontal direction is determined;

[0192] The original segmentation result is rotated according to the determined angle.

[0193] As an optional implementation, after the second segmentation result is obtained, the iteration module 192 is further configured to:

[0194] The second segmentation result is reversely rotated according to the determined angle.

[0195] As an optional implementation, the first determination module 193 is configured to:

[0196] If the intersection-over-union ratio is not greater than the threshold value, the first pixel coordinates of the endpoints are used to eliminate the pixel coordinates of redundant endpoints in the building contour by using the Douglas-Peucker algorithm;

[0197] Based on the first pixel coordinates of the pruned end points, the label values in the original segmentation result are adjusted to obtain the segmentation result of the building.

[0198] As an optional implementation, the first determining module 193 is configured to:

[0199] If the intersection over union is greater than the threshold value, a building edge extraction algorithm is used to perform building edge extraction on the second segmentation result to obtain second pixel coordinates of the end points of the building contour;

[0200] The second pixel coordinates of the end points of the building contour are adjusted using a Gaussian Markov model or a Gaussian-Hermite model.

[0201] Based on the adjusted second pixel coordinates of the end points, the label values in the second segmentation result are adjusted to obtain the segmentation result of the building.

[0202] As an optional implementation, the second module 194 is configured to:

[0203] According to the segmentation result of each building and the size of the picture to be processed, the position of the segmentation result of each building in the picture to be processed is determined.

[0204] According to the determined position and the segmentation result of each building, a picture processing result with the same size as the picture to be processed is obtained.

[0205] In some embodiments, based on the same inventive concept, the disclosure also provides a picture processing device which can implement the picture processing functions discussed above. Please refer to Figure 20 The device includes a processor 21 and a memory 22, wherein the memory 22 is configured to store program instructions.

[0206] The processor 21 invokes the program instructions stored in the memory and runs the program instructions to implement:

[0207] perform feature extraction on a picture to be processed including a building to obtain an original segmentation result of each building, wherein the original segmentation result includes building part pixels labeled as a first label value and background part pixels labeled as a second label value;

[0208] According to the size of the original segmentation result, a first segmentation result corresponding to the original segmentation result is established, and a target region with different label values in the original segmentation result and the first segmentation result is determined, the label value of the target region in the first segmentation result is adjusted, and a second segmentation result is obtained, and the second segmentation result is taken as the first segmentation result for iteration until a set iteration end condition is met, wherein the first segmentation result includes a building part pixel labeled as a first label value;

[0209] The intersection over union is calculated by using the original segmentation result and the second segmentation result obtained after the iteration end condition is met, and based on the relationship between the intersection over union and a set threshold, the segmentation result of the building is determined.

[0210] Based on the segmentation result of each building, a picture segmentation result corresponding to the picture to be processed is determined.

[0211] As an optional implementation, the determination of the target region with different label values in the original segmentation result and the first segmentation result includes:

[0212] If the current iteration number is odd, a first region labeled as a second label value in the original segmentation result and labeled as a first label value in the first segmentation result is determined;

[0213] The maximum inscribed rectangle algorithm is used to determine the maximum inscribed rectangle of the first region, and the target region is obtained;

[0214] The adjustment of the label value of the target region in the first segmentation result to obtain the second segmentation result includes:

[0215] The label value of the target region in the first segmentation result is labeled as the second label value, and the first segmentation result after the labeling is taken as the second segmentation result.

[0216] As an optional implementation, the determination of the target region with different label values in the original segmentation result and the first segmentation result includes:

[0217] If the current iteration number is even, a second region labeled as the first label value in the original segmentation result and labeled as the second label value in the first segmentation result is determined;

[0218] The minimum circumscribed rectangle algorithm is used to determine the minimum circumscribed rectangle of the second region, and the region of the minimum circumscribed rectangle is taken as the target region;

[0219] The processor adjusts the label value corresponding to the target region in the first segmentation result to obtain a second segmentation result.

[0220] The processor labels the label value corresponding to the target region in the first segmentation result as the first label value, and takes the first segmentation result after the labeling as the second segmentation result.

[0221] As an optional implementation, the iteration end condition comprises:

[0222] The pixel value of the target region is less than a set pixel threshold; and / or

[0223] A set number of iterations is reached.

[0224] As an optional implementation, before the first segmentation result corresponding to the size of the original segmentation result is established, the processor further performs:

[0225] The processor performs building contour extraction on the original segmentation result using a building edge extraction algorithm to obtain first pixel coordinates of each endpoint in the building contour;

[0226] The processor determines the length of each edge in the building contour based on the first pixel coordinates of each endpoint;

[0227] The processor determines a target edge with the longest length based on the length of each edge, and determines an angle between the target edge and a straight line in the horizontal direction;

[0228] The processor rotates the original segmentation result according to the determined angle.

[0229] As an optional implementation, after the second segmentation result is obtained, the processor further performs:

[0230] The processor reversely rotates the second segmentation result according to the determined angle.

[0231] As an optional implementation, the processor determines the segmentation result of the building based on the relationship between the intersection-over-union and a set threshold, comprising:

[0232] If the intersection-over-union is not greater than the threshold, the processor removes the pixel coordinates of redundant endpoints in the building contour based on the first pixel coordinates of each endpoint using a Douglas-Peucker algorithm;

[0233] The processor adjusts the label value in the original segmentation result based on the first pixel coordinates of each endpoint after the removal to obtain the segmentation result of the building.

[0234] As an optional implementation, determining the building segmentation result based on the relationship between the intersection-union ratio and a set threshold includes:

[0235] If the intersection-union ratio is greater than the threshold, then the building edge extraction algorithm is used to extract the building edges of the second segmentation result to obtain the second pixel coordinates of each endpoint of the building outline;

[0236] The second pixel coordinates of each endpoint of the building outline are adjusted using a Gaussian Markov model or a Gaussian Helmholtz model.

[0237] Based on the adjusted second pixel coordinates of each endpoint, the marker value in the second segmentation result is adjusted to obtain the segmentation result of the building.

[0238] As an optional implementation, determining the image segmentation result corresponding to the image to be processed based on the segmentation result of each building includes:

[0239] Based on the segmentation results of each building and the size of the image to be processed, determine the position of the segmentation results of each building in the image to be processed;

[0240] Based on the determined location and the segmentation results of each building, an image processing result with the same size as the image to be processed is obtained.

[0241] In some possible implementations, various aspects of this disclosure can also be implemented in the form of a program product, such as... Figure 21 As shown, the computer program product 210 includes computer program code that, when run on a computer, causes the computer to execute any of the image processing methods described above. Since the principle by which the above computer program product solves the problem is similar to that of the image processing method, the implementation of the above computer program product can be found in the implementation of the method; repeated details will not be elaborated further.

[0242] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.

[0243] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more computer-readable media. Figure 1 one or more computer-readable media.

[0244] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the Figure 1 one or more computer-readable media. Figure 1 one or more computer-readable media.

[0245] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more computer-readable media. Figure 1 one or more computer-readable media.

[0246] Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the features of the disclosure disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the disclosure being indicated by the following claims.

[0247] It will be understood that the present disclosure is not limited to the precise structures herein described and illustrated in the drawings and that various modifications and changes can be made therein without departing from the scope thereof. The scope of the present disclosure is indicated by the appended claims.

Claims

1. An image processing method, characterized in that, The method includes: Feature extraction is performed on the image to be processed, which includes buildings, to obtain the original segmentation results of each building. The original segmentation results include the building part pixels labeled with a first label value and the background part pixels labeled with a second label value. For the original segmentation results of each building, a corresponding first segmentation result is established according to the size of the original segmentation result, and a target region with a different marker value in the original segmentation result and the first segmentation result is determined. The marker value corresponding to the target region in the first segmentation result is adjusted to obtain a second segmentation result. The second segmentation result is used as the first segmentation result for iterative operation until the set iteration end condition is met. The first segmentation result includes the building part pixels marked with the first marker value. The intersection-union ratio (IUU) is calculated using the original segmentation result and the second segmentation result obtained after satisfying the iteration termination condition. Based on the relationship between the IUU and a set threshold, the segmentation result of the building is determined. Based on the segmentation results of each building, the image segmentation result corresponding to the image to be processed is determined.

2. The method according to claim 1, characterized in that, The step of determining the target regions with different marker values ​​in the original segmentation result and the first segmentation result includes: If the current iteration number is an odd number, then the first region is identified as the second label value in the original segmentation result and as the first label value in the first segmentation result; The maximum inscribed rectangle algorithm is used to determine the maximum inscribed rectangle of the first region, thereby obtaining the target region. The step of adjusting the marker value corresponding to the target region in the first segmentation result to obtain the second segmentation result includes: The target region in the first segmentation result is labeled as the second label value, and the first segmentation result after labeling is used as the second segmentation result.

3. The method according to claim 1, characterized in that, The step of determining the target regions with different marker values ​​in the original segmentation result and the first segmentation result includes: If the current iteration number is a complex number, then a second region is determined that is marked with a first label value in the original segmentation result and a second label value in the first segmentation result; The minimum bounding rectangle algorithm is used to determine the minimum bounding rectangle of the second region, and the region of the minimum bounding rectangle is taken as the target region. The step of adjusting the marker value corresponding to the target region in the first segmentation result to obtain the second segmentation result includes: The target region in the first segmentation result is labeled with the first label value, and the first segmentation result after labeling is used as the second segmentation result.

4. The method according to any one of claims 1 to 3, characterized in that, The iteration termination conditions include: The pixel value of the target area is less than the set pixel threshold; and / or The set number of iterations has been reached.

5. The method according to claim 1, characterized in that, Before establishing the corresponding first segmentation result according to the size of the original segmentation result, the method further includes: The building outline is extracted from the original segmentation result using a building edge extraction algorithm to obtain the first pixel coordinates of each endpoint in the building outline; Based on the first pixel coordinates of each endpoint, determine the length of each side in the building outline; Based on the length of each edge, determine the target edge with the longest length, and determine the angle between the target edge and the straight line in the horizontal direction; The original segmentation result is rotated according to the determined angle.

6. The method according to claim 5, characterized in that, After obtaining the second segmentation result, the process also includes: The second segmentation result is rotated in the opposite direction according to the determined angle.

7. The method according to claim 5, characterized in that, The step of determining the segmentation result of the building based on the relationship between the intersection-union ratio and a set threshold includes: If the intersection-union ratio is not greater than the threshold, then based on the first pixel coordinates of each endpoint, the pixel coordinates of redundant endpoints in the building outline are removed using the Douglas-Puk algorithm. Based on the first pixel coordinates of each endpoint after removal, the marker values ​​in the original segmentation result are adjusted to obtain the segmentation result of the building.

8. The method according to claim 1, characterized in that, The step of determining the segmentation result of the building based on the relationship between the intersection-union ratio and a set threshold includes: If the intersection-union ratio is greater than the threshold, then the building edge extraction algorithm is used to extract the building edges of the second segmentation result to obtain the second pixel coordinates of each endpoint of the building outline; The second pixel coordinates of each endpoint of the building outline are adjusted using a Gaussian Markov model or a Gaussian Helmholtz model. Based on the adjusted second pixel coordinates of each endpoint, the marker value in the second segmentation result is adjusted to obtain the segmentation result of the building.

9. The method according to claim 1, characterized in that, The step of determining the image segmentation result corresponding to the image to be processed based on the segmentation result of each building includes: Based on the segmentation results of each building and the size of the image to be processed, determine the position of the segmentation results of each building in the image to be processed; Based on the determined location and the segmentation results of each building, an image processing result with the same size as the image to be processed is obtained.

10. An image processing apparatus, characterized in that, The device includes: The acquisition module is used to extract features from the image to be processed, including buildings, and obtain the original segmentation results of each building. The original segmentation results include building pixels labeled with a first label value and background pixels labeled with a second label value. An iteration module is used to establish a corresponding first segmentation result based on the size of the original segmentation result for each building, and to determine the target region with different marker values ​​in the original segmentation result and the first segmentation result. The marker values ​​corresponding to the target regions in the first segmentation result are adjusted to obtain a second segmentation result. The second segmentation result is used as the first segmentation result for iterative operation until the set iteration termination condition is met. The first segmentation result includes the building part pixels marked with the first marker value. The first determining module is used to calculate the intersection-union ratio (IUGR) using the original segmentation result and the second segmentation result obtained after satisfying the iteration termination condition, and to determine the segmentation result of the building based on the relationship between the IUGR and a set threshold. The second determining module is used to determine the image segmentation result corresponding to the image to be processed based on the segmentation result of each building.

11. An electronic device, characterized in that, include: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method according to any one of claims 1 to 9 by executing the executable instructions.

12. A computer-readable and writable storage medium storing computer instructions thereon, characterized in that, When executed by a processor, this instruction implements the steps of the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Building image segmentation method for augmented reality application

    CN108154158A

  • Building contour extraction method and system, computer equipment and storage medium

    CN114529837A