Disclosure of Invention
The technical problem that this application was solved is: aiming at the problems that the accuracy of extracting a roof photovoltaic distribution image is poor, the requirements on a computing environment and the computing requirements are high in the prior art, the application provides the method for extracting the roof photovoltaic distribution image and the computer equipment. On the other hand, the photovoltaic identification of the roof is not needed through a deep learning algorithm, and the requirements on the computing environment and the computing are reduced.
In a first aspect, an embodiment of the present application provides a method for extracting a photovoltaic distribution image on a roof, where the method includes:
the method comprises the steps of obtaining a remote sensing image, preprocessing the remote sensing image to obtain a preprocessed image, and performing multi-scale segmentation on the preprocessed image according to a multi-scale segmentation algorithm to obtain a segmented image;
removing shadow areas in the segmented images to obtain shadow-free images, and performing band operation on the segmented images to obtain photovoltaic characteristic images;
and fusing the shadow-free image and the photovoltaic characteristic image to obtain a multi-characteristic segmentation image, and obtaining the roof photovoltaic distribution image according to the multi-characteristic segmentation image.
Optionally, the preprocessing the remote sensing image to obtain a preprocessed image includes: and carrying out geometric correction, radiation calibration and orthorectification on the remote sensing image to obtain the preprocessed image.
Optionally, removing the shadow region in the segmented image to obtain a shadow-free image includes: determining the area and brightness of each object of one or more objects in the segmented image, and determining a shadow region according to the area and brightness of each object; and removing the shadow area from the segmentation image to obtain a shadow-free image.
Optionally, determining a shadow region according to the area and the brightness of each object includes: respectively judging whether the area of each object in one or more objects is larger than a first threshold value and the brightness is smaller than a second threshold value; if the area of the first object is larger than the first threshold value and the brightness of the first object is smaller than the second threshold value, the area corresponding to the first object is a shadow area.
Optionally, performing a band operation on the segmented image to obtain a photovoltaic feature image, including: respectively determining object values of each object corresponding to the red light wave band and the blue light wave band in the segmented image; and subtracting the object value of each object in the red light wave band from the object value of the corresponding object in the blue light wave band to obtain the photovoltaic characteristic image corresponding to the object.
Optionally, obtaining the roof photovoltaic distribution image according to the multi-feature segmentation image includes: carrying out photovoltaic-non-photovoltaic pixel level classification on the multi-feature segmentation image according to a Support Vector Machine (SVM) algorithm to obtain a classification result; and performing wave band fusion according to the classification result and the photovoltaic characteristic image, determining a class label corresponding to each object according to the fused image, and obtaining the roof photovoltaic distribution image according to the classification label, wherein the classification label comprises a roof photovoltaic and a non-roof photovoltaic.
Optionally, determining a category label corresponding to each object according to the fused image includes: and voting the category label corresponding to each object, and taking the category label with the maximum voting number as the category label of each object.
In a second aspect, the present application provides a computer device comprising:
a memory for storing instructions for execution by at least one processor;
a processor for executing instructions stored in a memory to perform the method of the first aspect.
In a third aspect, the present application provides a computer readable storage medium having stored thereon computer instructions which, when run on a computer, cause the computer to perform the method of the first aspect.
Compared with the prior art, the embodiment of the application has at least the following beneficial effects:
in the scheme provided by the embodiment of the application, the preprocessed image is subjected to multi-scale segmentation to obtain the segmented image, the shadow area in the segmented image is removed to obtain the shadow-free image, the segmented image is subjected to band operation to obtain the photovoltaic characteristic image, then the shadow-free image and the photovoltaic characteristic image are fused to obtain the multi-characteristic segmented image, and the roof photovoltaic distribution image is obtained through the multi-characteristic segmented image. In the scheme that this application embodiment provided promptly, on the one hand, determine the region that the roof photovoltaic corresponds through cutting apart the image from the many characteristics of getting rid of the shadow, avoid dividing roof photovoltaic and shadow mistake in the application of roof photovoltaic discernment, and then improved the accuracy of roof photovoltaic distribution image. On the other hand, the photovoltaic identification of the roof is not needed through a deep learning algorithm, and the requirements on the computing environment and the computing are reduced.
Detailed Description
In the solutions provided in the embodiments of the present application, the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The method for extracting a photovoltaic distribution image on a roof provided in the embodiments of the present application is described in further detail below with reference to the drawings of the specification, and the specific implementation manner of the method may include the following steps (the method flow is shown in fig. 1):
step 101, obtaining a remote sensing image, preprocessing the remote sensing image to obtain a preprocessed image, and performing multi-scale segmentation on the preprocessed image according to a multi-scale segmentation algorithm to obtain a segmented image.
By way of example, the remote sensing image is a high-resolution remote sensing image, and the remote sensing image may be a remote sensing image including a roof photovoltaic, or a remote sensing image not including a roof photovoltaic, and is not limited herein.
Further, in the scheme provided in the embodiment of the present application, after the remote sensing image is acquired, the remote sensing image needs to be preprocessed. In one possible implementation, the preprocessing the remote sensing image to obtain a preprocessed image includes: and carrying out geometric correction, radiation calibration and orthorectification on the remote sensing image to obtain the preprocessed image.
Further, after the remote sensing image is preprocessed to obtain a preprocessed image, a multi-scale segmentation algorithm is required to be adopted to perform multi-scale segmentation on the preprocessed image to obtain a segmented remote sensing image. In addition, in the process of carrying out multi-scale segmentation on the preprocessed image through a multi-scale segmentation algorithm, different scales can be adopted for segmentation according to actual requirements. For example, in the solution provided in the embodiment of the present application, the scale division parameters set by the multi-scale division are: the scale parameter is set to 30 and the shape and compact read parameters are set to 0.3 and 0.9, respectively.
And 102, removing the shadow area in the segmented image to obtain a shadow-free image, and performing band operation on the segmented image to obtain a photovoltaic characteristic image.
After the remote sensing image is subjected to multi-scale segmentation to obtain a segmented image, a shadow region exists in the obtained remote sensing image besides a roof photovoltaic region. In order to avoid the misclassification of the shadow area and the photovoltaic area, the shadow area is determined and removed before the roof photovoltaic image is extracted. Specifically, there are various ways to remove the shadow area, and one of them is taken as an example for explanation.
In one possible implementation, removing the shadow area in the segmented image to obtain a shadow-free image includes: determining the area and brightness of each object of one or more objects in the segmented image, and determining a shadow region according to the area and brightness of each object; and removing the shadow area from the segmentation image to obtain a shadow-free image.
For example, since the segmented image is obtained by a multi-scale segmentation algorithm, the segmented image corresponds to multiple scales, and each scale corresponds to one or more objects, where an object refers to a region composed of multiple pixels, and the pixels of the multiple objects do not overlap. Further, in order to determine the shadow area, each object needs to be determined, and a specific determination process is as follows:
in one possible implementation, determining the shadow region according to the area and the brightness of each object comprises respectively judging whether the area of each object in one or more objects is larger than a first threshold value and the brightness is smaller than a second threshold value, and if the area of a first object is larger than the first threshold value and the brightness is smaller than the second threshold value, determining that the region corresponding to the first object is the shadow region.
Specifically, in the solution provided in the embodiment of the present application, a brightness threshold (second threshold) and an area threshold (first threshold) corresponding to an object are stored in advance, and after the area and the brightness of each object are determined, a region corresponding to any object is determined to be a shadow region through an algorithm:
For object(x)
IF brightnessobject(x)<T1 AND sizeobject(x)>T2
THEN object(x)is identified as shadow.
END
wherein T1 is the second threshold, T2 is the first threshold, and the empirical values of the second threshold and the first threshold are typically 30 and 100; object (x) represents the x-th object on the segmented image; brightness object (x) represents the brightness of the xth object; sizeobject (x) represents the area of the xth object.
Further, one or more first objects in the segmented image are determined in the above manner, where the first object is an object whose corresponding region is a shadow region, and the one or more first objects are removed from the segmented image to obtain a shadowless image.
Further, in order to obtain the roof photovoltaic distribution image, the shadow region in the segmented image is removed, and the segmented image is required to be subjected to band operation to obtain the photovoltaic feature image. The specific process of performing the band operation on the segmented image is as follows:
in one possible implementation manner, performing a band operation on the segmented image to obtain a photovoltaic feature image includes: respectively determining the object value (Digital Number) of each object corresponding to the red light wave band and the blue light wave band in the segmented image; and subtracting the object value of each object in the red light wave band from the object value of the corresponding object in the blue light wave band to obtain the photovoltaic characteristic image corresponding to the object.
Specifically, in the solution provided in the embodiment of the present application, the segmented image includes a plurality of bands, each band includes a plurality of objects, and there is a certain correspondence between the objects included in different bands. For example, the segmented image includes a red light band and a blue light band, where the red light band includes 5 objects, i.e., object 1, object 2, object 3, object 4, and object 5; the blue light band also contains 5 objects, namely an object 1, an object 2, an object 3, an object 4 and an object 5, so that the object 1 in the red light band corresponds to the object 1 in the blue light band, the object 2 in the red light band corresponds to the object 2 in the blue light band, the object 3 in the red light band corresponds to the object 3 in the blue light band, the object 4 in the red light band corresponds to the object 4 in the blue light band, and the object 5 in the red light band corresponds to the object 5 in the blue light band. As an example, the object value corresponding to each object here may be an average value of object values of all pixels in the object.
Further, in the previous experiments, the spectral change trends of the spectral characteristics of the roof photovoltaic and the building from the blue light wave band to the red light wave band are found to be completely opposite, and the spectral rule can provide favorable support for the fine differentiation of the roof photovoltaic and the building. In view of this, a band operation is performed on the segmented high-resolution image to obtain a photovoltaic feature image, which is used as an auxiliary feature for subsequent roof photovoltaic identification, wherein the band operation idea is as follows:
solar(x)=band_blue(x)-band_red(x)
wherein, band _ red (x) represents an object value of the x-th object of the red light wave band in the segmented image, band _ blue (x) represents an object value of the x-th object of the blue light wave band in the segmented image, and solar (x) represents the calculated photovoltaic characteristic image.
Step 103, fusing the shadow-free image and the photovoltaic feature image to obtain a multi-feature segmentation image, and obtaining the roof photovoltaic distribution image according to the multi-feature segmentation image.
After the split images are processed to obtain the shadow-free images and the photovoltaic characteristic images, the shadow-free images and the photovoltaic characteristic images are fused to obtain multi-characteristic split images, and then the multi-characteristic split images are processed to obtain roof photovoltaic distribution images. Specifically, the process of processing the multi-feature segmented image to obtain the roof photovoltaic distribution image is as follows:
in one possible implementation, obtaining the roof photovoltaic distribution image according to the multi-feature segmentation image includes: obtaining the roof photovoltaic distribution image according to the multi-feature segmentation image, comprising: carrying out photovoltaic-non-photovoltaic pixel level classification on the multi-feature segmentation image according to a Support Vector Machine (SVM) algorithm to obtain a classification result; and performing wave band fusion according to the classification result and the photovoltaic characteristic image, determining a class label corresponding to each object according to the fused image, and obtaining the roof photovoltaic distribution image according to the classification label, wherein the classification label comprises a roof photovoltaic and a non-roof photovoltaic.
Firstly, carrying out photovoltaic-non-photovoltaic pixel level classification on the multi-feature segmented image through a Support Vector Machine (SVM), wherein the photovoltaic-non-photovoltaic pixel level classification refers to determining pixels corresponding to photovoltaics and pixels corresponding to non-photovoltaics in the multi-feature segmented image, and classifying the pixels in the multi-feature segmented image according to the pixels corresponding to the photovoltaics and the pixels corresponding to the non-photovoltaics. By way of example, the image element corresponding to the photovoltaic and the image element corresponding to the non-photovoltaic may be determined according to the pixel value of the image element. In addition, the parameters set by the support vector machine algorithm are different for different requirements. For example, the parameter set by the support vector machine algorithm is that the penalty coefficient is set to 100, an RBF kernel function is selected, and the bandwidth is set to 1/n, where n is the dimension of the input feature, which is not less than 1).
Further, in order to improve the pixel-level classification result, particularly optimize the extracted rooftop photovoltaic boundary, in a possible implementation manner, determining a category label corresponding to each object according to the fused image includes: and voting the category label corresponding to each object, and taking the category label with the maximum voting number as the category label of each object.
Specifically, the decision is made according to the following algorithm:
For object(x)
Label_object(x)=Max_vote(label(x))
END
wherein, object (x) represents the xth segmented object on the segmented image, and label (x) represents the category label corresponding to the xth segmented object. Max _ vote is the maximum vote of the category labels of the x divided objects, and a winning category label is selected as the category label of the object. And finishing the object-oriented fusion of the pixel-level classification result and the segmented image according to the decision rule to obtain an object-oriented classification result and obtain the final roof photovoltaic distribution image. Specifically, referring to fig. 2, a schematic flow chart of a method for extracting a photovoltaic distribution image of a roof according to an embodiment of the present disclosure is shown.
In addition, in the solution provided in the embodiment of the present application, it has been said that the remote sensing image may include a roof photovoltaic, or may not include a roof photovoltaic. When the remote sensing image contains the roof photovoltaic, the roof photovoltaic distribution image can be obtained according to the method; when the remote sensing image does not contain the roof photovoltaic, the roof photovoltaic distribution image cannot be obtained. In order to prompt a user when a situation of a roof photovoltaic distribution image is not obtained, in a possible implementation manner, the method includes obtaining the roof photovoltaic distribution image according to the multi-feature segmentation image, and further includes: and if the remote sensing image does not contain the roof photovoltaic, generating prompt information, wherein the prompt information is used for indicating that the roof photovoltaic does not exist in the remote sensing image.
In the scheme provided by the embodiment of the application, the preprocessed image is subjected to multi-scale segmentation to obtain the segmented image, the shadow area in the segmented image is removed to obtain the shadow-free image, the segmented image is subjected to band operation to obtain the photovoltaic characteristic image, then the shadow-free image and the photovoltaic characteristic image are fused to obtain the multi-characteristic segmented image, and the roof photovoltaic distribution image is obtained through the multi-characteristic segmented image. In the scheme that this application embodiment provided promptly, on the one hand, determine the region that the roof photovoltaic corresponds through cutting apart the image from the many characteristics of getting rid of the shadow, avoid dividing roof photovoltaic and shadow mistake in the application of roof photovoltaic discernment, and then improved the accuracy of roof photovoltaic distribution image. On the other hand, the photovoltaic identification of the roof is not needed through a deep learning algorithm, and the requirements on the computing environment and the computing are reduced.
Referring to fig. 3, the present application provides a computer device comprising:
amemory 301 for storing instructions for execution by at least one processor;
aprocessor 302 for executing instructions stored in memory to perform the method described in fig. 1.
A computer-readable storage medium having stored thereon computer instructions which, when executed on a computer, cause the computer to perform the method of fig. 1.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.