Photovoltaic construction area generation method and device based on satellite image, and terminal equipment
By iteratively updating the critical threshold and dynamically adjusting the threshold, the problem of inaccurate roof foreign matter recognition in the prior art is solved, and accurate segmentation of roof foreign matter in satellite images and accurate identification of photovoltaic effective areas are achieved.
Patent Information
- Application Number
- CN202510473083.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-04-16
AI Technical Summary
The prior art cannot refinely identify and extract foreign objects on the roof, resulting in insufficient identification and extraction of foreign objects on the roof in satellite images and the inaccurate photovoltaic effective construction areas.
By iteratively updating the critical threshold, the threshold is dynamically adjusted according to the actual grayscale distribution of pixel points in the roof area image, and the foreign object area in the roof is accurately divided, thereby generating an accurate photovoltaic effective area.
Accurate identification and segmentation of roof foreign objects in satellite images, obtain more accurate effective areas for photovoltaic construction, and improve the accuracy of photovoltaic construction area identification.
Smart Images

Figure CN119992368A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data processing, and in particular to a method, device and terminal equipment for generating a photovoltaic construction area based on satellite images. Background Art
[0002] Governments, power grid companies, and photovoltaic investors all hope to accurately and quickly obtain the capacity of photovoltaic power sources that can be built on rooftops. With the development of aerospace technology, high-resolution satellite images contain a variety of rich ground information, which is an important basic data for quickly obtaining the available area of rooftops.
[0003] However, there may be some foreign objects on the roof, such as central air conditioners and debris. These foreign objects will cause the roof's photovoltaic effective area to be inconsistent with the overall area of the roof. The existing building extraction method based on satellite images only uses the roof's availability coefficient to convert the actual available area when determining and estimating the area of foreign objects, and does not perform fine identification and extraction of foreign objects on the roof. The value of the availability coefficient is more dependent on manual experience, which makes the identification and extraction of foreign objects on the roof in satellite images not accurate enough, and it is impossible to obtain an accurate photovoltaic effective construction area. Summary of the invention
[0004] The embodiments of the present invention provide a method, apparatus and terminal device for generating a photovoltaic construction area based on satellite images. The critical threshold is iteratively updated and the threshold is dynamically adjusted according to the actual grayscale distribution of pixels in the roof area image, so that the foreign object area in the roof is accurately segmented based on the threshold to obtain a precise photovoltaic effective area. This can effectively solve the problem in the prior art that there is no fine identification and extraction of foreign objects on the roof, resulting in insufficient accuracy in the identification and determination of foreign objects on the roof in satellite images, and thus the precise photovoltaic effective construction area cannot be obtained.
[0005] An embodiment of the present invention provides a method for generating a photovoltaic construction area based on satellite images, comprising: Acquire a satellite image containing a plurality of roofs, and perform edge detection on each roof in the satellite image to generate a plurality of roof area images; For each roof area image, repeatedly performing a critical threshold generation operation to generate a final critical threshold; wherein the critical threshold is used to segment the roof foreign body area and the roof blank area; The pixel points corresponding to the grayscale values greater than the critical threshold are taken as target pixel points, and then the foreign body area images corresponding to the target pixel points are generated; Performing difference processing on the roof area image and the foreign body area image to generate a photovoltaic construction area corresponding to each roof area image; The critical threshold generation operation includes: Obtaining a current critical threshold; wherein the initial current critical threshold is a preset critical threshold; Generate a foreground area based on the pixel points whose grayscale values are greater than the current critical threshold, and generate a background area based on the pixel points whose grayscale values are not greater than the current critical threshold; calculate the updated critical threshold based on the average grayscale values of all pixels in the foreground area and the background area, and then generate a target difference between the current critical threshold and the updated critical threshold; When it is determined that the target difference is not less than the preset critical difference, the updated critical threshold is used as the current critical threshold for the next critical threshold generation operation; when it is determined that the target difference is less than the preset critical difference, the updated critical threshold is used as the final critical threshold.
[0006] Preferably, performing edge detection on each roof in the satellite image to generate a plurality of roof area images includes: Preprocessing the satellite image to generate a preprocessed satellite image; Perform edge detection on the preprocessed satellite image, and identify the roof edge belonging to the roof in the edge detection result; Perform fitting and repair on the edges of each roof to generate edge fitting results for each roof; According to the edge fitting result of each roof, an edge fitting image of each roof is generated; Holes are filled in the edge fitting image of each roof to generate a roof area image corresponding to each edge fitting image.
[0007] Preferably, the preprocessing of the satellite image to generate a preprocessed satellite image includes: Performing grayscale processing on the satellite image to generate a first grayscale value corresponding to the satellite image; Performing mean filtering on the satellite image after grayscale processing according to the first grayscale value to generate a second grayscale value of the satellite image after mean filtering; A preprocessed satellite image is generated according to the second grayscale value.
[0008] Preferably, performing edge detection on the preprocessed satellite image and identifying the roof edge belonging to the roof in the edge detection result comprises: Get the gradient magnitude of each pixel; Perform non-maximum suppression operations on each gradient amplitude and retain the first edge pixel point with the largest gradient amplitude in the local area of the satellite image; Detecting each first edge pixel point based on a double threshold strategy, extracting second edge pixel points that meet the double threshold strategy, and then connecting each second edge pixel point to generate an initial roof edge image; Perform Hough transform on the initial roof edge image to generate a Hough matrix image; Based on the peak points in the Hough matrix image, straight line segments belonging to the edge of the roof are extracted, and each straight line segment is used as the roof edge belonging to the roof.
[0009] Preferably, performing fitting and repairing on the edges of each roof to generate edge fitting results of each roof includes: Traverse each pixel point in the Hough matrix image and calculate the slope between each pixel point and the first endpoint of each straight line segment; Traverse each slope of each pixel point, and take the pixel point with a slope greater than the preset slope as the edge point to be fitted; Connect each edge point to be fitted with each straight line segment to generate the edge fitting results of each roof.
[0010] Preferably, generating a foreground area according to pixels whose grayscale values are greater than a current critical threshold, and generating a background area according to pixels whose grayscale values are not greater than the current critical threshold, comprises: Performing mean smoothing processing on the roof area image, calculating the gray value of each pixel in the roof area image after the smoothing processing, and calculating the gradient value of each pixel in the roof area image after the smoothing processing; Perform edge detection based on the gradient value of each pixel point to generate a number of edges to be processed for distinguishing the foreground area and the background area; Comparing the grayscale value of each pixel in the roof area image with the current critical threshold; Based on each edge to be processed and the area corresponding to the pixel points greater than the current critical threshold, a foreground area for characterizing the foreign matter is generated; Based on each edge to be processed and the area corresponding to the pixel points not greater than the current critical threshold, a background area for representing the blank area is generated.
[0011] Preferably, the step of calculating the updated critical threshold value according to the average grayscale values of all pixels in the foreground area and the background area includes: Calculate the average grayscale values of all pixels in the foreground area and the background area respectively, and record them as the first grayscale average value and the second grayscale average value respectively; Calculating, according to the first grayscale average value and the second grayscale average value, a ratio for characterizing a relative brightness between a foreground area and a background area; The updated critical threshold is calculated according to the following formula: ; in, is the updated critical threshold in the nth iteration operation, is the ratio, is the preset convergence coefficient.
[0012] Preferably, it also includes: The construction area corresponding to each photovoltaic construction area is calculated according to the following formula: ; in, is the construction area corresponding to the photovoltaic construction area; is the pixel corresponding to the photovoltaic construction area; R is the resolution of the satellite image.
[0013] Based on the above method embodiments, the present invention provides corresponding device embodiments.
[0014] An embodiment of the present invention provides a photovoltaic construction area generation device based on satellite images, comprising: a roof area image generation module, a critical threshold generation module, a foreign body area image generation module and a photovoltaic construction area generation module; The roof area image generation module is used to obtain a satellite image containing a plurality of roofs, and perform edge detection on each roof in the satellite image to generate a plurality of roof area images; The critical threshold generation module is used to use the preset initial critical threshold as the current critical threshold for each roof area image, and repeatedly perform the critical threshold generation operation to generate a final critical threshold; wherein the critical threshold is used to segment the roof foreign body area and the roof blank area; The foreign body region image generation module is used to take the pixel points corresponding to the grayscale value greater than the critical threshold as the target pixel points, and then generate the foreign body region image corresponding to each target pixel point; The photovoltaic construction area generation module is used to perform difference processing on the roof area image and the foreign matter area image to generate a photovoltaic construction area corresponding to each roof area image; The critical threshold generation operation includes: Generate a foreground area based on the pixel points whose grayscale values are greater than the current critical threshold, and generate a background area based on the pixel points whose grayscale values are not greater than the current critical threshold; calculate the updated critical threshold based on the average grayscale values of all pixels in the foreground area and the background area, and then generate a target difference between the current critical threshold and the updated critical threshold; When it is determined that the target difference is not less than the preset critical difference, the updated critical threshold is used as the current critical threshold for the next critical threshold generation operation; when it is determined that the target difference is less than the preset critical difference, the updated critical threshold is used as the final critical threshold.
[0015] Based on the above method embodiments, the present invention provides corresponding terminal device embodiments.
[0016] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, a method for generating a photovoltaic construction area based on satellite images as described in the above-mentioned embodiment of the invention is implemented.
[0017] The following beneficial effects are achieved by implementing the present invention: The embodiment of the present invention provides a method, device and terminal device for generating photovoltaic construction areas based on satellite images. After obtaining a satellite image containing several roofs, the present invention can generate several roof area images based on edge detection, so that each roof area image can also extract and segment the foreign body area image. Specifically, the present invention can obtain a critical threshold for segmenting the roof foreign body area and the roof blank area through iterative calculation and repeated verification. First, a preset initial critical threshold is set as a starting point for each roof area image, and then the critical threshold generation operation is repeatedly performed to gradually optimize and refine the threshold until the termination condition is met. In the iterative process, the updated critical threshold is calculated according to the average gray value of the pixel points in the foreground area and the background area, so that the statistical characteristics of the pixel point distribution are taken into account, so that the threshold obtained by the final iterative calculation can better reflect the gray difference between the foreign body and the blank area on the roof, so that the foreign body area can be more accurately identified. Then the present invention iteratively updates the critical threshold, and dynamically adjusts the threshold according to the actual gray distribution of the pixel points in the roof area image, so that the critical threshold finally obtained can better adapt to the actual gray change of the roof, thereby accurately segmenting the foreign body area in the roof. Finally, when the roof area image and the foreign body area image are subjected to difference processing to generate the photovoltaic construction area corresponding to each roof area image, based on the accurate identification and segmentation process of the foreign body area, the present invention can obtain a more accurate photovoltaic construction effective area. Compared with the prior art, the present invention adopts an iterative calculation and repeated verification method to dynamically adjust the critical threshold based on the actual grayscale distribution of the pixels in the roof area image, so that the foreign body area on the roof can be more accurately identified and segmented, overcoming the limitation of the prior art that only relies on the roof available coefficient for area conversion, thereby improving the accuracy of photovoltaic construction area identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flow chart of a method for generating a photovoltaic construction area based on satellite images provided in one embodiment of the present invention.
[0019] Figure 2 It is a flow chart for generating an effective roof construction area provided by another embodiment of the present invention.
[0020] Figure 3 It is a structural schematic diagram of a photovoltaic construction area generation device based on satellite images provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] like Figure 1 FIG. 1 is a flow chart of a method for generating a photovoltaic construction area based on satellite images provided by an embodiment of the present invention. The method for generating a photovoltaic construction area based on satellite images comprises: Step S1: obtaining a satellite image containing a plurality of roofs, and performing edge detection on each roof in the satellite image to generate a plurality of roof area images; Step S2: for each roof area image, repeatedly performing the critical threshold generation operation to generate a final critical threshold; wherein the critical threshold is used to segment the roof foreign body area and the roof blank area; The critical threshold generation operation includes: Obtaining a current critical threshold; wherein the initial current critical threshold is a preset critical threshold; Generate a foreground area based on the pixel points whose grayscale values are greater than the current critical threshold, and generate a background area based on the pixel points whose grayscale values are not greater than the current critical threshold; calculate the updated critical threshold based on the average grayscale values of all pixels in the foreground area and the background area, and then generate a target difference between the current critical threshold and the updated critical threshold; When it is determined that the target difference is not less than the preset critical difference, the updated critical threshold is used as the current critical threshold for the next critical threshold generation operation; when it is determined that the target difference is less than the preset critical difference, the updated critical threshold is used as the final critical threshold; Step S3: taking the pixel points corresponding to the grayscale values greater than the critical threshold as the target pixel points, and then generating the foreign body area image corresponding to each target pixel point; Step S4: performing difference processing on the roof area image and the foreign matter area image to generate a photovoltaic construction area corresponding to each roof area image.
[0023] For step S1, in a preferred embodiment, performing edge detection on each roof in the satellite image to generate a plurality of roof area images includes: Preprocessing the satellite image to generate a preprocessed satellite image; Perform edge detection on the preprocessed satellite image, and identify the roof edge belonging to the roof in the edge detection result; Perform fitting and repair on the edges of each roof to generate edge fitting results for each roof; According to the edge fitting result of each roof, an edge fitting image of each roof is generated; Holes are filled in the edge fitting image of each roof to generate a roof area image corresponding to each edge fitting image.
[0024] Wherein, when preprocessing the satellite image to generate the preprocessed satellite image, it specifically includes: Performing grayscale processing on the satellite image to generate a first grayscale value corresponding to the satellite image; Performing mean filtering on the satellite image after grayscale processing according to the first grayscale value to generate a second grayscale value of the satellite image after mean filtering; A preprocessed satellite image is generated according to the second grayscale value.
[0025] Specifically, firstly, the building roof image is grayed and median filtered to obtain the preprocessing result of the building roof image. The specific process is as follows: The grayscale processing of the high-resolution roof image is calculated as follows: ; In the formula, is the gray value after processing; , , They are the pixel values of the R, G, and B channels of the original image respectively; The mean filtering algorithm is used to blur the grayscale processed image. The calculation formula is as follows: ; In the formula, is the gray value after mean filtering; is the gray value of the original image; is the template area; L is the total number of pixels contained in the template.
[0026] The embodiment of the present invention can eliminate the influence of color on edge detection and remove noise in the image through grayscale and median filtering, and maintain the edge and detail information of the image while removing the noise. Therefore, through the preprocessing steps, it can provide clearer and more accurate image data for subsequent edge detection, roof area generation, etc.
[0027] Furthermore, when edge detection is performed on the preprocessed satellite image and the roof edge belonging to the roof in the edge detection result is identified, the method specifically includes: Get the gradient magnitude of each pixel; Perform non-maximum suppression operations on each gradient amplitude and retain the first edge pixel point with the largest gradient amplitude in the local area of the satellite image; Detecting each first edge pixel point based on a double threshold strategy, extracting second edge pixel points that meet the double threshold strategy, and then connecting each second edge pixel point to generate an initial roof edge image; Perform Hough transform on the initial roof edge image to generate a Hough matrix image; Based on the peak points in the Hough matrix image, straight line segments belonging to the edge of the roof are extracted, and each straight line segment is used as the roof edge belonging to the roof.
[0028] Specifically, the present invention can use the Canny operator to perform edge detection on the preprocessed image, and identify the edge belonging to the roof in the edge detection result through Hough transform. The specific process includes: The preprocessed image is convolved and denoised using a Gaussian smoothing filter, thereby calculating the gradient magnitude and direction of the denoised image; Further non-maximum suppression is performed on each gradient amplitude to find the local maximum point of the gradient in the image and set other non-local maximum points to 0; schematically, non-maximum suppression compares each pixel with the pixels in its neighborhood, retains the point with the largest local gradient, and sets other non-local maximum points to 0, which helps to refine the edges and remove pseudo-edges.
[0029] The edge segments are found and connected using dual threshold detection to obtain edge detection images. Dual threshold means setting a high threshold and a low threshold. When the gradient amplitude of a pixel is higher than the high threshold, it is directly identified as an edge point. For pixels below the high threshold but higher than the low threshold, if they are connected to the edge points that have been detected, they are also identified as edge points. Edges of different intensities can be captured and connected to form complete edge segments.
[0030] Perform Hough transform on the edge detection image to obtain a Hough matrix; schematically, Hough transform is a technique for detecting shapes (such as straight lines, circles, etc.) from an image. In an embodiment of the present invention, straight line segments can be detected by Hough transform, and Hough transform converts straight lines in the image space into points in the parameter space, and detects straight lines in the image by counting peak points in the parameter space.
[0031] Finally, the peak points in the Hough matrix can be found to extract the straight line segments belonging to the edge of the roof.
[0032] For objects with obvious straight line features such as roofs, Hough transform can accurately extract straight line segments belonging to the edges of the roofs. Therefore, the embodiments of the present invention have strong robustness and adaptability to satellite images taken under different lighting conditions and at different angles, that is, accurate detection and depiction of various roof shapes can be achieved.
[0033] Furthermore, when fitting and repairing the edges of each roof to generate the edge fitting results of each roof, the following steps are specifically included: Traverse each pixel point in the Hough matrix image and calculate the slope between each pixel point and the first endpoint of each straight line segment; Traverse each slope of each pixel point, and take the pixel point with a slope greater than the preset slope as the edge point to be fitted; Connect each edge point to be fitted with each straight line segment to generate the edge fitting results of each roof.
[0034] Specifically, based on the Hough transform detection results, the slope-based edge fitting algorithm is used to fit and repair the incomplete and broken roof edges to obtain the edge fitting results of the roof. The specific process is as follows: Calculate the slope of each straight line based on the detection results of Hough transform ; Traverse each pixel point of the image, calculate the slope of each pixel point and the first endpoint of each straight line segment according to the following formula, and determine the slope with each slope the degree of proximity; ; In the formula, , are the horizontal and vertical coordinates of the pixel respectively; , is the coordinate of the first endpoint of the straight line segment; is the slope of the roof edge detected by Hough transform; M is the number of straight line segments detected by Hough transform; is the slope error threshold set; Connect each one that meets the threshold , so as to obtain the roof edge fitting result, and then fill the holes of the image after the roof edge fitting, such as deleting the connected domain with less than a certain pixel value, and optimize the result through the mathematical morphology algorithm to obtain the extraction result of the roof area, that is, generate the roof area image corresponding to each edge fitting image.
[0035] Among them, the optimization processing of mathematical morphology algorithm, including expansion, corrosion, opening and closing operations, is used to obtain the extraction result of the roof area. .
[0036] The opening operation is to first perform an erosion operation on the image, and then perform an expansion operation to achieve the effect of smoothing the image contour. The closing operation is to first perform an expansion operation on the image, and then perform an erosion operation to achieve the effect of filling the cracks and holes in the image. The opening operation and the closing operation can combine the effects of these two operations, smooth the edge contour of the roof, and fill the cracks and holes at the same time, further improving the extraction quality of the roof area.
[0037] The embodiment of the present invention can connect the broken or incomplete roof edges caused by noise, shadow or other factors through fitting and repair, so that the edge detection result is more complete and accurate. The roof edge after fitting and repair can more accurately define the boundary of the roof, and the roof edge after fitting and repair is smoother and continuous, so that subsequent steps such as hole filling, mathematical morphological processing and other operations can be carried out smoothly, thereby obtaining a more accurate roof area extraction result.
[0038] In a preferred embodiment, Figure 2 Another embodiment of the present invention provides a flow chart for generating an effective construction area of a roof. The present invention can firstly grayscale and median filter the image of the building roof to obtain a preprocessing result of the building roof image; then use the Canny operator to perform edge detection on the preprocessed image, and identify the edge belonging to the roof in the edge detection result through Hough transform; Based on the Hough transform detection results, the slope-based edge fitting algorithm is used to fit and repair the incomplete and broken roof edges to obtain the edge fitting results of the roof. Fill holes in the image after fitting the roof edge, delete the connected domains with less than a certain pixel value, and optimize the results through mathematical morphological algorithms to obtain the extraction results of the roof area; For images with foreign objects on the roof, the threshold segmentation algorithm is used to identify foreign objects on the roof and obtain the foreign object extraction result; the roof area extraction result and the foreign object extraction result are subjected to difference processing to obtain the actual effective area extraction result of the roof; The area of the roof that can be used for photovoltaic construction is calculated based on the extraction results of the effective area of the roof and the image resolution.
[0039] The present invention pre-processes the high-resolution satellite image to initially suppress the influence of spectral heterogeneity; uses the Canny operator to detect the edges of various objects in the image, and identifies the edges belonging to the roof based on the principle of Hough transform detection of straight lines; uses the slope-based edge fitting algorithm to fit the incomplete and broken roof edges; uses hole filling and mathematical morphology algorithms to optimize the image to obtain the final extraction result. Then, for the roof image with foreign objects, a threshold segmentation algorithm is used to identify and extract the roof foreign objects; on this basis, the roof image and the foreign object image are differenced to obtain the effective area of the roof without foreign objects, and the area is calculated. Therefore, the present invention can process the spectral heterogeneity in the high-resolution satellite image and the roof foreign objects that affect the photovoltaic construction, realize the refined extraction of the effective area of the roof, and help to provide more accurate data for the relevant units to obtain the area of the roof where photovoltaic power can be installed, thereby improving the calculation accuracy of the roof photovoltaic buildable capacity.
[0040] For step S2, in a preferred embodiment, the present invention can perform iterative calculation for each roof area image to determine the final critical threshold.
[0041] Specifically, initially, a preset initial critical threshold is used as the current critical threshold; Repeat the following critical threshold generation operations to generate the final critical threshold: Performing mean smoothing processing on the roof area image, calculating the gray value of each pixel in the roof area image after the smoothing processing, and calculating the gradient value of each pixel in the roof area image after the smoothing processing; Perform edge detection based on the gradient value of each pixel point to generate a number of edges to be processed for distinguishing the foreground area and the background area; Comparing the grayscale value of each pixel in the roof area image with the current critical threshold; Based on each edge to be processed and the area corresponding to the pixel points greater than the current critical threshold, a foreground area for characterizing the foreign matter is generated; Based on each edge to be processed and the area corresponding to the pixel points not greater than the current critical threshold, a background area for representing the blank area is generated; Calculate the average grayscale values of all pixels in the foreground area and the background area respectively, and record them as the first grayscale average value and the second grayscale average value respectively; Calculating, according to the first grayscale average value and the second grayscale average value, a ratio for characterizing a relative brightness between a foreground area and a background area; The updated critical threshold is calculated according to the following formula: ; in, is the updated critical threshold in the nth iteration operation, is the ratio, is the preset convergence coefficient; Among them, by calculating the average grayscale values of the foreground area and the background area, and calculating the relative brightness ratio based on these average values, it is possible to more accurately determine which pixels belong to the foreground and which belong to the background, which is more accurate than simply using a fixed threshold in the prior art.
[0042] Then, a target difference between the current critical threshold and the updated critical threshold is calculated; When it is determined that the target difference is not less than the preset critical difference, the updated critical threshold is used as the current critical threshold for the next critical threshold generation operation; When it is determined that the target difference is less than the preset critical difference, the updated critical threshold is used as the final critical threshold. In schematic form, when the change in the threshold is less than the preset critical difference, it means that the threshold has stabilized and the iterative process can be terminated, thereby ensuring that the final threshold is a stable and reliable solution to improve the stability of subsequent photovoltaic construction area generation based on the threshold.
[0043] Schematically, when the mean smoothing is performed on the roof area, the calculation formula is as follows: ; In the formula, is the gray value after mean filtering; is the gray value of the original image; is the template area; L is the total number of pixels contained in the template; Indicatively, when calculating the gradient value of the smoothed image, the calculation formula is as follows: ; In the formula, is the gradient value of the pixel; , are the gradient values of the pixel in the x and y directions respectively.
[0044] The present invention can obtain the critical threshold for segmenting the roof foreign body area and the roof blank area through iterative calculation and repeated verification. First, a preset initial critical threshold is set as the starting point for each roof area image, and then the critical threshold generation operation is repeated to gradually optimize and refine the threshold until the termination condition is met. In the iterative process, the present invention uses an iterative method to automatically adjust the critical threshold according to the specific content of the roof area image. For roof images with different brightness, contrast or texture, a suitable threshold can be found to distinguish the foreground (such as foreign objects) and the background (such as blank area).
[0045] The brightness of the roof in satellite images may be affected by many factors, such as weather, season, time, etc. By iteratively updating the critical threshold, the threshold can be dynamically adjusted according to the actual grayscale distribution of pixels in the roof area image, making it more adaptable to different lighting conditions, thereby improving the recognition accuracy of foreign object areas and blank areas. In the iterative process, the updated critical threshold is calculated based on the average grayscale value of pixels in the foreground area and the background area, taking into account the statistical characteristics of the pixel distribution, which can better reflect the grayscale difference between foreign objects and blank areas on the roof, thereby more accurately identifying them.
[0046] The present invention can generate a more accurate image segmentation result by iteratively adjusting the critical threshold, so that the boundary between the foreground area (such as foreign matter) and the background area (such as blank area) is clearer, thereby improving the visualization effect of the image.
[0047] In a preferred embodiment, the final critical threshold determination may also include the following process: performing Laplace calculation on the image, finding the pixel points with the local maximum threshold, and using the grayscale values of these points as candidate local thresholds. The calculation formula is as follows: ; The threshold is calculated iteratively using the following formula: ; In the formula, is the pixel threshold obtained in the nth iteration; is the convergence coefficient.
[0048] Schematically, the Laplace operator is a second-order differential operator, which is commonly used for image enhancement and edge detection. By calculating the second-order derivative of the image, the mutation point in the image, that is, the edge or the area with large local grayscale changes, can be detected. In this embodiment, the Laplace operator is used to find the pixel point with the local maximum threshold, and the gradient value of each pixel point is calculated on the smoothed image, which can determine which are the boundary points between the foreground and the background in the image. Then, through the gradient calculation, the approximate position and direction information of the edge in the image can be obtained. Then, the Laplace operator is applied to these edge positions to obtain more accurate edge positioning results.
[0049] After determining the candidate local thresholds, an iterative method is used to further fine-tune these thresholds. Through iteration, an optimal threshold can be gradually approached, making the segmentation between the foreground and the background more accurate.
[0050] For step S3, in a preferred embodiment, the present invention can generate a foreign body region image by accurately determining the critical threshold. First, traverse each pixel of the image and compare its grayscale value with the previously determined critical threshold. If the grayscale value of a certain pixel is greater than the critical threshold, then the pixel is considered to be a target pixel, and these target pixels usually belong to the foreground area in the image, that is, the foreign body region of interest of the present invention.
[0051] All target pixels (i.e. pixels with grayscale values greater than the critical threshold) are combined to form a new image, which is the foreign body region image. This image only contains the foreground region (foreign bodies) in the original image, while the background region is ignored or set to black (or other colors that are clearly distinguishable from the foreground).
[0052] Schematically, the generated foreign body region image may also be post-processed, such as morphological operations (erosion, dilation, opening operation, closing operation, etc.) to further smooth edges, remove noise, or fill holes.
[0053] Then, threshold segmentation is performed inside the roof, and the formula is as follows: ; In the formula, This is a binary image containing only foreign objects after threshold segmentation. The binary image containing only foreign objects can be optimized using a mathematical morphological algorithm to obtain the foreign object extraction result after optimization. , that is, the foreign body area image.
[0054] For step S4, in a preferred embodiment, the roof area extraction result and the foreign matter extraction result are subjected to difference processing to obtain the actual effective area extraction result of the roof. The difference calculation formula is as follows: ; In the formula, The photovoltaic construction area corresponding to the roof area image; is the roof area image; This is the image of the foreign body area.
[0055] In a preferred embodiment, the present invention further comprises: The construction area corresponding to each photovoltaic construction area is calculated according to the following formula: ; in, is the construction area corresponding to the photovoltaic construction area; is the pixel corresponding to the photovoltaic construction area; R is the resolution of the satellite image.
[0056] In summary, the present invention can accurately extract the photovoltaic construction area on the roof and calculate the construction area of each area, providing strong support for the planning and construction of photovoltaic power stations.
[0057] like Figure 3 As shown, based on the above-mentioned various embodiments of the method for generating a photovoltaic construction area based on satellite images, the present invention provides a corresponding device embodiment; An embodiment of the present invention provides a photovoltaic construction area generation device based on satellite images, comprising: a roof area image generation module, a critical threshold generation module, a foreign body area image generation module and a photovoltaic construction area generation module; The roof area image generation module is used to obtain a satellite image containing a plurality of roofs, and perform edge detection on each roof in the satellite image to generate a plurality of roof area images; The critical threshold generation module is used to use the preset initial critical threshold as the current critical threshold for each roof area image, and repeatedly perform the critical threshold generation operation to generate a final critical threshold; wherein the critical threshold is used to segment the roof foreign body area and the roof blank area; The foreign body region image generation module is used to take the pixel points corresponding to the grayscale value greater than the critical threshold as the target pixel points, and then generate the foreign body region image corresponding to each target pixel point; The photovoltaic construction area generation module is used to perform difference processing on the roof area image and the foreign matter area image to generate a photovoltaic construction area corresponding to each roof area image; The critical threshold generation operation includes: Generate a foreground area based on the pixel points whose grayscale values are greater than the current critical threshold, and generate a background area based on the pixel points whose grayscale values are not greater than the current critical threshold; calculate the updated critical threshold based on the average grayscale values of all pixels in the foreground area and the background area, and then generate a target difference between the current critical threshold and the updated critical threshold; When it is determined that the target difference is not less than the preset critical difference, the updated critical threshold is used as the current critical threshold for the next critical threshold generation operation; when it is determined that the target difference is less than the preset critical difference, the updated critical threshold is used as the final critical threshold.
[0058] It should be noted that the device embodiments described above are merely schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, and may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art can understand and implement it without paying creative labor.
[0059] Those skilled in the art can clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0060] Based on the above-mentioned various embodiments of the method for generating photovoltaic construction areas based on satellite images, the present invention provides corresponding embodiments of terminal equipment items.
[0061] An embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, a method for generating a photovoltaic construction area based on satellite images as described in any method embodiment of the present invention is implemented.
[0062] The terminal device may be a computing terminal device such as a desktop computer, a notebook, a palm computer, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0063] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.
[0064] The memory can be used to store the computer program, and the processor realizes various functions of the terminal device by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device or other volatile solid-state storage device.
[0065] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for generating photovoltaic construction areas based on satellite images, characterized in that: include: Acquire a satellite image containing a plurality of roofs, and perform edge detection on each roof in the satellite image to generate a plurality of roof area images; For each roof area image, repeatedly performing a critical threshold generation operation to generate a final critical threshold; wherein the critical threshold is used to segment the roof foreign body area and the roof blank area; The pixel points corresponding to the grayscale values greater than the critical threshold are taken as target pixel points, and then the foreign body area images corresponding to the target pixel points are generated; Performing difference processing on the roof area image and the foreign body area image to generate a photovoltaic construction area corresponding to each roof area image; The critical threshold generation operation includes: Obtaining a current critical threshold; wherein the initial current critical threshold is a preset critical threshold; Generate a foreground area based on the pixel points whose grayscale values are greater than the current critical threshold, and generate a background area based on the pixel points whose grayscale values are not greater than the current critical threshold; calculate the updated critical threshold based on the average grayscale values of all pixels in the foreground area and the background area, and then generate a target difference between the current critical threshold and the updated critical threshold; When it is determined that the target difference is not less than the preset critical difference, the updated critical threshold is used as the current critical threshold for the next critical threshold generation operation; when it is determined that the target difference is less than the preset critical difference, the updated critical threshold is used as the final critical threshold.
2. A method for generating a photovoltaic construction area based on satellite images as claimed in claim 1, characterized in that: The step of performing edge detection on each roof in the satellite image to generate a plurality of roof area images includes: Preprocessing the satellite image to generate a preprocessed satellite image; Perform edge detection on the preprocessed satellite image, and identify the roof edge belonging to the roof in the edge detection result; Perform fitting and repair on the edges of each roof to generate edge fitting results for each roof; According to the edge fitting result of each roof, an edge fitting image of each roof is generated; Holes are filled in the edge fitting image of each roof to generate a roof area image corresponding to each edge fitting image.
3. A method for generating a photovoltaic construction area based on satellite images as claimed in claim 2, characterized in that: The preprocessing of the satellite image to generate a preprocessed satellite image includes: Performing grayscale processing on the satellite image to generate a first grayscale value corresponding to the satellite image; Performing mean filtering on the satellite image after grayscale processing according to the first grayscale value to generate a second grayscale value of the satellite image after mean filtering; A preprocessed satellite image is generated according to the second grayscale value.
4. A method for generating a photovoltaic construction area based on satellite images as claimed in claim 3, characterized in that: The performing edge detection on the preprocessed satellite image and identifying the roof edge belonging to the roof in the edge detection result includes: Get the gradient magnitude of each pixel; Perform non-maximum suppression operations on each gradient amplitude and retain the first edge pixel point with the largest gradient amplitude in the local area of the satellite image; Detecting each first edge pixel point based on a double threshold strategy, extracting second edge pixel points that meet the double threshold strategy, and then connecting each second edge pixel point to generate an initial roof edge image; Perform Hough transform on the initial roof edge image to generate a Hough matrix image; Based on the peak points in the Hough matrix image, straight line segments belonging to the edge of the roof are extracted, and each straight line segment is used as the roof edge belonging to the roof.
5. A method for generating a photovoltaic construction area based on satellite images as claimed in claim 4, characterized in that: The step of fitting and repairing the edges of each roof to generate edge fitting results of each roof includes: Traverse each pixel point in the Hough matrix image and calculate the slope between each pixel point and the first endpoint of each straight line segment; Traverse each slope of each pixel point, and take the pixel point with a slope greater than the preset slope as the edge point to be fitted; Connect each edge point to be fitted with each straight line segment to generate the edge fitting results of each roof.
6. A method for generating a photovoltaic construction area based on satellite images as claimed in claim 5, characterized in that: The step of generating a foreground area according to pixels whose grayscale values are greater than a current critical threshold, and generating a background area according to pixels whose grayscale values are not greater than the current critical threshold, comprises: Performing mean smoothing processing on the roof area image, calculating the gray value of each pixel in the roof area image after the smoothing processing, and calculating the gradient value of each pixel in the roof area image after the smoothing processing; Perform edge detection based on the gradient value of each pixel point to generate a number of edges to be processed for distinguishing the foreground area and the background area; Comparing the grayscale value of each pixel in the roof area image with the current critical threshold; Based on each edge to be processed and the area corresponding to the pixel points greater than the current critical threshold, a foreground area for characterizing the foreign matter is generated; Based on each edge to be processed and the area corresponding to the pixel points not greater than the current critical threshold, a background area for representing the blank area is generated.
7. A method for generating a photovoltaic construction area based on satellite images as claimed in claim 6, characterized in that: The updated critical threshold is calculated based on the average grayscale values of all pixels in the foreground area and the background area, including: Calculate the average grayscale values of all pixels in the foreground area and the background area respectively, and record them as the first grayscale average value and the second grayscale average value respectively; Calculating, according to the first grayscale average value and the second grayscale average value, a ratio for characterizing a relative brightness between a foreground area and a background area; The updated critical threshold is calculated according to the following formula: ; in, is the updated critical threshold in the nth iteration operation, is the ratio, is the preset convergence coefficient.
8. The method for generating a photovoltaic construction area based on satellite images according to claim 1, characterized in that: Also includes: The construction area corresponding to each photovoltaic construction area is calculated according to the following formula: ; in, is the construction area corresponding to the photovoltaic construction area; is the pixel corresponding to the photovoltaic construction area; R is the resolution of the satellite image.
9. A photovoltaic construction area generation device based on satellite images, characterized in that: include: Roof area image generation module, critical threshold generation module, foreign body area image generation module and photovoltaic construction area generation module; The roof area image generation module is used to obtain a satellite image containing a plurality of roofs, and perform edge detection on each roof in the satellite image to generate a plurality of roof area images; The critical threshold generation module is used to use the preset initial critical threshold as the current critical threshold for each roof area image, and repeatedly perform the critical threshold generation operation to generate a final critical threshold; wherein the critical threshold is used to segment the roof foreign body area and the roof blank area; The foreign body region image generation module is used to take the pixel points corresponding to the grayscale value greater than the critical threshold as the target pixel points, and then generate the foreign body region image corresponding to each target pixel point; The photovoltaic construction area generation module is used to perform difference processing on the roof area image and the foreign matter area image to generate a photovoltaic construction area corresponding to each roof area image; The critical threshold generation operation includes: Generate a foreground area based on the pixel points whose grayscale values are greater than the current critical threshold, and generate a background area based on the pixel points whose grayscale values are not greater than the current critical threshold; calculate the updated critical threshold based on the average grayscale values of all pixels in the foreground area and the background area, and then generate a target difference between the current critical threshold and the updated critical threshold; When it is determined that the target difference is not less than the preset critical difference, the updated critical threshold is used as the current critical threshold for the next critical threshold generation operation; when it is determined that the target difference is less than the preset critical difference, the updated critical threshold is used as the final critical threshold.
10. A terminal device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, a method for generating a photovoltaic construction area based on satellite images as described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Polar region ice cover freezing and thawing detection method and device and computer readable storage medium
CN113240694A
Roof photovoltaic potential anti-interference evaluation method based on satellite image
CN114549998A
Distributed photovoltaic developable capacity prediction method and system
CN119809037A
Classification of land based on analysis of remotely-sensed earth images
US20150071528A1
Single Parameter Segmentation of Images
US20170178341A1
Cited By
Image specific point detection method and device, display equipment, electronic equipment, storage medium and chip
CN120260085A