Roof contour identification method, device and computer program product

By constructing an elevation information map of the roof and converting it into a color image, the corner points of the roof can be identified, solving the problem of obstacle noise affecting the accuracy of roof recognition and achieving higher accuracy in roof contour recognition.

CN121639722APending Publication Date: 2026-03-10HEFEI SUNGROW RENEWABLE ENERGY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In the construction of distributed photovoltaic power stations, existing technologies suffer from insufficient accuracy in roof identification due to the influence of obstacle noise during the roof identification process.

Method used

By acquiring elevation information maps of the target area, constructing color images, identifying corner points in the color images, determining roof outlines, and using color images to clearly present elevation changes, the target roofs and obstacles can be distinguished, thus improving recognition accuracy.

Benefits of technology

This effectively avoids the impact of obstacles on the roof outline recognition results, thus improving the accuracy of roof outline recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121639722A_ABST
    Figure CN121639722A_ABST
Patent Text Reader

Abstract

The invention discloses a roof contour identification method and device and a computer program product, relates to the technical field of image processing, and discloses a roof contour identification method comprising the following steps: obtaining an elevation information graph corresponding to an optical image of a target area; constructing a color image of the target area based on the elevation information graph; performing angular point identification on the color image to obtain an angular point identification result of the target roof; and determining the target roof contour according to the angular point recognition result, thereby improving the accuracy of the target roof contour recognition result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to methods, devices and computer programs for recognizing roof outlines. Background Technology

[0002] In the construction of distributed photovoltaic (PV) power stations, accurate roof outline identification is crucial for the rational arrangement of PV modules and ensuring the economic viability of the PV power station. Related technologies involve segmenting the acquired image into instances based on the target roof, expanding the target roof area, and then identifying the target roof within the expanded area. However, the expanded area introduces obstacle noise, affecting the accuracy of the target roof identification results. Summary of the Invention

[0003] The main objective of this application is to provide a method, device, and computer program product for identifying roof outlines, with the aim of improving the accuracy of the target roof outline identification results.

[0004] To achieve the above objectives, this application proposes a method for identifying roof outlines, the method comprising: Obtain the elevation information map corresponding to the optical image of the target area; Construct a color image of the target area based on the elevation information map; Corner point recognition is performed on the color image to obtain the corner point recognition results of the target roof; The target roof outline is determined based on the corner point recognition results.

[0005] In one embodiment, the step of constructing a color image of the target region based on the elevation information map includes: Based on the elevation information map, determine the elevation value of each pixel, and determine the maximum and minimum elevation values; Based on the maximum elevation value, the minimum elevation value, and the elevation value of each pixel, the color value of each pixel is determined. The color parameter values ​​of each pixel are determined based on the color values; The initial image is drawn based on the color parameter values ​​of each pixel to obtain the color image of the target area.

[0006] In one embodiment, the step of determining the color value of each pixel based on the maximum elevation value, the minimum elevation value, and the elevation value of each pixel includes: Determine a first elevation difference between the elevation value and the minimum elevation value of each pixel, and determine a second elevation difference between the minimum elevation value and the maximum elevation value; Determine the arithmetic square root of the sum of squares of the second elevation difference; Determine the ratio between the first elevation difference and the arithmetic square root; The color value of each pixel is determined by multiplying the ratio with a preset value.

[0007] In one embodiment, the step of determining the color parameter values ​​of each pixel based on the color values ​​includes: Get the color values ​​of all neighboring pixels of the current pixel; If the color parameter value of the current pixel is greater than or equal to the set value, and there is a pixel with a color parameter value less than the set value among all the neighboring pixels of the current pixel, the color parameter value of the current pixel is determined according to the preset color parameter value.

[0008] In one embodiment, the step of performing corner point recognition on the color image to obtain the corner point recognition result of the target roof includes: The color image is segmented by rooftop to obtain the color image corresponding to the target rooftop area; Corner point recognition is performed on the color image corresponding to the target roof area to obtain the corner point recognition result of the target roof.

[0009] In one embodiment, the step of performing corner point recognition on the color image corresponding to the target roof area to obtain the corner point recognition result of the target roof includes: Determine the horizontal and vertical gradients of each pixel in the color image corresponding to the target roof area; For each pixel, the covariance matrix of the gradients in its surrounding neighborhood is calculated, wherein the covariance matrix includes the sum of squares of the horizontal gradients, the sum of squares of the vertical gradients, and the product of the horizontal and vertical gradients. Based on the eigenvalues ​​of the covariance matrix, the corner response value of each pixel in the color image is determined; The corner recognition result of the target roof is obtained based on the pixel points corresponding to the corner response values ​​that are greater than a set threshold.

[0010] In one embodiment, the step of determining the target roof outline based on the corner point recognition result includes: The position of each corner point is determined based on the corner point recognition results; Each of the corner points is verified separately to obtain the verification results for each of the corner point positions; Delete the corner points that failed verification, and determine the target roof outline based on the corner points that succeeded in verification.

[0011] In one embodiment, the step of verifying each of the corner positions to obtain the verification results of each of the corner positions includes: When a corner point position simultaneously meets the first, second, and third conditions, the verification result for the corresponding corner point position is determined to be "verification passed". Alternatively, if the corner point position does not meet any one of the first condition, the second condition, or the third condition, the verification result of the corresponding corner point position is determined to be verification failure. The first condition includes: constructing a circle with the corner point as the center and a preset radius, and obtaining two intersection points between the circle and the target roof outline, provided that the angle between the two intersection points and the line connecting them to the corner point is within the range of a preset angle. The second condition includes: obtaining the elevation values ​​of each neighboring pixel of the pixel at the corner position, determining the pixel located in the first elevation value interval and the pixel located in the second elevation value interval based on the elevation values ​​of each neighboring pixel, and if the ratio of the pixel in the first elevation value interval to the pixel in the second elevation value interval is a preset ratio value. The third condition includes: the corner point position is one of the pixels in the target roof area.

[0012] In addition, to achieve the above objectives, this application also proposes an electronic device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the roof outline recognition method as described above.

[0013] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the roof outline recognition method described above.

[0014] This application first obtains an elevation map of the target area, then processes the elevation map into a computer-recognizable color image, identifies corner points in the color image to obtain the corner point recognition results of the target roof, and finally determines the outline of the target roof based on the corner point recognition results. Because corner point recognition is performed after converting the elevation map into a color image, the elevation changes are clearly presented through the color image, which can effectively distinguish the target roof from obstacles, avoid the influence of obstacles on the target roof outline recognition results, and improve the accuracy of the target roof outline. Attached Figure Description

[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A flowchart illustrating the first embodiment of the roof outline identification method of this application; Figure 2 A flowchart illustrating the second embodiment of the roof outline identification method of this application; Figure 3 A schematic flowchart of a second embodiment of the roof outline identification method of this application is provided. Figure 4 Another specific flowchart is provided for the second embodiment of the roof outline identification method of this application; Figure 5 This is a schematic diagram of the color images used in this application; Figure 6 A flowchart illustrating the third embodiment of the roof outline identification method of this application; Figure 7 A schematic flowchart of a third embodiment of the roof outline identification method of this application is provided. Figure 8 A flowchart illustrating the fourth embodiment of the roof outline identification method of this application; Figure 9 This is a schematic diagram of the structure of the electronic device of this application.

[0018] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0019] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0020] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0021] The main solution of this application embodiment is: to obtain an elevation information map corresponding to an optical image of a target area; to construct a color image of the target area based on the elevation information map; to perform corner point recognition on the color image to obtain the corner point recognition result of the target roof; and to determine the outline of the target roof based on the corner point recognition result.

[0022] In this embodiment, for ease of description, the following description uses an electronic device as the execution subject.

[0023] Current technology segments acquired images into instances based on the target rooftop, expands the target rooftop region, and identifies the target rooftop within the expanded region. However, the expanded region introduces obstacle noise, affecting the accuracy of the target rooftop identification.

[0024] This application provides a solution that first acquires an elevation map of the target area, then processes the elevation map into a computer-recognizable color image, identifies corner points in the color image to obtain the corner point recognition results of the target roof, and finally determines the outline of the target roof based on the corner point recognition results. Because corner point recognition is performed after converting the elevation map into a color image, the elevation changes are clearly presented through the color image, which effectively distinguishes the target roof from obstacles, avoiding the influence of obstacles on the target roof outline recognition results and improving the accuracy of the target roof outline.

[0025] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of performing the above functions. The following description uses an electronic device as an example to illustrate this embodiment and the subsequent embodiments.

[0026] Based on this, embodiments of this application provide a method for identifying roof outlines, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the roof outline identification method of this application.

[0027] In this embodiment, the method for identifying the roof outline includes steps S10 to S40: Step S10: Obtain the elevation information map corresponding to the optical image of the target area; It should be noted that the target area can be the construction area of ​​a distributed photovoltaic power station, such as a factory area, and the target area can be specified according to requirements. The optical image is a raw and unprocessed real-world image. In addition to the target roof (i.e., the roof whose edge needs to be identified), the optical image also includes other objects, such as other roof areas, vehicles, roads, trees, etc. The vehicles and trees mentioned here are obstacles mentioned later.

[0028] It's important to note that elevation information maps are generated from elevation data files. These elevation data files, called DSM (Digital Surface Model) files, are crucial data products in Geographic Information Systems (GIS) and remote sensing, used to represent the Earth's surface elevation information. The index points (x, y) in the elevation data file have a one-to-one mapping to the pixels in the optical image. The elevation data file contains three key data points: the x-direction index, the y-direction index, and the elevation value (usually in meters) corresponding to the raster defined by (x, y). By displaying the elevation data file in three dimensions, it can be seen that each raster point has a corresponding elevation, and the elevation differences between raster points create elevation variations. Using these raster points, the gradients of consecutive points can be calculated to form a gradient sequence.

[0029] In one feasible implementation, an optical image of the target area collected by a drone can be acquired, elevation information of each pixel in the optical image can be acquired, and an elevation information map of the target area can be generated based on the elevation information of each pixel.

[0030] Optical images can be acquired in several ways: First, by obtaining optical images of a specified latitude and longitude region from a satellite imagery platform. Second, by obtaining optical images from drone aerial photography. These aerial images are generated by combining multiple images taken by the drone at a specific location within the target factory area along a pre-defined flight path, and are in .tif format. Third, optical images of the target area can be acquired using a high-resolution optical camera or satellite sensor.

[0031] In this system, the pixels of the elevation information map and the optical image are in a one-to-one correspondence, and the elevation information of each pixel can be acquired simultaneously during the acquisition of the optical image. After acquiring the optical image of the target area, the elevation information map of the target area is obtained. The elevation information map corresponding to the optical image can be acquired using technologies such as lidar, stereo vision, or synthetic aperture radar. Specifically, laser scanning technology measures the height of the ground surface to generate a high-precision digital elevation model, thereby obtaining the elevation information of each pixel. Multi-view images are used to calculate the elevation of the terrain, and an elevation model is created through image registration and stereo matching techniques, thus obtaining the elevation information of each pixel. Alternatively, the elevation information of the ground surface can be obtained through radar wave echoes, thus obtaining the elevation information of each pixel, which is suitable for severe weather conditions.

[0032] After acquiring optical images of the target area, an elevation information map of the optical image of the target area is obtained. The elevation information map corresponding to the optical image can be obtained using technologies such as lidar, stereo vision, or synthetic aperture radar. Specifically, laser scanning technology measures the height of the ground surface to generate a high-precision digital elevation model, thereby obtaining the elevation information of each pixel. Multi-view images are used to calculate the terrain elevation, and an elevation model is created through image registration and stereo matching techniques, thereby obtaining the elevation information of each pixel. Alternatively, radar wave echoes can be used to obtain the ground surface height information, thus obtaining the elevation information of each pixel, which is suitable for severe weather conditions.

[0033] In one feasible implementation, obtaining the elevation information map corresponding to the optical image of the target area includes: registering the optical image and the elevation information map to make their spatial coordinates consistent. Geographic Information System (GIS) or computer vision algorithms can be used to achieve image alignment. The registered elevation data is then combined with the optical image to create the elevation information map, which can be generated by mapping the elevation data onto the pixels of the optical image.

[0034] Step S20: Construct a color image of the target area based on the elevation information map; Since elevation information maps are black and white images, they cannot effectively distinguish between target roofs and obstacles. By converting the elevation information map into a color image, the color image clearly presents elevation changes, which can effectively distinguish between target roofs and obstacles, avoiding the influence of obstacles on the target roof outline recognition results and improving the accuracy of the target roof outline. Specifically, this color image can clearly identify roofs and obstacles within the target area.

[0035] In one feasible implementation, since the pixels of the elevation information map and the optical image are in one-to-one correspondence, the elevation value of each pixel is determined based on the elevation information map, the color value of each pixel is determined based on the elevation value, and finally, the initial image is drawn based on the color values ​​of each pixel to obtain the color image of the target area. Because each pixel has a corresponding color value, drawing based on this color value allows for the rendering of various objects within the target area, thus achieving visualization of the objects within the target area.

[0036] In another feasible implementation, the elevation values ​​of each pixel can be determined based on the elevation information map, and the maximum and minimum elevation values ​​can be determined. Based on the maximum and minimum elevation values ​​and the elevation values ​​of each pixel, the color value of each pixel is determined. Finally, the initial image is drawn based on the color values ​​of each pixel to obtain a color image of the target area. Since roofs are generally tall objects within the target area, determining the color value by using the elevation value of each pixel, as well as the maximum and minimum elevation values, and drawing based on these color values, allows for the visualization of the target roof within the target area.

[0037] In another feasible implementation, after acquiring the optical image, the boundaries and regions of each roof are accurately identified and segmented within the optical image. The location and approximate shape of each roof are detected in the optical image, typically described by a rectangular bounding box or a precise boundary. Each pixel in the optical image is classified into its type (e.g., tiled roof, metal roof, etc.), thereby achieving semantic understanding and segmentation of the roofs, resulting in individual roof instances. Simultaneously with the segmentation of the optical image, the elevation data file needs to be segmented accordingly, ensuring that each roof instance has corresponding elevation information. The segmented roofs and their corresponding elevation information maps are in one-to-one correspondence, ensuring that each roof has a corresponding elevation information map. Subsequently, a color image corresponding to each roof instance is constructed based on its elevation information map, which can eliminate interference from other roofs and obstacles, improving the accuracy of the color image.

[0038] Step S30: Perform corner point recognition on the color image to obtain the corner point recognition result of the target roof; It should be noted that the corner point identification result of the target roof can be the position of each corner point of the target roof.

[0039] In this embodiment, for corner detection in the roof area, various corner detection algorithms can be selected, such as Harris corner detection algorithm, SUSAN corner detection algorithm or FAST corner detection algorithm. The corresponding corner detection algorithm can be selected according to different application scenarios. The corresponding corner detection algorithm is used to perform corner recognition on the color image corresponding to the target roof area, thereby obtaining the corner recognition result of the target roof.

[0040] Step S40: Determine the target roof outline based on the corner point recognition results.

[0041] In this embodiment, the corner point recognition result includes the positions of each corner point of the target roof. The outline of the target roof can be obtained by sequentially connecting the corner points of the neighboring area according to the positions of each corner point.

[0042] This embodiment provides a method for identifying roof outlines. First, an elevation map of the target area is acquired. Then, the elevation map is processed into a computer-recognizable color image. Corner points in the color image are identified to obtain the corner point identification results of the target roof. Finally, the outline of the target roof is determined based on the corner point identification results. Because corner point identification is performed after converting the elevation map into a color image, the elevation changes are clearly presented through the color image, which effectively distinguishes the target roof from obstacles, avoiding the influence of obstacles on the target roof outline identification results and improving the accuracy of the target roof outline.

[0043] Based on the above embodiments of this application, in the second embodiment of this application, the same or similar content as the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 Step S20 includes steps S21 to S24: Step S21: Based on the elevation information map, determine the elevation value of each pixel, and determine the maximum and minimum elevation values; Since the elevation information map can be pre-acquired and stored as two-dimensional data, the corresponding two-dimensional data can be obtained. This two-dimensional data can then be traversed to obtain the elevation value of each pixel. After obtaining the elevation values ​​of each pixel, the maximum and minimum elevation values ​​are obtained by comparing them. These maximum and minimum elevation values ​​are then used to determine the color value of each pixel in the subsequent process.

[0044] It should be noted that the drone merges the images it captures into a single top-down view. The edges of this top-down view are composited. If elevation points are missing, they are set to the minimum value by default. For example, the minimum value here can be set to -9999.

[0045] In UAV elevation measurement, -9999 is typically used as a special marker value to indicate that the elevation data for that pixel location is missing, invalid, or undefined. This value plays a crucial role in data processing and transformation, helping to distinguish between valid and invalid data, thus ensuring the accuracy and reliability of subsequent analysis. For example, during UAV flight, due to factors such as the flight angle, elevation data for some areas may be unavailable. Assigning -9999 to these areas clearly identifies the missing data regions, facilitating subsequent data processing and analysis. Furthermore, without a clear marker value to differentiate between valid and invalid data during processing and transformation, missing data might be mistakenly identified as valid, leading to biased analysis results. Assigning -9999 effectively avoids this. In subsequent data processing, pixels with a value of -9999 can be filtered, retaining only valid pixels; that is, the aforementioned pixels are considered valid pixels, and their elevation values ​​are the valid elevation values ​​for those pixels.

[0046] Step S22: Determine the color value of each pixel based on the maximum elevation value, the minimum elevation value, and the elevation value of each pixel. First, define the range of the color mapping. Two common approaches are: 1) Map the elevation values ​​linearly from minimum to maximum to a range in the color space. For example, the minimum elevation value corresponds to one endpoint of the color space (e.g., blue), and the maximum elevation value corresponds to the other endpoint (e.g., red). 2) Map the elevation values ​​to the color space using non-linear functions (e.g., logarithmic or power functions) to achieve different visual effects.

[0047] Next, based on the mapping requirements, select a suitable color model, including: RGB color model: the most commonly used color model, where the color of each pixel is composed of three components: red, green, and blue. HSV color model: describes color through hue, saturation, and brightness. It provides more intuitive control when performing gradient processing on colors.

[0048] Next, based on the selected mapping range and color model, the color value of each pixel is calculated. Taking the RGB model as an example, an elevation normalization value can be calculated based on the maximum elevation value, minimum elevation value, and the elevation value of each pixel. This normalization value is then mapped to the corresponding value in the color model. For the RGB model, a mapping range can be set, for example, from 0 to 255. For the HSV model, the normalized value can be used as the hue value, and saturation and brightness can be adjusted using other algorithms.

[0049] Step S23: Determine the color parameter values ​​of each pixel based on the color values; After obtaining the color value, it needs to be converted into a specific color parameter value. The color value is a specific value. When using the RGB color model, the color parameter value can be the R value, G value, and B value.

[0050] In one feasible implementation, the color value of each pixel can be acquired, the comparison result between the color value of each pixel and a preset value can be determined, and a corresponding color parameter value can be assigned to each pixel according to the comparison result. Different comparison results are assigned different color parameter values. When the color value of a pixel is less than or equal to the preset value, a first preset color parameter value is determined as the color parameter value of that pixel; when the color value of a pixel is greater than the preset value, a second preset color parameter value is determined as the color parameter value of that pixel, thereby assigning different color parameter values ​​to each pixel. The first preset color parameter value and the second preset color parameter value are different and can be set according to actual conditions. The first preset color parameter value can be R = 255, B = 0, G = 0, and the second preset color parameter value can be R = 0, B = 255, G = 0. By assigning corresponding color parameter values ​​to each pixel, the subsequent recognition of the target roof outline can be facilitated.

[0051] In another feasible implementation, the color values ​​of each neighboring pixel of the current pixel are obtained; The color parameter value of the current pixel is determined based on the first comparison result between the color value of the current pixel and the set value, and the second comparison result between the color values ​​of each neighboring pixel of the current pixel and the set value.

[0052] Step S24: Draw the initial image according to the color parameter values ​​of each pixel to obtain the color image of the target area.

[0053] In this embodiment, the calculated color parameter values ​​of each pixel are applied to the corresponding pixel to form the final color image and display it visually. The image file format of the color image can be PNG, JPEG, etc.

[0054] During this process, color parameter values ​​can be further adjusted according to actual needs, such as adjusting the brightness and contrast of colors to ensure that the visual effect meets requirements. Alternatively, color correction techniques (such as gamma correction) can be used to optimize color performance, making the color image more natural or conforming to specific standards.

[0055] In this embodiment, the above steps can effectively convert elevation data into a visually appealing color image, facilitating target roof profile analysis.

[0056] Furthermore, refer to Figure 3 Taking the RGB color model as an example, step S22 includes steps S221 to S224: Step S221: Determine a first elevation difference between the elevation value and the minimum elevation value of each pixel, and determine a second elevation difference between the minimum elevation value and the maximum elevation value; Step S222: Determine the arithmetic square root of the sum of squares of the second elevation difference; Step S223: Determine the ratio between the first elevation difference and the arithmetic square root; Step S224: Determine the color value of each pixel based on the product of the ratio and the preset value.

[0057] The color value of each pixel can be determined using the following formula: .

[0058] in, It is the minimum elevation value. It is the maximum elevation value. The elevation value for each pixel, with 255 as the preset value.

[0059] In this embodiment, a calculation formula is provided to convert the elevation value of a pixel into its color value. By determining the color value of each valid pixel in the black and white elevation information map, the black and white elevation information map is converted into a color image with visual effects, which facilitates the subsequent analysis of the target roof outline.

[0060] Furthermore, refer to Figure 4 Step S23 includes steps S231 to S232: Step S231: Obtain the color values ​​of each neighboring pixel of the current pixel; Step S232: If the color parameter value of the current pixel is greater than or equal to a set value, and there is a pixel with a color parameter value less than the set value among all the neighboring pixels of the current pixel, then the color parameter value of the current pixel is determined according to the preset color parameter value.

[0061] It should be noted that when selecting the target rooftop in the optical image, a certain degree of outward expansion is performed, for example, expanding outward by 50 meters. Within this 50-meter expansion, there are some interfering obstacles. Using the formula mentioned above, these obstacles can be turned black. For example, if the obstacle is a 3-meter tree at a shooting height of 12 meters, the formula is {|3-12|} / 12 * 255 = 192.25. If the rooftop is 10 meters high, the formula is {10-12} / 12 * 255 = 42.5. By judging these values, obstacles of different heights can be isolated from the rooftop, thus preventing interference. Figure 5As shown, the rectangular roof is white, while the obstacles around the roof are black, effectively eliminating the noise from obstacles caused by outward expansion.

[0062] In this embodiment, the set value can be half of the preset value mentioned above, or the set value can be determined according to the actual situation. For example, the set value can be 255 / 2.

[0063] In this embodiment, each pixel has a corresponding neighboring pixel, and each pixel can have 4 or 8 neighboring pixels. By obtaining the neighboring pixels of a pixel and comparing them with a set value, it is determined whether the pixel is a point on the roof or an obstacle noise point, thus realizing the classification of roof points and obstacle noise points.

[0064] For example, suppose each pixel has 4 neighboring pixels. If the color value of the current pixel A, such as its RGB value, is greater than a set value, and the RGB values ​​of the surrounding pixels A1, A2, A3, and A4 of the current pixel A are less than the set value, then the RGB value of the current pixel A is set to 255, B to 0, and G to 0, resulting in a color image.

[0065] It should be noted that the preset color parameter values ​​can be set according to the actual situation. The preset color parameter values ​​are set as the color parameter values ​​of the current pixel to achieve color drawing of the current pixel.

[0066] In this embodiment, the target roof area is identified by determining the color parameters of a pixel and the comparison results between the color parameters of the pixel's neighboring pixels and the set values, and by determining the color parameter values ​​of each pixel based on the comparison results.

[0067] Based on the above embodiments of this application, in the third embodiment of this application, the same or similar content as the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 6 Step S30 includes steps S31 to S32: Step S31: The color image is segmented by rooftop to obtain the color image corresponding to the target rooftop area; In addition to the target roof, the color image also includes other objects. To improve the accuracy of roof recognition, the color image needs to be cropped and segmented to obtain a color image corresponding to each roof region. During actual segmentation, the target roof region needs to be magnified to ensure that the objects around the target roof are included. These objects can serve as reference examples to facilitate subsequent edge point determination.

[0068] In one feasible implementation, appropriate denoising algorithms (such as Gaussian blurring, median filtering) can be used to reduce noise in the color image. Histogram equalization or contrast enhancement techniques can be used to make the color image clearer and easier to process. Feature extraction is performed based on the specific characteristics of the roof (such as shape, color, texture, etc.). Image segmentation algorithms (such as region-based segmentation, edge detection, thresholding, etc.) are used to segment the image into roof regions and non-roof regions. Starting from seed points in the roof regions, a region growing algorithm is used to expand and merge the roof regions. A watershed algorithm is applied for image segmentation to ensure clear roof boundaries. Regions that are too small are removed, as these are unlikely to represent a complete roof. If there are overlapping or partially occluded roof regions, a merging algorithm can be used to ensure that each roof is segmented only once. This method effectively segments the color image, resulting in segmented images of multiple roof units.

[0069] In another feasible implementation, the relative position and extent of the target roof in the color image can also be identified using a single-instance image recognition model. The color image is then cropped based on the relative position and extent to obtain a color image with each roof as a unit.

[0070] Step S32: Perform corner point recognition on the color image corresponding to the target roof area to obtain the corner point recognition result of the target roof.

[0071] In this embodiment, after obtaining the target roof area, corner point recognition is performed on the color image corresponding to the target roof area to obtain the corner point recognition result of the target roof.

[0072] In one feasible implementation, for corner detection in the roof area, various corner detection algorithms can be selected, such as Harris corner detection algorithm, SUSAN corner detection algorithm or FAST corner detection algorithm. The corresponding corner detection algorithm can be selected according to different application scenarios. The corresponding corner detection algorithm is used to perform corner recognition on the color image corresponding to the target roof area, thereby obtaining the corner recognition result of the target roof.

[0073] This embodiment uses the above method to segment the color image to obtain the color image of each roof area, and analyzes the color image of each roof area separately, thereby reducing the amount of detection data and improving the corner point recognition efficiency.

[0074] Furthermore, refer to Figure 7Taking the Harris corner detection algorithm as an example, Harris corner detection is a commonly used image feature detection method for finding corners in an image. It is based on the observation that corners have large gray-level changes and gradient changes. Corners are usually defined as the intersection of two edges, or points within a local neighborhood that are boundaries of two different regions in different directions. Step S32 includes steps S321~S324: Step S321: Determine the horizontal and vertical gradients of each pixel in the color image; In this embodiment, the gradient of the color image is calculated using the Sobel operator or other gradient operators to obtain the gradient values ​​in the horizontal and vertical directions for each pixel, i.e., the horizontal gradient and the vertical gradient. These gradient values ​​reflect the degree of change in the image at that point.

[0075] Step S322: For each pixel, calculate the covariance matrix of the gradients in its surrounding neighborhood, wherein the covariance matrix includes the sum of squares of the horizontal gradients, the sum of squares of the vertical gradients, and the product of the horizontal and vertical gradients. In this embodiment, for each pixel, the covariance matrix of the gradients in its surrounding neighborhood is calculated. This matrix contains the sum of squares of the horizontal gradients, the sum of squares of the vertical gradients, and the product of the horizontal and vertical gradients. This covariance matrix describes the variation of pixel values ​​within a local window of the image.

[0076] Step S323: Based on the eigenvalues ​​of the covariance matrix, determine the corner response value of each pixel in the color image; In this embodiment, the eigenvalues ​​of the covariance matrix are used to calculate the corner response value. Harris corner detection typically uses the response function R = det(M) - k * trace(M)^2, where det(M) represents the determinant of the covariance matrix, trace(M) represents the trace of the covariance matrix (i.e., the sum of the elements on the main diagonal), and k is an empirical constant, typically between 0.04 and 0.06. This response function is used to evaluate whether each pixel is a corner.

[0077] Step S324: Obtain the corner recognition result of the target roof based on the pixel points corresponding to the corner response values ​​that are greater than the set threshold.

[0078] In this embodiment, corner response values ​​are filtered according to a set threshold, retaining only pixels with corner response values ​​greater than the threshold. These pixels are the detected corners. The choice of the set threshold depends on the specific application and the characteristics of the color image.

[0079] In this embodiment, the Harris corner detection algorithm exhibits a certain degree of invariance to rotational changes in the color image, meaning that the detected corner positions remain essentially unchanged after image rotation. The Harris corner detection algorithm also demonstrates adaptability to scale variations in the color image, enabling the detection of stable corners across images of different scales. Furthermore, the Harris corner detection algorithm is relatively simple to compute, allowing for rapid image processing and corner feature extraction.

[0080] Based on the above embodiments of this application, in the fourth embodiment of this application, the same or similar content as the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 8 Step S40 includes steps S41 to S43: Step S41: Determine the position of each corner point based on the corner point recognition results; Step S42: Verify each of the corner points to obtain the verification results for each of the corner points. Step S43: Delete the corner points that failed verification, and determine the target roof outline based on the corner points that succeeded in verification.

[0081] In one embodiment, there exists a scenario where obstacles, such as trees, are the same height as building floors, forming new corner points. These new corner points might be incorrectly identified as corner points of the target roof, affecting the accuracy of the target roof outline. To further improve the accuracy of the identified corner points, each corner point in the corner point identification results needs to be verified. The purpose of verification is to determine whether the position of each corner point in the obtained corner point identification results is a corner point of the target roof. If the verification result for a corner point's position is successful, it indicates that the corner point is a corner point of the target roof and can be retained. If the verification result for a corner point's position is unsuccessful, it indicates that the corner point is not a corner point of the target roof and is deleted.

[0082] Furthermore, step S42 includes either step S421 or step S422: Step S421: When the corner point position simultaneously satisfies the first condition, the second condition, and the third condition, the verification result of the corresponding corner point position is determined to be verified as passed. Alternatively, in step S422, if the corner point position does not meet any one of the first condition, the second condition, or the third condition, the verification result of the corresponding corner point position is determined to be a verification failure.

[0083] The first condition includes: constructing a circle with the corner point as the center and a preset radius, and obtaining two intersection points between the circle and the target roof outline, if the angle between the two intersection points and the line connecting them to the corner point is within the range of a preset angle variation; In this embodiment, the circle intersects the roof outline determined by the corner point recognition result at two points, which are denoted as the first intersection point and the second intersection point, respectively. A first straight line is obtained by connecting the first intersection point and the corner point position, and a second straight line is obtained by connecting the second intersection point and the corner point position. The included angle between the first straight line and the second straight line is obtained. If the included angle is within the range of preset angle variation, the verification result is determined to be verified as passed, indicating that the corner points in the corner point recognition result are all corner points of the target roof.

[0084] It should be noted that the preset angle can be 90°, and the range of variation of the preset angle can be set according to the actual situation, such as ±5°.

[0085] The second condition includes: obtaining the elevation values ​​of each neighboring pixel of the pixel at the corner position, determining the pixel located in the first elevation value interval and the pixel located in the second elevation value interval based on the elevation values ​​of each neighboring pixel, and if the ratio of the pixel in the first elevation value interval to the pixel in the second elevation value interval is a preset ratio value. In this embodiment, the first elevation value interval and the second elevation value interval are different. For example, the first elevation value interval can be used to determine pixels with higher elevation values, and the second elevation value interval can be used to determine pixels with lower elevation values. The preset ratio can be set to 1:4 or 4:3. If the ratio of pixels in the first elevation value interval to pixels in the second elevation value interval is the preset ratio, it means that all corners in the corner recognition result are corners of the target roof.

[0086] The third condition includes: the corner point position is one of the pixels in the target roof area.

[0087] Reference Figure 5 The target roof area is Figure 5 If one of the red borders is a pixel in the target roof area, then the corner points in the corner point recognition result are all corner points of the target roof.

[0088] In other embodiments, if the corner point position does not simultaneously meet the first, second, and third conditions described above, the verification result is determined to be a verification failure. If the verification fails, the point is considered not to be a corner point, and the point is deleted. In the subsequent edge contour connection, the connection of the point is not used.

[0089] In this embodiment, different verification conditions are set to verify the positions of each corner point in the corner point recognition results, thereby improving the accuracy of the corner point position verification results.

[0090] Based on the above embodiments of this application, in another embodiment of this application, the same or similar content as the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, it includes: Step S10: Obtain the elevation information map corresponding to the optical image of the target area; Step S21: Based on the elevation information map, determine the elevation value of each pixel, and determine the maximum and minimum elevation values; Step S221: Determine a first elevation difference between the elevation value and the minimum elevation value of each pixel, and determine a second elevation difference between the minimum elevation value and the maximum elevation value; Step S222: Determine the arithmetic square root of the sum of squares of the second elevation difference; Step S223: Determine the ratio between the first elevation difference and the arithmetic square root; Step S224: Determine the color value of each pixel based on the product of the ratio and the preset value; Step S231: Obtain the color values ​​of each neighboring pixel of the current pixel; Step S232: If the color parameter value of the current pixel is greater than or equal to a set value, and there are pixels with color parameter values ​​less than the set value among all neighboring pixels of the current pixel, determine the color parameter value of the current pixel according to the preset color parameter value. Step S24: Draw the initial image according to the color parameter values ​​of each pixel to obtain the color image of the target area; Step S31: The color image is segmented by rooftop to obtain the color image corresponding to the target rooftop area; Step S321: Determine the horizontal and vertical gradients of each pixel in the color image corresponding to the target roof area; Step S322: For each pixel, calculate the covariance matrix of the gradients in its surrounding neighborhood, wherein the covariance matrix includes the sum of squares of the horizontal gradients, the sum of squares of the vertical gradients, and the product of the horizontal and vertical gradients. Step S323: Based on the eigenvalues ​​of the covariance matrix, determine the corner response value of each pixel in the color image; Step S324: Obtain the corner recognition result of the target roof based on the pixel points corresponding to the corner response values ​​that are greater than the set threshold. Step S411: Determine the position of each corner point based on the corner point recognition results; Step S421: When the corner point position simultaneously satisfies the first condition, the second condition, and the third condition, the verification result of the corresponding corner point position is determined to be verified as passed. Alternatively, in step S422, if the corner point position does not meet any one of the first condition, the second condition, or the third condition, the verification result of the corresponding corner point position is determined to be a verification failure. The first condition includes: constructing a circle with the corner point as the center and a preset radius, and obtaining two intersection points between the circle and the target roof outline, provided that the angle between the two intersection points and the line connecting them to the corner point is within the range of a preset angle. The second condition includes: obtaining the elevation values ​​of each neighboring pixel of the pixel at the corner position, determining the pixel located in the first elevation value interval and the pixel located in the second elevation value interval based on the elevation values ​​of each neighboring pixel, and if the ratio of the pixel in the first elevation value interval to the pixel in the second elevation value interval is a preset ratio value. The third condition includes: the corner point position is one of the pixels in the target roof area.

[0091] Step S43: Delete the corner points that failed verification, and determine the target roof outline based on the corner points that succeeded in verification.

[0092] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the method for identifying the roof outline of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0093] This application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the roof outline recognition method in Embodiment 1 above.

[0094] The following is for reference. Figure 9 The diagram illustrates a structural schematic of an electronic device suitable for implementing embodiments of this application. The electronic devices in these embodiments may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 9 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0095] like Figure 9As shown, the electronic device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the electronic device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. While electronic devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0096] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0097] The electronic device provided in this application, employing the roof outline recognition method described in the above embodiments, can solve the technical problem of low accuracy in the target roof outline recognition results. Compared with the prior art, the beneficial effects of the electronic device provided in this application are the same as those of the roof outline recognition method provided in the above embodiments, and other technical features of the electronic device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.

[0098] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0099] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0100] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the roof outline recognition method described above.

[0101] The computer program product provided in this application can solve the technical problem of low accuracy in the recognition results of target roof outlines. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the roof outline recognition method provided in the above embodiments, and will not be repeated here.

[0102] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method of identifying a roof profile, characterized by, The method comprises: obtaining the height information map corresponding to the optical image of the target region; constructing the color image of the target region based on the height information map; performing corner point recognition on the color image to obtain a corner point recognition result of the target roof; determining the contour of the target roof according to the corner point recognition result.

2. The method of claim 1, wherein, The step of constructing the color image of the target region based on the height information map comprises: determining the height value of each pixel point according to the height information map, and determining the maximum height value and the minimum height value; determining the color value of each pixel point based on the maximum height value, the minimum height value and the height value of each pixel point; determining the color parameter value of each pixel point based on the color value; drawing an initial image according to the color parameter value of each pixel point to obtain the color image of the target region.

3. The method of claim 2, wherein, The step of determining the color value of each pixel point based on the maximum height value, the minimum height value and the height value of each pixel point comprises: determining the first height difference between the height value of each pixel point and the minimum height value, and determining the second height difference between the minimum height value and the maximum height value; determining the arithmetic square root of the square sum of the second height difference; determining the ratio between the first height difference and the arithmetic square root; determining the color value of each pixel point according to the product between the ratio and a preset value.

4. The method of claim 2, wherein, The step of determining the color parameter value of each pixel point based on the color value comprises: obtaining the color value of each neighborhood pixel point of the current pixel point; if the color parameter value of the current pixel point is greater than or equal to a set value, and there is a pixel point with a color parameter value less than the set value in all neighborhood pixel points of the current pixel point, determining the color parameter value of the current pixel point according to a preset color parameter value.

5. The method of claim 1, wherein, The step of performing corner point recognition on the color image to obtain a corner point recognition result of the target roof comprises: segmenting the color image by roof to obtain the color image corresponding to the target roof region; performing corner point recognition on the color image corresponding to the target roof region to obtain the corner point recognition result of the target roof.

6. The method of claim 5, wherein, The step of performing corner point recognition on the color image corresponding to the target roof region to obtain the corner point recognition result of the target roof comprises: determining the horizontal gradient and the vertical gradient of each pixel point in the color image corresponding to the target roof region; for each pixel point, calculating the covariance matrix of the gradients in its surrounding neighborhood, wherein the covariance matrix comprises the square sum of the horizontal gradient, the square sum of the vertical gradient and the product of the horizontal gradient and the vertical gradient; determining the corner point response value of each pixel point in the color image based on the eigenvalue of the covariance matrix; obtaining the corner point recognition result of the target roof according to the pixel points corresponding to the corner point response values greater than a set threshold.

7. The method according to any one of claims 1 to 6, characterized in that, The step of determining the contour of the target roof according to the corner point recognition result comprises: determining each corner point position according to the corner point recognition result; verifying each corner point position respectively to obtain the verification result of each corner point position; delete the corner point position with the failed verification, and determine the target roof profile according to the corner point position with the successful verification.

8. The method of claim 7, wherein, The step of verifying each of the corner point positions respectively to obtain a verification result of each of the corner point positions comprises: When the corner point position satisfies the first condition, the second condition and the third condition at the same time, it is determined that the verification result of the corresponding corner point position is passed; Or, when the corner point position does not satisfy any one of the first condition, the second condition and the third condition, it is determined that the verification result of the corresponding corner point position is failed; The first condition comprises: constructing a circle with the corner point position as the center and a preset radius, and obtaining two intersection points between the circle and the target roof profile, if the included angle of the two intersection points and the corner point position is within a preset angle variation range; The second condition comprises: obtaining the elevation values of each neighborhood pixel point of the pixel point of the corner point position, determining the pixel point in a first elevation value interval and the pixel point in a second elevation value interval according to the elevation values of each neighborhood pixel point, and if the proportion value of the pixel point in the first elevation value interval and the pixel point in the second elevation value interval is a preset proportion value; The third condition comprises: the corner point position is one of the pixel points of the target roof region.

9. An electronic device, comprising: The device comprises a memory, a processor and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the roof profile identification method according to any one of claims 1 to 8.

10. A computer program product, characterised in that, The computer program product comprises a computer program, and the computer program is executed by the processor to implement the steps of the roof profile identification method according to any one of claims 1 to 8.