Method, device and terminal device for generating photovoltaic construction area based on satellite images

By iteratively updating the critical threshold and dynamic adjustment threshold, the problem of inaccurate identification of roof foreign object areas in satellite images is solved, and the precise identification and segmentation of the effective construction area of ​​photovoltaics is achieved, and the recognition accuracy is improved.

CN119992368BActive Publication Date: 2025-06-20GUANGDONG POWER GRID CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510473083.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-06-20
Estimated Expiration
2045-04-16

AI Technical Summary

Technical Problem

The prior art cannot finely identify and extract foreign object areas on the roof in satellite images, resulting in insufficient identification of photovoltaic effective construction areas.

Method used

By iteratively updating the critical threshold and dynamically adjusting the threshold according to the actual grayscale distribution of pixel points in the roof area image, the foreign object area in the roof is divided, thereby generating an accurate photovoltaic effective area.

Benefits of technology

The accurate identification and segmentation of roof foreign object areas in satellite images is achieved, the identification accuracy of effective areas for photovoltaic construction is improved, and the limitations of relying on available coefficients for area conversion in the prior art is overcome.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119992368B_ABST
    Figure CN119992368B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device and terminal device for generating a photovoltaic construction area based on satellite images. After obtaining a satellite image containing several roofs, several roof area images can be generated based on edge detection, and then the foreign object area images of each roof area image can be extracted and segmented. By iterative calculation and repeated verification, a critical threshold for segmenting the roof foreign object area and the roof blank area is obtained. During the iteration 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, thereby considering the statistical characteristics of the pixel point distribution. Therefore, the present invention can dynamically adjust the critical threshold based on the actual gray distribution of the pixel points in the roof area image, so as to more accurately identify and segment the foreign object area on the roof, overcome the limitation of only relying on the roof utilization coefficient for area conversion in the prior art, and thus improve the accuracy of photovoltaic construction area recognition.
Need to check novelty before this filing date? Find Prior Art

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 device for generating a photovoltaic construction area based on satellite images. Background Art

[0002] With the development of space technology, high-resolution satellite images contain various rich ground object information, which is an important basic material for quickly obtaining the available area of roofs.

[0003] However, there will be some foreign objects such as central air conditioners and sundries above the roof. These foreign objects will cause the effective available area of the roof for photovoltaic to not match the overall area of the roof. In the existing building extraction methods based on satellite images, when determining and estimating the area of foreign objects, only the available coefficient of the roof is used to convert the actual available area, and the foreign objects on the roof are not refinedly identified and extracted. Moreover, the value of the available coefficient depends more on manual experience, resulting in inaccurate identification and extraction of foreign objects on the roof in satellite images, and thus an accurate photovoltaic effective construction area cannot be obtained. Summary of the Invention

[0004] Embodiments of the present invention provide a method, device and terminal device for generating a photovoltaic construction area based on satellite images. By iteratively updating the critical threshold and dynamically adjusting the threshold according to the actual gray-scale distribution of pixel points in the roof area image, the foreign object area on the roof is accurately segmented based on the threshold to obtain an accurate photovoltaic effective area, which can effectively solve the problem in the prior art that the foreign objects on the roof are not refinedly identified and extracted, resulting in inaccurate identification and determination of foreign objects on the roof in satellite images, and thus an accurate 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, including:

[0006] Obtain a satellite image containing several roofs, and perform edge detection on each roof in the satellite image to generate several roof area images;

[0007] For each roof area image, repeatedly perform a critical threshold generation operation to generate a final critical threshold; wherein, the critical threshold is used to segment the roof foreign object area and the roof blank area;

[0008] Take the pixel points corresponding to the gray-scale values greater than the critical threshold as target pixel points, and then generate a foreign object area image corresponding to each target pixel point;

[0009] Perform a difference processing on the roof area image and the foreign object area image to generate a photovoltaic construction area corresponding to each roof area image;

[0010] Among them, the operation of generating the critical threshold includes:

[0011] Obtain the current critical threshold; among them, the initial current critical threshold is the preset critical threshold;

[0012] Generate a foreground region based on the pixel points with gray values greater than the current critical threshold, and generate a background region based on the pixel points with gray values not greater than the current critical threshold; calculate the updated critical threshold according to the average gray value of all pixel points in the foreground region and the background region, and then generate the target difference between the current critical threshold and the updated critical threshold;

[0013] When it is determined that the target difference is not less than the preset critical difference, use the updated critical threshold 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, use the updated critical threshold as the final critical threshold.

[0014] Preferably, the edge detection of each roof in the satellite image to generate a plurality of roof region images includes:

[0015] Preprocess the satellite image to generate a preprocessed satellite image;

[0016] Perform edge detection on the preprocessed satellite image to identify the roof edges belonging to the roof in the edge detection result;

[0017] Perform fitting and repair on each roof edge to generate the edge fitting result of each roof;

[0018] Generate an edge fitting image for each roof according to the edge fitting result of each roof;

[0019] Perform hole filling on the edge fitting image of each roof to generate the roof region image corresponding to each edge fitting image.

[0020] Preferably, the preprocessing of the satellite image to generate a preprocessed satellite image includes:

[0021] Perform gray processing on the satellite image to generate the first gray value corresponding to the satellite image;

[0022] Perform mean filtering on the gray-processed satellite image according to the first gray value to generate the second gray value after mean filtering of the satellite image;

[0023] Generate a preprocessed satellite image according to the second gray value.

[0024] Preferably, the edge detection of the preprocessed satellite image to identify the roof edges belonging to the roof includes:

[0025] Obtain the gradient magnitude of each pixel point;

[0026] Perform non-maximum suppression on each gradient magnitude, and retain the first edge pixel points with the maximum gradient magnitude in the local area of the satellite image;

[0027] Detect each first edge pixel point based on the double-threshold strategy, extract the second edge pixel points that meet the double-threshold strategy, and then connect each second edge pixel point to generate an initial roof edge image;

[0028] Perform Hough transform on the initial roof edge image to generate a Hough matrix image;

[0029] Based on the peak points in the Hough matrix image, extract the straight line segments belonging to the roof edge, and use each straight line segment as the roof edge belonging to the roof.

[0030] Preferably, the fitting and repairing of each roof edge to generate the edge fitting result of each roof includes:

[0031] Traverse each pixel point in the Hough matrix image, and calculate the slope of each pixel point and the start and end points of each straight line segment;

[0032] Traverse the slopes of each pixel point, and use the pixel points with slopes greater than the preset slope as the edge points to be fitted;

[0033] Connect each edge point to be fitted with each straight line segment to generate the edge fitting result of each roof.

[0034] Preferably, the generation of the foreground region based on the pixel points with gray values greater than the current critical threshold and the generation of the background region based on the pixel points with gray values not greater than the current critical threshold include:

[0035] Perform mean smoothing on the roof region image, calculate the gray value of each pixel point in the smoothed roof region image, and calculate the gradient value of each pixel point in the smoothed roof region image;

[0036] Perform edge detection based on the gradient value of each pixel point to generate several edges to be processed for distinguishing the foreground region and the background region;

[0037] Compare the gray value of each pixel point in the roof region image with the current critical threshold;

[0038] Based on each edge to be processed and the region corresponding to the pixel points greater than the current critical threshold, generate a foreground region representing the presence of foreign objects;

[0039] Generate a background region for characterizing the blank region based on each edge to be processed and the region corresponding to the pixel points not greater than the current critical threshold.

[0040] Preferably, the calculating the updated critical threshold according to the average gray value of all pixel points in the foreground region and the background region includes:

[0041] Calculate the average gray value of all pixel points in the foreground region and the background region respectively, and denote them as the first gray average value and the second gray average value respectively;

[0042] Calculate a ratio for characterizing the relative brightness between the foreground region and the background region according to the first gray average value and the second gray average value;

[0043] Calculate the updated critical threshold according to the following formula:

[0044] ;

[0045] Wherein, is the updated critical threshold in the nth iteration operation, is the ratio, is a preset convergence coefficient.

[0046] Preferably, it further includes:

[0047] Calculate the construction area corresponding to each photovoltaic construction area according to the following formula:

[0048] ;

[0049] Wherein, 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.

[0050] Based on the above method embodiments, the present invention correspondingly provides apparatus embodiments.

[0051] An embodiment of the present invention provides a device for generating a photovoltaic construction area based on satellite images, including: a roof area image generation module, a critical threshold generation module, a foreign object area image generation module, and a photovoltaic construction area generation module;

[0052] The roof area image generation module is used to obtain a satellite image containing several roofs, and perform edge detection on each roof in the satellite image to generate several roof area images;

[0053] The critical threshold generation module is configured to use a preset initial critical threshold as the current critical threshold for each roof area image, and repeatedly execute the critical threshold generation operation to generate a final critical threshold; wherein, the critical threshold is used to segment the roof foreign object area and the roof blank area.

[0054] The foreign object area image generation module is configured to use the pixel points corresponding to the gray values greater than the critical threshold as target pixel points, and then generate a foreign object area image corresponding to each target pixel point.

[0055] The photovoltaic construction area generation module is configured to perform a difference operation on the roof area image and the foreign object area image to generate a photovoltaic construction area corresponding to each roof area image.

[0056] Wherein, the generation operation of the critical threshold includes:

[0057] Generate a foreground area based on the pixel points with gray values greater than the current critical threshold, and generate a background area based on the pixel points with gray values not greater than the current critical threshold; calculate an updated critical threshold based on the average gray value of all pixel points in the foreground area and the background area, and then generate a target difference between the current critical threshold and the updated critical threshold.

[0058] When it is determined that the target difference is not less than a preset critical difference, use the updated critical threshold 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, use the updated critical threshold as the final critical threshold.

[0059] Based on the above method embodiments, the present invention correspondingly provides embodiments of a terminal device.

[0060] 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. When the processor executes the computer program, it implements the method for generating a photovoltaic construction area based on satellite images described in the above embodiments of the present invention.

[0061] By implementing the present invention, the following beneficial effects are achieved:

[0062] An embodiment of the present invention provides a method, device, and terminal device for generating a photovoltaic construction area 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, and then for each roof area image, a foreign object area image can also be extracted and segmented. Specifically, the present invention can obtain a critical threshold for segmenting the roof foreign object area and the roof blank area through iterative calculation and repeated verification. First, a preset initial critical threshold is set for each roof area image as a starting point, and then the critical threshold generation operation is repeatedly executed to gradually optimize and refine this threshold until the termination condition is met. During the iteration process, the updated critical threshold is calculated based on the average gray value of the pixel points in the foreground area and the background area, thereby considering the statistical characteristics of the pixel point distribution, so that the threshold obtained by the final iterative calculation can better reflect the gray difference between the foreign objects and the blank area on the roof, and thus the foreign object 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 finally obtained critical threshold can better adapt to the actual gray change of the roof, and thus accurately segment the foreign object area in the roof. Finally, when generating the photovoltaic construction area corresponding to each roof area image by performing a difference operation on the roof area image and the foreign object area image, based on the above process of accurately identifying and segmenting the foreign object area, the present invention can obtain a more accurate effective photovoltaic construction area. Compared with the prior art, the present invention adopts the method of iterative calculation and repeated verification, and dynamically adjusts the critical threshold based on the actual gray distribution of the pixel points in the roof area image, so that the foreign object area on the roof can be more accurately identified and segmented, overcoming the limitation of only relying on the roof utilization coefficient for area conversion in the prior art, thereby improving the accuracy of photovoltaic construction area recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 FIG. is a schematic flowchart of a method for generating a photovoltaic construction area based on satellite images according to an embodiment of the present invention.

[0064] Figure 2 FIG. is a flowchart for generating an effective construction area of a roof according to another embodiment of the present invention.

[0065] Figure 3 FIG. is a schematic structural diagram of a device for generating a photovoltaic construction area based on satellite images according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0066] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0067] As Figure 1 shown, it is a schematic flowchart 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 includes:

[0068] Step S1: Obtain a satellite image containing several roofs, and perform edge detection on each roof in the satellite image to generate several roof area images;

[0069] Step S2: For each roof area image, repeatedly perform a critical threshold generation operation to generate a final critical threshold; wherein, the critical threshold is used to divide the roof foreign object area and the roof blank area;

[0070] Among them, the generation operation of the critical threshold includes:

[0071] Obtain the current critical threshold; wherein, the initial current critical threshold is a preset critical threshold;

[0072] Generate a foreground area according to the pixel points with gray values greater than the current critical threshold, and generate a background area according to the pixel points with gray values not greater than the current critical threshold; calculate the updated critical threshold according to the average gray value of all pixel points in the foreground area and the background area, and then generate the target difference between the current critical threshold and the updated critical threshold;

[0073] When it is determined that the target difference is not less than the preset critical difference, use the updated critical threshold 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, use the updated critical threshold as the final critical threshold;

[0074] Step S3: Use the pixel points corresponding to the gray values greater than the critical threshold as target pixel points, and then generate foreign object area images corresponding to each target pixel point;

[0075] Step S4: Perform a difference operation on the roof area image and the foreign object area image to generate a photovoltaic construction area corresponding to each roof area image.

[0076] For step S1, in a preferred embodiment, the performing edge detection on each roof in the satellite image to generate several roof area images includes:

[0077] Preprocess the satellite image to generate a preprocessed satellite image;

[0078] Perform edge detection on the preprocessed satellite image to identify the roof edges belonging to the roof in the edge detection results;

[0079] Fit and repair each roof edge to generate the edge fitting result of each roof;

[0080] Generate an edge fitting image for each roof based on the edge fitting result of each roof;

[0081] Perform hole filling on the edge fitting image of each roof to generate a roof area image corresponding to each edge fitting image.

[0082] Among them, when preprocessing the satellite image to generate a preprocessed satellite image, it specifically includes:

[0083] Perform grayscale processing on the satellite image to generate the first grayscale value corresponding to the satellite image;

[0084] Perform mean filtering on the grayscale processed satellite image according to the first grayscale value to generate the second grayscale value after mean filtering of the satellite image;

[0085] Generate a preprocessed satellite image according to the second grayscale value.

[0086] Specifically, first perform grayscale and median filtering on the building roof image to obtain the preprocessing result of the building roof image. The specific process is as follows:

[0087] Perform grayscale processing on the high-resolution roof image. The calculation formula is as follows:

[0088] ;

[0089] In the formula, is the processed grayscale value; , , are the pixel values of the R, G, and B channels of the original image respectively;

[0090] Use the mean filtering algorithm to blur the grayscale processed image. The calculation formula is as follows:

[0091] ;

[0092] In the formula, is the grayscale value after mean filtering; is the grayscale value of the original image; is the template area; L is the total number of pixels included in the template.

[0093] Therefore, through grayscale conversion and median filtering, the embodiments of the present invention can eliminate the influence of color on edge detection and remove the noise in the image, and while removing the noise, maintain the edges and detail information of the image. Thus, through the preprocessing step, clearer and more accurate image data can be provided for subsequent edge detection, roof area generation, etc.

[0094] Further, when performing edge detection on the preprocessed satellite image and identifying the roof edges belonging to the roof in the edge detection results, it specifically includes:

[0095] Obtain the gradient magnitude of each pixel point;

[0096] Perform non-maximum suppression on each gradient magnitude, and retain the first edge pixels with the maximum gradient magnitude in the local area of the satellite image;

[0097] Based on the double-threshold strategy, detect each first edge pixel point, extract the second edge pixel points that meet the double-threshold strategy, and then connect each second edge pixel point to generate an initial roof edge image;

[0098] Perform Hough transform on the initial roof edge image to generate a Hough matrix image;

[0099] Based on the peak points in the Hough matrix image, extract the straight line segments belonging to the roof edges, and use each straight line segment as the roof edge belonging to the roof.

[0100] Specifically, the present invention can use the Canny operator to perform edge detection on the preprocessed image, and identify the edges belonging to the roof in the edge detection results through Hough transform. The specific process includes:

[0101] Use a Gaussian smoothing filter to perform convolution denoising on the preprocessed image, and then calculate the gradient magnitude and direction of the denoised image;

[0102] Further perform non-maximum suppression on each gradient magnitude, find the local maximum points of the gradient in the image, and set other non-local maximum points to 0; schematically, non-maximum suppression compares each pixel point with the pixel points in its neighborhood, retains the points with the local maximum gradient, and sets other non-local maximum points to 0, which helps to refine the edges and remove false edges.

[0103] Edge segments are found and connected using double - threshold detection to obtain an edge - detected image. Among them, the double - threshold means setting a high threshold and a low threshold. When the gradient magnitude of a certain pixel is higher than the high threshold, it is directly recognized as an edge point. For pixel points that are lower than the high threshold but higher than the low threshold, if they are connected to the edge points that have been detected, they are also recognized as edge points. Then, edges of different intensities can be captured and connected to form complete edge segments.

[0104] Perform the Hough transform on the edge - detected image to obtain a Hough matrix. Schematically, the Hough transform is a technique for detecting shapes (such as straight lines, circles, etc.) from an image. In the embodiments of the present invention, straight line segments can be detected through the Hough transform. The Hough transform converts straight lines in the image space into points in the parameter space and detects straight lines in the image by statistically analyzing the peak points in the parameter space.

[0105] Finally, peak points in the Hough matrix can be found to extract the straight line segments belonging to the roof edge.

[0106] For objects with obvious straight - line features such as roofs, the Hough transform can accurately extract the straight line segments belonging to the roof edge. 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.

[0107] Further, when fitting and repairing each roof edge to generate the edge - fitting result of each roof, it specifically includes:

[0108] Traverse each pixel point in the Hough - matrix image and calculate the slope of each pixel point with the start and end points of each straight - line segment.

[0109] For each pixel point, traverse each slope, and regard the pixel points with slopes greater than the preset slope as edge points to be fitted.

[0110] Connect each edge point to be fitted with each straight - line segment to generate the edge - fitting result of each roof.

[0111] Specifically, based on the detection result of the Hough transform, a slope - based edge - fitting algorithm is used to fit and repair the incomplete and broken roof edges to obtain the edge - fitting result of the roof. The specific process is as follows:

[0112] Calculate the slope of each straight line according to the detection result of the Hough transform ;

[0113] Traverse each pixel point of the image, calculate the slope of each pixel point with the start and end points of each straight - line segment according to the following formula, and judge each slope Degree of proximity;

[0114] ;

[0115] In the formula, , are respectively the horizontal and vertical coordinates of the pixel point; , are the coordinates of the starting point of the straight line segment; is the slope of the roof edge detected by the Hough transform; M is the number of straight line segments detected by the Hough transform; is the set slope error threshold;

[0116] Connect each pixel point that meets the threshold , so as to obtain the fitting result of the roof edge. Then, perform hole filling on the image after fitting the roof edge, such as deleting connected regions with less than a certain pixel value, and optimize the result through mathematical morphology algorithms to obtain the extraction result of the roof region, that is, generate the roof region image corresponding to each edge fitting image.

[0117] Among them, the optimization process of the mathematical morphology algorithm includes dilation, erosion, opening operation and closing operation, and then the extraction result of the roof region is obtained .

[0118] The opening operation is to first perform an erosion operation on the image and then a dilation operation to achieve the effect of smoothing the image contour. The closing operation means first performing a dilation operation on the image and then an erosion operation to achieve the effect of filling the cracks and holes in the image. Then, the opening operation and the closing operation can combine the effects of these two operations, smooth the roof edge contour, fill the cracks and holes at the same time, and further improve the extraction quality of the roof region.

[0119] Then, through fitting and repair in the embodiments of the present invention, the broken or incomplete roof edges caused by noise, shadows or other factors can be connected, making the edge detection result 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 more continuous, enabling subsequent operations such as hole filling and mathematical morphology processing to proceed smoothly, so that a more accurate extraction result of the roof region can be obtained.

[0120] In a preferred embodiment, as Figure 2 shown in the flowchart of generating the effective construction area of the roof provided by another embodiment, the present invention can first perform graying and median filtering on the building roof image to obtain the preprocessing result of the building roof image; then use the Canny operator to perform edge detection on the preprocessed image, and identify the edges belonging to the roof in the edge detection result through the Hough transform;

[0121] Based on the Hough transform detection results, an edge fitting algorithm based on slope is used to fit and repair the incomplete and broken roof edges, and the edge fitting result of the roof is obtained;

[0122] Perform hole filling on the image after roof edge fitting, delete the connected regions 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;

[0123] For the image with foreign objects above the roof, use the threshold segmentation algorithm to identify the roof foreign objects and obtain the extraction result of the foreign objects; perform a difference operation on the roof area extraction result and the foreign object extraction result, and then obtain the extraction result of the actual effective area of the roof;

[0124] Calculate the area available for building photovoltaic on the roof according to the extraction result of the roof effective area and the image resolution.

[0125] Then, the present invention preprocesses the high-resolution satellite image to initially suppress the influence of spectral heterogeneity; uses the Canny operator to detect the edges of various ground objects in the image, and identifies the edges belonging to the roof based on the principle of the Hough transform for detecting straight lines; uses an edge fitting algorithm based on slope 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, use the threshold segmentation algorithm to identify and extract the roof foreign objects; on this basis, perform a difference operation on the roof image and the foreign object image, and then obtain the roof effective area without foreign objects and calculate its area. Thus, the present invention can process the spectral heterogeneity in the high-resolution satellite image and the roof foreign objects affecting photovoltaic construction, realize the refined extraction of the roof effective area, help relevant units obtain more accurate data for the area where photovoltaic power can be installed on the roof, and further improve the calculation accuracy of the buildable capacity of roof photovoltaic.

[0126] For step S2, in a preferred embodiment, the present invention can perform iterative calculations for each roof area image to determine the final critical threshold.

[0127] Specifically, initially, set the preset initial critical threshold as the current critical threshold;

[0128] Repeat the following critical threshold generation operation to generate the final critical threshold:

[0129] Perform mean smoothing on the roof area image, calculate the gray value of each pixel point in the smoothed roof area image, and calculate the gradient value of each pixel point in the smoothed roof area image;

[0130] Edge detection is performed 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;

[0131] Compare the grayscale value of each pixel point in the roof area image with the current critical threshold;

[0132] Based on each edge to be processed and the area corresponding to the pixel points greater than the current critical threshold, generate a foreground area for characterizing the presence of foreign objects;

[0133] Based on each edge to be processed and the area corresponding to the pixel points not greater than the current critical threshold, generate a background area for characterizing the blank area;

[0134] Calculate the average grayscale value of all pixel points 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;

[0135] According to the first grayscale average value and the second grayscale average value, calculate a ratio for characterizing the relative brightness between the foreground area and the background area;

[0136] Calculate the updated critical threshold according to the following formula:

[0137] ;

[0138] where, is the updated critical threshold in the nth iteration operation, is the ratio, is a preset convergence coefficient;

[0139] Among them, by calculating the average grayscale value of the foreground area and the background area and calculating the ratio of relative brightness based on these average values, it is possible to more accurately determine which pixel points belong to the foreground and which belong to the background, which is more accurate than simply using a fixed threshold in the prior art.

[0140] Then calculate the target difference between the current critical threshold and the updated critical threshold;

[0141] When it is determined that the target difference is not less than the preset critical difference, use the updated critical threshold as the current critical threshold for the next critical threshold generation operation;

[0142] When it is determined that the target difference is less than the preset critical difference, use the updated critical threshold as the final critical threshold. Schematically, when the change in the threshold is less than the preset critical difference, it means that the threshold has tended to be stable, and the iterative process can be terminated, so as to ensure that the finally obtained threshold is a stable and reliable solution to improve the stability of subsequent photovoltaic construction area generation based on this threshold.

[0143] Schematically, when performing mean smoothing on the roof area, the calculation formula is as follows:

[0144] ;

[0145] 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 included in the template;

[0146] Schematically, when calculating the gradient value of the smoothed image, the calculation formula is as follows:

[0147] ;

[0148] In the formula, is the gradient value of the pixel point; and are the gradient values of the pixel point in the x - direction and y - direction respectively.

[0149] Then, the present invention can obtain the critical threshold for segmenting the foreign object area and the blank area of the roof 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 repeatedly executed to gradually optimize and refine this threshold until the termination condition is met. During the iteration process, the iterative method adopted by the present invention can automatically adjust the critical threshold according to the specific content of the roof area image. Therefore, 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 areas).

[0150] The brightness of the roof in satellite images may be affected by various factors such as weather, season, time, etc. By iteratively updating the critical threshold, the threshold can be dynamically adjusted according to the actual gray - scale distribution of the pixel points in the roof area image, making it more adaptable to different lighting conditions, thereby improving the recognition accuracy of the foreign object area and the blank area. And during the iteration process, the updated critical threshold is calculated based on the average gray - scale value of the pixel points in the foreground area and the background area, considering the statistical characteristics of the pixel point distribution, which can better reflect the gray - scale difference between the foreign objects and the blank areas on the roof, and thus more accurately identify them.

[0151] Then, by iteratively adjusting the critical threshold, the present invention can generate a more accurate image segmentation result, making the boundary between the foreground area (such as foreign objects) and the background area (such as blank areas) clearer, thereby improving the visualization effect of the image.

[0152] In a preferred embodiment, the determination of the final critical threshold may further include the following process: performing a Laplacian calculation on the image, finding the pixel points with local maximum thresholds, and using the gray values of these points as candidate local thresholds. The calculation formula is as follows:

[0153] ;

[0154] The threshold is iteratively calculated through the following formula:

[0155] ;

[0156] In the formula, is the pixel point threshold obtained in the nth iteration; is the convergence coefficient.

[0157] Schematically, the Laplacian operator is a second-order differential operator commonly used for image enhancement and edge detection. By calculating the second derivative of the image, the mutation points in the image, that is, the edges or regions with large local gray value changes, can be detected. In this embodiment, the Laplacian operator is used to find the pixel points with local maximum thresholds, and the gradient value of each pixel point is calculated on the smoothed image, so as to determine which are the boundary points between the foreground and the background in the image. Then, through gradient calculation, the approximate position and direction information of the edges in the image can be obtained. Then, applying the Laplacian operator at these edge positions can obtain a more accurate edge positioning result.

[0158] After determining the candidate local thresholds, an iterative method is used to further finely adjust these thresholds. Through iteration, an optimal threshold can be gradually approximated, making the segmentation between the foreground and the background more accurate.

[0159] For step S3, in a preferred embodiment, the present invention can generate a foreign object region image by accurately determining the critical threshold. First, each pixel point of the image is traversed, and its gray value is compared with the previously determined critical threshold. If the gray value of a certain pixel point is greater than the critical threshold, then this pixel point is considered a target pixel point, and these target pixel points usually belong to the foreground region in the image, that is, the foreign object region of interest in the present invention.

[0160] All the target pixel points (that is, the pixel points with gray values greater than the critical threshold) are combined to form a new image, and this image is the foreign object region image. This image only contains the foreground region (foreign objects) in the original image, while the background region is ignored or set to black (or other colors that are significantly distinguishable from the foreground).

[0161] Schematically, post - processing can also be performed on the generated foreign object area image, such as morphological operations (erosion, dilation, opening, closing, etc.) to further smooth the edges, remove noise, or fill holes.

[0162] Then, threshold segmentation is performed inside the roof, and the formula is as follows:

[0163] ;

[0164] In the formula, is a binary image containing only foreign objects obtained after threshold segmentation. And the binary image containing only foreign objects can be optimized using mathematical morphology algorithms to obtain the optimized foreign object extraction result , that is, the foreign object area image.

[0165] For step S4, in a preferred embodiment, a difference processing is performed on the roof area extraction result and the foreign object extraction result, and then the actual effective area extraction result of the roof is obtained. The difference calculation formula is as follows:

[0166] ;

[0167] In the formula, is the photovoltaic construction area corresponding to the roof area image; is the roof area image; is the foreign object area image.

[0168] In a preferred embodiment, the present invention further includes:

[0169] Calculate the construction area corresponding to each photovoltaic construction area according to the following formula:

[0170] ;

[0171] Among them, 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.

[0172] In summary, the present invention can accurately extract the photovoltaic construction areas on the roof and calculate the construction area of each area, providing strong support for the planning and construction of photovoltaic power stations.

[0173] As Figure 3 shown, based on the above - mentioned embodiments of various methods for generating photovoltaic construction areas based on satellite images, the present invention correspondingly provides device - item embodiments;

[0174] An embodiment of the present invention provides a photovoltaic construction area generation device based on satellite images, including: a roof area image generation module, a critical threshold generation module, a foreign object area image generation module, and a photovoltaic construction area generation module;

[0175] The roof area image generation module is configured to obtain a satellite image containing a plurality of roofs, perform edge detection on each roof in the satellite image, and generate a plurality of roof area images;

[0176] The critical threshold generation module is configured to use a preset initial critical threshold as the current critical threshold for each roof area image, and repeatedly execute the critical threshold generation operation to generate a final critical threshold; wherein, the critical threshold is used to divide the roof foreign object area and the roof blank area;

[0177] The foreign object area image generation module is configured to use the pixel points corresponding to the gray values greater than the critical threshold as target pixel points, and then generate foreign object area images corresponding to each target pixel point;

[0178] The photovoltaic construction area generation module is configured to perform a difference operation on the roof area image and the foreign object area image to generate a photovoltaic construction area corresponding to each roof area image;

[0179] Among them, the generation operation of the critical threshold includes:

[0180] Generate a foreground area according to the pixel points with gray values greater than the current critical threshold, and generate a background area according to the pixel points with gray values not greater than the current critical threshold; calculate the updated critical threshold according to the average gray value of all pixel points in the foreground area and the background area, and then generate the target difference between the current critical threshold and the updated critical threshold;

[0181] When it is determined that the target difference is not less than the preset critical difference, use the updated critical threshold 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, use the updated critical threshold as the final critical threshold.

[0182] It should be noted that the device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules. They may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the attached drawings of the device embodiments provided by the present invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art can understand and implement this without creative effort.

[0183] 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 foregoing method embodiments and will not be elaborated here.

[0184] Based on the above embodiments of various methods for generating photovoltaic construction areas based on satellite images, the present invention correspondingly provides embodiments of terminal devices.

[0185] 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. When the processor executes the computer program, it implements a method for generating a photovoltaic construction area based on satellite images according to any one of the method embodiments of the present invention.

[0186] The terminal device can be a computing terminal device such as a desktop computer, a notebook, a palm computer, and a cloud server. The terminal device may include, but is not limited to, a processor and a memory.

[0187] The so-called processor may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The processor is the control center of the terminal device, connecting various parts of the entire terminal device through various interfaces and lines.

[0188] The memory can be used to store the computer program. By running or executing the computer program stored in the memory and invoking the data stored in the memory, the processor realizes various functions of the terminal device. The memory mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one magnetic disk storage device, flash memory device or other volatile solid-state storage devices.

[0189] The above is the preferred embodiment of the present invention. It should be noted that for those of ordinary skill in the art of the present technology, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements are also regarded as the protection scope 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 preprocess the satellite image to generate a preprocessed satellite image; Perform edge detection on the preprocessed satellite image to identify the roof edges belonging to the roof in the edge detection results; perform fitting and repair on the edges of each roof to generate edge fitting results for each roof; and generate an edge fitting image for each roof based on the edge fitting results of each roof; Fill holes in the edge fitting image of each roof to generate a roof area image corresponding to each edge fitting image; 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; 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.

2. A method for generating a photovoltaic construction area based on satellite images as claimed in claim 1, 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.

3. A method for generating a photovoltaic construction area based on satellite images as claimed in claim 2, 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.

4. A method for generating a photovoltaic construction area based on satellite images as claimed in claim 3, 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.

5. A method for generating a photovoltaic construction area based on satellite images as claimed in claim 4, 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.

6. 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.

7. A photovoltaic construction area generation device based on satellite images, used to execute a photovoltaic construction area generation method based on satellite images as claimed in any one of claims 1 to 6, 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 pre-process the satellite image to generate a pre-processed satellite image; Perform edge detection on the preprocessed satellite image to identify the roof edges belonging to the roof in the edge detection results; perform fitting and repair on the edges of each roof to generate the edge fitting results of each roof; generate the edge fitting image of each roof according to the edge fitting results of each roof; perform hole filling on the edge fitting image of each roof to generate the roof area image corresponding to each edge fitting image; 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; 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.

8. A terminal device, used to execute the method for generating a photovoltaic construction area based on satellite images according to any one of claims 1 to 6, 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 6 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