Next Article in Journal
The Extent of Incorporating Health Education Requirements in Middle School Science Textbooks
Previous Article in Journal
Two-Dimensional Nanomaterial (2D-NMs)-Based Polymeric Composite for Oil–Water Separation: Strategies to Improve Oil–Water Separation
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Building Rooftop Extraction Using Machine Learning Algorithms for Solar Photovoltaic Potential Estimation

1
Public Works Department, Faculty of Engineering, Cairo University, 1 El Gamaa Street, Giza 12613, Egypt
2
School of Ocean Technology, Fisheries and Marine Institute of Memorial University of Newfoundland, St. John’s, NL A1C 5R3, Canada
*
Author to whom correspondence should be addressed.
Sustainability 2023, 15(14), 11004; https://doi.org/10.3390/su151411004
Submission received: 18 May 2023 / Revised: 6 July 2023 / Accepted: 10 July 2023 / Published: 13 July 2023

Abstract

:
Green cities worldwide are converting to renewable clean energy from natural sources such as sunlight and wind due to the lack of traditional resources and the significant increase in environmental pollution. This paper presents an approach of two stages for photovoltaic (PV) potential estimation of solar panels mounted on buildings’ rooftops. The first stage is rooftop detection from satellite images using a series of image pre-processing algorithms, followed by applying machine learning algorithms, namely Support Vector Machine (SVM) and Naïve Bayes (NB). The second stage is the solar PV potential estimation using the PVWatts calculator, PVGIS, and ArcGIS. Satellite images for the B6 division of Madinaty City in Egypt were evaluated in this paper. The precision, recall, and F1-score of rooftop detection were 91.2%, 98.6%, and 94.7% from SVM, while those from NB were 86.6%, 98.3%, and 92.2%, respectively. About 290 rooftops were extracted, with a total area of 150,698 m2 and a relative root mean square error of 10.6%. The usable area of rooftops was utilized to estimate the annual PV potential of 21.1, 24.9, and 22.9 GWh/year from the PVWatts calculator, PVGIS, and ArcGIS, respectively. According to the estimated PV potential, replacing traditional energy sources reduced the amount of CO2 by an annual average value of 62%.

1. Introduction

Smart cities apply the concept of green cities in terms of energy production and consumption, considering renewable clean energy instead of traditional sources. Non-renewable traditional energy sources have been used for several decades worldwide, representing the primary reason for authentic global warming, which, in turn, encompasses the whole planet. This is due to CO2 emissions and other gases causing the greenhouse effect and pollution. The average global temperature has increased by nearly 2° F over the past 100 years [1]. The effects of global warming appear clearly in the glacier retreat phenomena and seasonal time changes that affect the life patterns of plants by causing their earlier flowering [2,3]. This has led to a strong blow to agricultural land, worsening food insecurity [4].
Solar energy is generated from PV panels installed on buildings’ rooftops as a renewable, more environmentally friendly, and clean energy source. This significantly contributes to sustainability by harnessing machine learning (ML) algorithms’ power to estimate the solar photovoltaic potential of building rooftops. Accurately implementing this process empowers decision-makers and stakeholders in the renewable energy sector to optimize the deployment of solar photovoltaic systems.
Several research contributions have been conducted on rooftop extraction from satellite images. These contributions can be summarized in three main approaches: correlations and interpolations, analytical approaches, and automatic extraction. Wiginton et al. [5] depended on relationships and linear correlations between the population’s density and the rooftops’ area in certain regions by estimating the per capita gross rooftop area for study areas in Canada, Spain, and the United Kingdom as 70.0 m2, 24.4 180.5 m2, and 30.7 m2, respectively, with the ability to extrapolate this to nearby, similar regions. The studies proposed in [6,7,8] used analytical tools to extract the rooftops using Google Earth imagery as a base map for digitizing the buildings in the region of interest. GIS and Google Earth Pro were used to manually digitize the gross areas of the rooftops, and the obstructions such as shadows, elevators, HVAC systems, the shadows induced by the surrounding high buildings, and trees. A hybrid approach was suggested in [9] that combined analytical tools and correlations for buildings footprints. A sample of digitized rooftops’ areas was compared with available shapefiles of parcels’ areas obtained from the State of Hawaii Office of Planning.
Moving on, the study in [10] used image processing to extract buildings by applying several layers of binary clustering and sub-clustering. Then, a region-growing algorithm was used and ended with post-processing through a decision tree to remove shadows and improve the rooftop detection accuracy. The overall extraction accuracy was 80%. Baluyan et al. [11] applied a Support Vector Machine (SVM) on satellite images to detect rooftops for two regions in Al Raha Gardens and Khalifa City A in the UAE. They used spectral and spatial features to separate rooftops from the land cover and roads in the urban area. Their workflow started with image segmentation using k-means, followed by feature extraction for SVM classification. The average F1-score for the two study areas reached 82.1%; however, it produced many false positives. A histogram method was then applied to strengthen the distribution of grayscale intensities of rooftop pixels that tend to have the same color. The average F1-score increased to 83.8% after using the histogram method. Joshi et al. [12] applied an artificial neural network (ANN) algorithm to classify the segments generated into ‘rooftop’ and ‘non-rooftop’ of the same study areas used in [11]. The average F1-score was 86.5%. The results showed many false positives and negatives. Therefore, the SVM was used as a second-pass classification on the feature outputs generated from the ANN method to reduce the number of false positives and false negatives in the results; consequently, the average F1-score increased to 88.5%.
Regarding the PV potential estimation stage, previous studies have considered three methods: PVWatts, PVGIS, and ArcGIS. They have databases in different regions worldwide. The PVWatts calculator databases are located mainly in the US and Mexico, while PVGIS has its databases located in Africa and Europe. ArcGIS heavily depends on hemispherical calculations and projections on the provided digital elevation model assuming a universal solar constant. For example, Mardikis et al. [13] compared the results of two software packages PVWatts and PVGIS with actual data in three locations in Greece: Athens, Peloponnese, and the Island of Kos. A similar comparison was conducted at a higher solar radiation region in Cairo, Egypt, for a PV installation of 100 kWp. The results in the summer times were almost equal for both PVGIS and PVWatts. The variations appeared between October and March, whereas a difference of 10~12,000 kWh was observed for PVWatts from the actual data.
Egypt’s population increases at an annual rate of 2%, determined in 2019 by the World Bank collection of development indicators [14], and will grow to 128 million by 2051 [15]. According to the World Data atlas-energy section, the emitted CO2 during energy production in Egypt was 218.39 million metric tons in 2012, which increased to 236.97 million metric tons in 2018, growing at an average annual rate of 1.4% [16]. Among many countries, Egypt is converting to solar energy as a clean energy source, according to Egypt’s Vision 2030 [17]. This paper applies this conversion to one of Egypt’s cities for solar PV potential estimation from buildings’ rooftops. The contributions of this work are (1) a comparative evaluation of automatic building rooftop extraction techniques using two ML algorithms; (2) the application of a proposed series of sequential algorithms for image pre-processing to facilitate the accurate extraction of rooftops; and (3) a comparative estimation of the photovoltaic (PV) potential using three methods.

2. Materials

2.1. Study Area and Dataset

Figure 1 shows an image of the study area of the B6 division in Madinaty City, Cairo, Egypt. It is located at 30°04′53.82″ N and 31°38′21.63″ E. Madinaty was specifically chosen as it was one of the first major perfectly planned cities in Cairo, which was used as a template for planning other new cities. An RGB image of the study area was downloaded from Google Earth Pro with a 1 m resolution. It covers about 1.8 square kilometers and consists of two patterns, with different patterns and sizes of buildings. Pattern B64 (Figure 2a) has six floors with four apartments on each floor. B66 (Figure 2b) has seven floors, with two apartments on each floor. Both patterns consist of single and double buildings.

2.2. Reference Data Preparation

The buildings’ rooftops were labeled by manual digitization using ImageJ software (Figure 3), with five main features extracted for all the digitized rooftops to feed the ML algorithms as characteristics of correctly identified rooftops. The five features are areas, mean intensity value, standard deviation, minor–major ratio, and roundness. The roundness is defined in Equation (1) below [12].
R o u n d n e s s = 4 π A r e a P e r e i m e t e r 2
The labeled data was separated into 25% training, 25% validation, and 50% testing for the ML application; therefore, the positive dataset was manually created by digitizing the 25% related to the training dataset while extracting the five features mentioned above. In contrast, the negative features would have been difficult to digitize (all objects rather than the rooftops). That is why the negative dataset was created by applying a random data generation algorithm that takes the features of the positive dataset and creates random data with random features that are scaled to be bigger or smaller than the features of the positive dataset.

3. Methods

The methodology of this paper is divided into two stages: building rooftop detection and solar PV potential estimation. The former includes a series of image pre-processing steps applied to the satellite image, followed by ML algorithms to extract rooftops. The following steps include estimating the required parameters for solar PV modeling and PV potential estimation using three methods. Details of the two stages are described in the following section.

3.1. Rooftop Detection

3.1.1. Image Pre-Processing

Figure 4 shows the proposed workflow of the pre-processing steps. It applies Gamma correction to the input image, followed by shadow masking, noise filtering, mean shift segmentation, vegetation masking, k-means clustering, morphological transformations, and connected components. It ends with formed polygons for potential building rooftops. The description of the pre-processing workflow is detailed below, and the output of each step is shown in Figure 5.
1
Gamma correction and shadow masking
Gamma correction is a widely used filter for strengthening the contrast differences between objects with similar spectral properties. LAB color space is used in this step instead of RGB, where the L component represents the color’s appearance as a constant property throughout the day; thus, the contrast differencing can be represented better by separating the L component of a pixel as follows:
V o u t = V i n Ɣ
Ɣ = p i x e l   c o l o r   v a l u e g m e a n   o f   L
where Vin and Vout are the pixel values before and after the gamma (Ɣ) correction, respectively; and g is a factor that increases the contrast differencing. The results of gamma correction are shown in Figure 5b.
A shadow detection algorithm is applied to eliminate the effect of shadows in the image and to minimize the processing execution time. The blue and green bands contain most shadow information [12]. Thus, the shadow index defined in Equation (4) is applied, and shadows are segmented out by a thresholding operation, as shown in Figure 5c.
S h a d o w   i n d e x = B G B + G
where B and G are the blue and green bands in the RGB color spaces.
2.
Noise filtering and mean shift segmentation
Noise filtering is applied using two different filters, namely Gaussian Blur (GB) and Bilateral Filtering (BF). Blurring considers weighted averages, where the closer the pixels are to each other, the larger their assigned weights. GB is a linear approach that takes the standard Gaussian distribution and applies it to blur for noise smoothing. The Gaussian function ( G σ ) is defined as [18]:
G σ = 1 σ 2 π e ( x 2 + y 2 ) / 2 σ 2
where x and y are the values of a pixel; and σ is the standard deviation. The weight for each pixel can be calculated and the Gaussian blur (GB[I]p) equation can then be written as follows:
G B [ I ] p = q S G σ ( p q ) I q
where G σ s ( p q ) is the spatial weight; p is the pixel value; q is the neighboring pixel value; and Iq is the neighboring pixel’s intensity.
On the contrary, BF is a nonlinear approach that applies spatial and range weighting for noise reduction, which preserves the edges instead of blurring them. BF is also kernel-dependent and defined as [19]:
B F [ I ] p = 1 W p q S G σ s ( p q ) G σ t ( I p I q ) I q
where 1/Wp is a normalization factor; G σ t ( I p I q ) is the range weight (intensity difference); and Ip is the pixel’s intensity.
The mean-shift segmentation is then applied as the next step. It blends the object’s color with its center such that color gradients and texture become flattened [20]. The effects of GB or BF, after which the mean-shift segmentation is implemented, are shown in Figure 5d,e.
3.
Vegetation masking and K-means clustering
Vegetation masking is applied to detect and remove the vegetation area within the inner roads in the image by converting to the HSV color space as it detects a color value independently of the brightness properties of an object. K-means clustering is then applied based on Euclidean distance [10]. The effect of vegetation masking and K-means are shown in Figure 5f,g.
4.
Morphological transformations and connected components
Morphological transformations are mathematical processes that apply to the pixel regions for specific functions, such as erosion and dilation, based on kernel sizes. In this paper, they are used to separate between the inner streets (footpaths) and buildings, which are wrongly joined to the buildings because they have similar spectral properties.
The connected components algorithm is a region formed in the same segment using a connectivity value ( c v ) of 4-connected or 8-connected pixels applied to the whole image in a particular order. This process begins with seed point generation, which can be set at a specific location (Sx, Sy) using Equations (8) and (9) [10].
S x = i r g n x i I x i , y i i r g n I x i , y i
S y = i r g n y i I x i , y i i r g n I x i , y i
where ‘rgn’ is a test region; and I(xi, yi) is the intensity value of the ith point of that region. This seed is then used in the region-growing process, where a group of pixels is formed of pixels with similar values as the seed. Several regions are formed in each segment (cluster) produced in the k-means step. Figure 5h,i show the results of the connected components algorithm before and after applying the morphological transformations. The results of connected components are polygons of potential buildings’ rooftops for the ML algorithms application in the next step.

3.1.2. Machine Learning Algorithms

Two ML algorithms, namely Support Vector Machine (SVM) and Naïve Bayes (NB), are applied in this paper. SVM is a well-known and robust pixel-based classifier compared with other counterparts, while heavily dependent on the choice of its hyperparameters specified by the user. On the other hand, NB is more applied in text recognition by entirely depending on the Bayes theorem and is wholly dependent on the probability function without the user’s interference. Consequently, we aimed to test our proposed image-preprocessing workflow on two completely different principles of ML algorithms and record their results based on the pre-processed data. The training dataset is used to train the two algorithms, and the ML models are then applied to the produced polygons from the pre-processing steps to detect the rooftops, as shown in Figure 6.
1.
Support Vector Machine (SVM)
SVM is a statistical ML algorithm that finds an optimal hyper-plane to separate the features into dimension spaces. The cost function of SVM is determined by the type of kernel function that affects its performance [21]. We tried different kernels of SVM (i.e., linear, nonlinear, polynomial, sigmoid, RBF), and the RBF gave the best result. The radial basis function (RBF) kernel ( K x , y ) is used in this paper according to the formation of the given data as given in Equation (10).
K x , y = e x 2 y 2 2 σ 2
The hyper-parameters for the SVM to run its algorithm were C and gamma (Ɣ = 1/ 2 σ 2 ), chosen by a grid search to create a suitable soft margin to differentiate the true from the false objects. These parameters were finally selected to be equal to 1 and (1/(n_features * X.var())), respectively, where n_features is the number of extracted features (i.e., five features) and X represents the array of the training dataset.
2.
Naïve Bayes (NB)
Naïve Bayes assumes an independent relationship between features [22] and depends on conditional probability calculation using Bayes’ theorem as shown in Equation (11).
p   A B = p   B A p A p B
where p (A|B) is the probability that an object is correctly classified as a rooftop, given a particular feature (e.g., the area); p(A) is the probability that an object belongs to the rooftop class; while p(B) is the probability that the area in a particular vicinity belongs to the range of accepted areas for rooftops provided in the reference dataset. Gaussian Naïve Bayes, whose function is defined in Equation (12), is used in this work as the values for each feature are continuous [23]. The fitting of this model depends on the determination of the standard deviation from the mean of the points in each label. We used the Gaussian NB from the Scikit-learn library with its standard parameters.
P ( x i | y ) = 1 2 π σ y 2 e x i μ y 2 2 σ y 2

3.1.3. Rooftop Detection Evaluation

1.
Cross-validation
A k-fold cross-validation method is used in this paper to indicate the accuracy of the reference set, as provided in Table 1 [24]. The training set is divided into k sets. Then, the model is assessed on the remaining k-1 of the reference set, and the prediction accuracy is saved for each split. Finally, the average accuracy of all the splits is determined.
2.
Accuracy assessment
Accuracy assessment is performed to evaluate the detection results of the testing dataset from the ML algorithms. Four precision metrics, namely precision, recall metrics, F1-score, and overall accuracy, are defined as follows [12]:
P r e c i s i o n = T P T P + F P
R e c a l l = T P T P + F N
F 1 s c o r e = 2     P r e c i s i o n     R e c a l l P r e c i s i o n + R e c a l l
O v e r a l l   a c c u r a c y = T P + T N T P + F P + F N + T N
where True Positive (TP), False Positive (FP), True Negative (TN), and False Negative (FN) indicate the rooftops that are correctly detected, rooftops that are incorrectly detected, rooftops that are correctly rejected, and rooftops that are incorrectly rejected, respectively.
3.
Relative Root Mean Square Error (RRMSE)
Some of the detected rooftops’ areas may exceed or be smaller than the original area of a rooftop; therefore, the Relative Root Mean Square Error (RRMSE) is used to determine the total difference between the detected areas and the digitized rooftops’ areas, as described in [25].
R R M S E ( % ) = 1 N i = 1 N H m i H e i 2 1 N i = 1 N H m i × 100
where N: is the number of detected components; Hmi: is the digitized rooftops’ areas; Hei: detected rooftops’ areas by the ML; and the subscript i indicates the corresponding values of the same pair of the digitized and detected areas.

3.2. Solar PV Potential Estimation

Solar energy can be harnessed using solar PV panels, which collect solar energy and convert it to electrical power. The estimation of the PV potential depends on two steps: (1) The detected buildings’ rooftops’ areas that will be used for the setup of the PV panels, and (2) the parameters that will be used for the solar modeling and estimation of the PV potential. Then, a comparison of the three PV estimation methods is presented to recommend which can be considered the most accurate for our study area.

3.2.1. Preparation of the Rooftops’ Areas

A sample of the rooftops is digitized on Google Earth Pro to form a conversion factor between the area in pixel units and square meters. The rooftops’ areas, generated from the ML stage, are the detected rooftops minus the holes and shadows. However, elevator rooms exist on the rooftop with relatively small sizes forming additional obstructions on the rooftops that must be subtracted. The last remaining obstruction to be considered is the shading induced by the PV rows on each other, which reduces the system performance. The effective area covered by PV depends on the ground coverage ratio (GCR), differentiating the service area from the rooftops’ gross area. The relationship between the GCR and inter-row shading derate factor is provided in Figure 7 [26]. In typical industry practice, arranging the PV system layout to assume shading losses of 2~3% is suggested, generating a derate factor of 0.975 [27]. The tilt angle is chosen as the location’s latitude of 30°.

3.2.2. Parameters Estimation for the PV Module

1.
Solar irradiance
The solar irradiance and meteorological conditions are determined by the study area’s geographic location and the databases used for modeling the solar radiation. The solar irradiance was chosen to be uniform for the study area because of its relatively small size.
2.
Module and array type
In this paper, the monocrystalline Renesola JC300S-24/Bbpw was used as the reference module [28] due to its suitable specifications and low price. It has a maximum power of 300 Watt and a stated efficiency of 18.45% at standard test conditions (STC). Its efficiency equals 18.45% at standard test conditions (STC) [29]. This PV panel was chosen as another counterpart was already used before in similar Cairo areas. A fixed array module was used because its capital and maintenance costs are relatively cheap.
3.
Array tilt
The array tilt is the inclination of the PV module array relative to the horizontal plane. As mentioned in [30], the optimum tilt angle to be used annually for a fixed array is suggested to be equal to the study area’s latitude to produce the optimum average solar irradiance production.
4.
Array orientation
Based on practical recommendations, the energy education section of the University of Calgary mentioned that a practical rule to be used for the setup of the solar panels is that they should be directed towards the true south in the Northern Hemisphere for flat rooftops to collect the optimum amount of sunlight during the day [30].
5.
System size
The direct current (DC) system size is explained as the potential that can be produced by the PV panels based on the panel efficiency. The system size, calculated in kilowatts (kW) in STC, is determined as follows [31]:
S y s t e m   S i z e   ( i n   k W ) = A r r a y   A r e a   m 2 1 k W m 2 m o d u l e   e f f i c i e n c y   ( % )
where the efficiency of the used PV module is 18.45%.
6.
Energy yield
The PV output (E) is calculated using Equation (19) [31]. It depends on the produced average annual solar radiation to estimate the electrical potential.
E = 365     P k     r p     H h i
where E is the annual production of electricity in kilowatt-hours (kWh); Pk is the peak power of the used panels in kilowatts (kW); rp is the performance factor that indicates the efficiency; and Hhi is the annual average of solar radiation production in kWatt-hours (kWh/year).

3.2.3. Solar Modeling

1.
PVWatts calculator
PVWatts Calculator is an online application developed by the US-based National Renewable Energy Laboratory, which provides monthly and yearly electric production [31]. The PVWatts calculator uses data from the National Solar Radiation Database, which is located in the United States, South Asia, and Mexico [31]. For locations outside the US (i.e., South Asia and Mexico), the energy output range depends on the analysis of 30 years of historical weather data of the nearest international database to the required study area. The nearest solar resource data to the study is Cairo International Airport, about 21 km from the study area.
2.
PVGIS
Photovoltaic Geographical Information System (PVGIS) is a web application that analyses the solar model and the performance of the PV panels in a specific location [32]. African databases used in PVGIS are collected from satellite data, which are entered into a model that estimates solar radiation using satellite images.
3.
ArcGIS
ArcGIS is a geographic information system (GIS) package that provides a series of tools, one of which is the spatial analyst tool for calculating solar radiation. The spatial analyst tool depends on DEMs because solar radiation affects the surrounding topography in a specific location. In addition, the sky size and the latitude of the study area’s location are other parameters. The global solar radiation over an area is the sum of the direct and diffuse solar radiation. Calculating solar radiation depends on producing an upward-looking viewshed for the DEM’s cells to represent the topography, which is then used to estimate the direct and diffuse radiations. After that, the process is repeated for every cell in the DEM [33].

3.3. Carbon Emissions Impact

Greenhouse gas production affects every aspect of life on Earth. The emitted CO2 associated with electricity production can be calculated in tonnes equivalent of carbon (tCO2) as [8]:
C a r b o n   e m i s s i o n s = g r i d   e m i s s i o n   f a c t o r     E l e c t r i c i t y   p r o d u c t i o n
The grid emission factor is the ratio of the emitted CO2 to the produced electricity. The value 0.533 (tCO2/MWh) is the chosen grid emission factor for the study based on the Institute for [34]. To describe the amount of CO2 in tCO2/kWh that would be emitted due to using fossil fuels, Equation (20) becomes:
C a r b o n   e m i s s i o n s = 0.533 1000 E l e c t r i c i t y   p r o d u c t i o n   kWh
According to [35], the maximum emission of CO2 associated with the electricity produced by solar panels is 6–10 gCO2e/kWh without considering their manufacture, which is considered negligible compared to the amount produced from fossil fuels.

4. Results and Discussion

4.1. Machine Learning Results

After performing the image pre-processing steps, SVM was applied to the Gaussian blurred output. The outliers (i.e., non-buildings) were small insignificant polygons correctly detected as TN, marked in yellow in Figure 8a,b. At this point, the GB had the advantage over the BF. On the other hand, the BF had the upper hand over the GB in terms of correctly detecting the building’s rooftops’ area with high accuracy without addition or subtraction of the rooftop’s area due to preserving the edges, marked in blue, as shown in Figure 8a,c.
As for NB, it produced many false positives. NB determined the hyper-parameters automatically and assumed that if a polygon’s feature belonged to the reference dataset with a percentage higher than 50%, it became accepted as a ‘rooftop.’ This was the reason for many false positives among the objects of the image regardless of the noise filtering algorithm used, as marked by yellow in Figure 8c,d.
For the accuracy assessment, five-fold cross-validation was used. The average accuracy of all splits was represented as a scoring value with an accompanied confidence interval, as listed in Table 2. The accuracy metrics were then calculated and provided in Table 3. Compared to previous studies [11,12], our proposed workflow, using only one classification stage, achieved a higher F1-score of 94.7% from SVM and 92.1% from NB using the BF or 94.6% from both using the GB. Rooftops were then extracted and evaluated against the reference dataset using the RRMSE, as summarized in Table 4.
GB was better at minimizing the false positives, and the relatively small objects, such as cars and other unimportant objects, were blurred; however, the detected rooftops’ areas either exceed or were smaller compared to the original area of the rooftops due to blurring of the edges, as indicated in blue in Figure 8a. Therefore, the results of GB should be subjected to an additional step to reduce the exceeding areas detected by the ML, such as the largest rectangle algorithm, as suggested in previous work [36]. On the other hand, BF produced better results than GB due to preserving the edges.
The smallest RRMSE was 10.6% produced by using the SVM with BF. This error can be further reduced in case of better spatial resolution data availability, having images collected at different times of the day where the contrast between objects is clear, and increasing the accuracy of the manual digitization process used in the reference data.

4.2. Solar PV Potential Estimations

The GCR was chosen to be 50% using the chart in Figure 7 to consider the effect of shading between rows. Elevator rooms were considered using a sample, and calculating the ratio between their areas to the total rooftop areas was found to be approximately 5%. In addition, the conversion factor used to convert between the pixel’s area and square meters was calculated to be 2.1%. The total usable area was detected to be 71,581 m2. An example of rooftop areas after the obstruction’s removal is shown in Table 5.
The system losses used in the PVWatts calculator and PVGIS are shown in Table 6. The total losses of the used system for the three applications (PVWatts calculator, PVGIS, and ArcGIS) were 14% without including the inverter losses, which were set as 4%. The total losses modeled by the PVWatts calculator were 22.66%, including temperature and inverter losses. The total losses using PVGIS were modeled as 23.29% without including the inverter losses. For ArcGIS, the total losses were an average of 23%. The DC system size was determined by applying Equation (18) as 13,207 kW and used for the three stated methods to determine the potential of the PV system.

4.3. The Output of the Three PV Applications

According to a field survey, the consumption of a residential unit in the study area’s location was estimated to be 500 kW/month; therefore, the average consumption for 296 buildings in the image was 36.20 GWh/year, depending on the currently used traditional energy sources. The solar radiation calculated using the PVWatts calculator, PVGIS, and ArcGIS was 2066, 2458, and 2252.3 kWh/m2/year, respectively. The PV potential and the amount of reduced CO2 emissions were calculated. The PV potential, the average energy compensation, and the prevented CO2 emissions from using PV panels are summarized in Table 7.
The average emission of CO2 accompanied by using traditional energy sources was equal to 20,032.3 tCO2e; however, the CO2 emissions when using PV panels were relatively minimal and can be neglected. As a result, the CO2 emission was reduced by an average of approximately 62% based on the calculations presented in this paper. It should be noted that the rooftops were detected at RRMSE of +10.6%; therefore, the results of the PV potentials could be estimated with a higher value of 10.6%, corresponding to an average potential of 2.42 GWh/year, which is insignificant.

5. Conclusions

The proposed approach produced reliable results in rooftop detection and, hence, the estimation of the PV potential. The findings of this paper can be summarized as follows:
  • Using gamma correction improved edge detection, facilitating the preservation of the rooftops’ edges in the following steps to separate the rooftops from the surrounding objects with similar spectral properties;
  • Shadow masking application effectively identified the voids on the rooftops; hence, the voids were avoided in rooftops’ areas detection;
  • Mean-shift segmentation was essential for blending colors on the rooftops, producing better clustering results;
  • Vegetation masking has shown high capability in filtering out clay and soil parts in the vegetation areas, which would have been wrongly segmented;
  • The application of morphological transformations has improved the separation between the weakly connected components, footpaths and buildings, which were spectrally similar;
  • With the proposed image pre-processing workflow, NB produced satisfactory results (92.2% F1-sore), although it is usually used for text recognition more than object classification;
  • The availability of databases of the study location is crucial for PV potential estimation. Consequently, PVGIS, in our case, produced the most accurate results of 24.9 GWh/year, as it uses African databases.
The presented approach relies on several algorithms for enhancing the accuracy of polygonization and detection of the rooftops. Thus, the limitation of this paper is that the rooftops should have close spectral properties to achieve accurate results for the segmentation process and to ensure the consistency of the preparation of the training dataset. Otherwise, different series of image enhancements along with different orders should be applied. It is also highly recommended to use very high-resolution images in the analysis. Using high-resolution images from commercial satellites and airborne or unmanned aerial vehicles can significantly improve the polygonization results, decreasing the RRMSE.
The results of this study not only enable the efficient utilization of rooftops for solar energy generation but also promote the adoption of clean and renewable energy sources, reducing the dependence on fossil fuels. Ultimately, this research contributes to sustainability by facilitating the widespread integration of solar energy into existing urban infrastructures, hence fostering a greener and more sustainable future.

Author Contributions

Conceptualization, E.M., A.E.-S. and S.M.; methodology, E.M., A.E.-S. and S.M.; software, E.M.; validation, E.M. and S.M.; formal analysis, E.M.; investigation, E.M., A.E.-S. and S.M.; resources, E.M., A.E.-S. and S.M.; data curation, E.M. and S.M.; writing—original draft preparation, E.M.; writing—review and editing, A.E.-S. and S.M.; visualization, E.M. and S.M.; supervision, A.E.-S. and S.M.; project administration, A.E.-S. and S.M.; funding acquisition, A.E.-S. and S.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Achberger, C.; Berry, D.; Rayner, D. State of the Climate in 2011: Special Supplement. Bull. Am. Meteorol. Soc. 2012, 93, 282. [Google Scholar]
  2. Cramer, W.; Yohe, G. Coral reefs. In Climate Change 2014 Impacts, Adaptation and Vulnerability: Part A: Global and Sectoral Aspects; Cambridge University Press: Cambridge, UK, 2015; pp. 97–166. ISBN 9781107415379. [Google Scholar] [CrossRef] [Green Version]
  3. Terrestrial and Inland Water Systems. Available online: https://www.ipcc.ch/report/ar5/wg2/terrestrial-and-inland-water-systems/ (accessed on 2 April 2023).
  4. Howell, S. The Global Climate in 2011–2015; World Meteorological Organization: Geneva, Switzerland, 2016. [Google Scholar]
  5. Wiginton, L.K.; Nguyen, H.T.; Pearce, J.M. Quantifying rooftop solar photovoltaic potential for regional renewable energy policy. Comput. Environ. Urban. Syst. 2010, 34, 345–357. [Google Scholar] [CrossRef] [Green Version]
  6. Luqman, M.; Ahmad, S.R.; Khan, S.; Ahmad, U.; Raza, A.; Akmal, F. Estimation of Solar Energy Potential from Rooftop of Punjab Government Servants Cooperative Housing Society Lahore Using GIS. Smart Grid Renew. Energy 2015, 6, 128–139. [Google Scholar] [CrossRef] [Green Version]
  7. Chow, A.; Li, S.; Fung, A.S. Modeling urban solar energy with high spatiotemporal resolution: A case study in Toronto, Canada. Int. J. Green Energy 2016, 13, 1090–1101. [Google Scholar] [CrossRef]
  8. Ntsoane, M. Rooftop Solar PV Potential Assessment in the City of Johannesburg. Ph.D. Dissertation, Stellenbosch University, Stellenbosch, South Africa, 2017. [Google Scholar]
  9. Carl, C. Calculating Solar Photovoltaic Potential on Residential. Ph.D. Dissertation, University of Southern California, Los Angeles, CA, USA, 2014. [Google Scholar]
  10. Ghanea, M.; Moallem, P.; Momeni, M. Automatic building extraction in dense urban areas through GeoEye multispectral imagery. Int. J. Remote Sens. 2014, 35, 5094–5119. [Google Scholar] [CrossRef]
  11. Baluyan, H.; Joshi, B.; Al Hinai, A.; Woon, W.L. Novel Approach for Rooftop Detection Using Support Vector Machine. ISRN Mach. Vis. 2013, 2013, 819768. [Google Scholar] [CrossRef] [Green Version]
  12. Joshi, B.; Baluyan, H.; Hinai, A.A.; Woon, W.L. Automatic Rooftop Detection Using a Two-Stage Classification. In Proceedings of the 2014 UKSim-AMSS 16th International Conference on Computer Modelling and Simulation, Cambridge, UK, 26–28 March 2014; pp. 286–291. [Google Scholar] [CrossRef]
  13. Mardikis, K.; Katsikas, N.; Psomopoulos, C.S.; Ioannidis, G.C. An assessment and through analysis of the two major free photovoltaic software. In Proceedings of the 12th International Conference on Protection and Restoration of the Environment, Skiathos Island, Greece, 29 June–3 July 2014; pp. 286–291. [Google Scholar]
  14. Worldometer Egypt Population Data. Available online: https://www.worldometers.info/world-population/egypt-population/ (accessed on 2 April 2023).
  15. Comsan, M.N.H. Solar Energy Perspectives in Egypt. In Proceedings of the 4th Environmental Physics Conference, Hurghada, Egypt, 10–14 March 2010; pp. 1–11. [Google Scholar]
  16. International Energy Data, Monthly Update. Available online: https://knoema.com/EIAINTL2018May/international-energy-data-monthly-update# (accessed on 2 April 2023).
  17. Egypt’s Vision 2030. Available online: http://sdsegypt2030.com/?lang=en (accessed on 2 April 2023).
  18. Nixon, M.; Aguado, A. Feature Extraction and Image Processing; Elsevier: Amsterdam, The Netherlands, 2002. [Google Scholar] [CrossRef]
  19. Banterle, F.; Corsini, M.; Cignoni, P.; Scopigno, R. A low-memory, straightforward and fast bilateral filter through subsampling in spatial domain. Comput. Graph. Forum 2012, 31, 19–32. [Google Scholar] [CrossRef]
  20. Zou, Z.; Lin, X. Geoinformatics production for urban disasters risk reduction: A zero cost solution. Commun. Comput. Inf. Sci. 2013, 398 Pt I, 313–324. [Google Scholar] [CrossRef]
  21. Support Vector Machines—Scikit-Learn 1.4. Documentation. Available online: https://scikit-learn.org/stable/modules/svm.html (accessed on 2 April 2023).
  22. Graphical Models: Bayesian Network. Available online: https://people.cs.umass.edu/~mccallum/courses/gm2011/ (accessed on 2 April 2023).
  23. Drozdov, V.N.; Kim, V.A.; Lazebnik, L.B. Modern approach to the prevention and treatment of NSAID-gastropathy. Clin. Exp. Gastroenterol. 2011, 2, 106–110. [Google Scholar]
  24. Cross-Validation: Evaluating Estimator Performance—Scikit-Learn 3.1. Documentation. Available online: https://scikit-learn.org/stable/modules/cross_validation.html#computing-cross-validated-metrics (accessed on 2 April 2023).
  25. Kambezidis, H.D. The Solar Resource. In Comprehensive Renewable Energy, 2nd ed.; Elsevier: Amsterdam, The Netherlands, 2022; Volume 3, pp. 26–117. [Google Scholar] [CrossRef]
  26. Rix, A.J.; Mahachi, T.B. Energy Yield Analysis and Evaluation of Solar Irradiance Models for a Utility Scale Solar PV Plant in South Africa; Stellenbosch University: Stellenbosch, South Africa, 2016; Volume 139. [Google Scholar] [CrossRef]
  27. Masters, G.M. Renewable and Efficient Electric Power Systems, 1st ed.; John Wiley & Sons: Hoboken, NJ, USA, 2004; ISBN 3175723993. [Google Scholar] [CrossRef]
  28. 60-Cell Mono Solar Panel 5Busbar. Available online: http://www.renesola.com/product/Solar/Solar_Panel/60-cell_Mono_Solar_Panel_5Busbar/ (accessed on 2 April 2023).
  29. Würfel, P.; Würfel, U. Physics of Solar Cells: From Basic Principles to Advanced Concepts, 3rd ed.; John Wiley & Sons: Hoboken, NJ, USA, 2016; ISBN 9783527413126. [Google Scholar]
  30. Solar Panel—Energy Education. Available online: https://energyeducation.ca/encyclopedia/Solar_panel (accessed on 2 April 2023).
  31. National Renewable Energy Laboratory. PVWatts Calculator. Available online: https://pvwatts.nrel.gov/pvwatts.php (accessed on 2 April 2023).
  32. Šúri, M.; Huld, T.A.; Dunlop, E.D. PV-GIS: A web-based solar radiation database for the calculation of PV potential in Europe. Int. J. Sustain. Energy 2005, 24, 55–67. [Google Scholar] [CrossRef]
  33. ESRI-ArcGIS Modeling Solar Radiation—Help|ArcGIS for Desktop. Available online: https://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/modeling-solar-radiation.htm (accessed on 2 April 2023).
  34. Takahashi, K.; Louhisuo, M. IGES List of Grid Emission Factors. Volume 10.10. p. 5. 2021. Available online: https://www.iges.or.jp/en/pub/list-gridemission-factor/en (accessed on 2 April 2023).
  35. Reich, N.H.; Alsema, E.A.; Van Sark, W.G.J.H.M.; Nieuwlaar, E. CO2 Emissions of PV in the perspective of a Renewable Energy Economy. In Proceedings of the 22nd European Photovoltaic Solar Energy Conference, Milan, Italy, 3–7 September 2007; pp. 3538–3542. [Google Scholar]
  36. Muhammed, E.; Morsy, S.; El-Shazly, A. Building rooftops extraction for solar PV potential estimation using GIS-based methods. ISPRS Arch. Photogramm. Remote Sens. Spat. Inf. Sci. 2021, 44, 119–125. [Google Scholar] [CrossRef]
Figure 1. The study area: (a) Location of the study area on Egypt’s map and (b) B6 division image.
Figure 1. The study area: (a) Location of the study area on Egypt’s map and (b) B6 division image.
Sustainability 15 11004 g001
Figure 2. Different patterns of buildings: (a) B64: six floors with four flats and (b) B66: seven floors with two flats.
Figure 2. Different patterns of buildings: (a) B64: six floors with four flats and (b) B66: seven floors with two flats.
Sustainability 15 11004 g002
Figure 3. Rooftop digitization (in blue color) for reference data preparation.
Figure 3. Rooftop digitization (in blue color) for reference data preparation.
Sustainability 15 11004 g003
Figure 4. Pre-processing steps workflow.
Figure 4. Pre-processing steps workflow.
Sustainability 15 11004 g004
Figure 5. The effect of image pre-processing steps: (a) The original image; (b) Gamma correction; (c) Shadow masking; (d) Gaussian blur with mean-shift segmentation; (e) Bilateral filtering with mean-shift segmentation; (f) Vegetation masking after mean-shift segmentation; (g) k-means clustering—Cluster 1: Rooftops, Cluster 2: Facades and parts of footpaths, and Cluster 3: Masked shadows and vegetations; (h) Connected components before applying morphological transformations; (i) Connected components after applying morphological transformations.
Figure 5. The effect of image pre-processing steps: (a) The original image; (b) Gamma correction; (c) Shadow masking; (d) Gaussian blur with mean-shift segmentation; (e) Bilateral filtering with mean-shift segmentation; (f) Vegetation masking after mean-shift segmentation; (g) k-means clustering—Cluster 1: Rooftops, Cluster 2: Facades and parts of footpaths, and Cluster 3: Masked shadows and vegetations; (h) Connected components before applying morphological transformations; (i) Connected components after applying morphological transformations.
Sustainability 15 11004 g005
Figure 6. Processing workflow of the machine learning algorithms.
Figure 6. Processing workflow of the machine learning algorithms.
Sustainability 15 11004 g006
Figure 7. The relation between GCR and derate factor caused by inter-row shading [26].
Figure 7. The relation between GCR and derate factor caused by inter-row shading [26].
Sustainability 15 11004 g007
Figure 8. ML output: (a) SVM after BF; (b) SVM after GB; (c) NB after BF; (d) NB after GB.
Figure 8. ML output: (a) SVM after BF; (b) SVM after GB; (c) NB after BF; (d) NB after GB.
Sustainability 15 11004 g008aSustainability 15 11004 g008b
Table 1. K-folds cross-validation diagram [24].
Table 1. K-folds cross-validation diagram [24].
No. of SplitsTraining Set
Split 1Fold 1Fold 2Fold 3Fold 4Fold 5
Split 2Fold 1Fold 2Fold 3Fold 4Fold 5
Split 3Fold 1Fold 2Fold 3Fold 4Fold 5
Split 4Fold 1Fold 2Fold 3Fold 4Fold 5
Split 5Fold 1Fold 2Fold 3Fold 4Fold 5
Green color: the trained folds. Blue color: the validated fold.
Table 2. Cross-validation results of SVM and NB.
Table 2. Cross-validation results of SVM and NB.
ML TechniqueScoring ValueConfidence Interval
SVM0.946±0.07
NB0.973±0.048
SVM: Support Vector Machine, NB: Naïve Bayes.
Table 3. Accuracy measures using SVM and NB. The highest values are in bold.
Table 3. Accuracy measures using SVM and NB. The highest values are in bold.
Noise Filtering TechniqueML TechniquePrecisionRecallF1-ScoreOverall Accuracy
Gaussian BlurSVM91.5%98.0%94.6%90.3%
NB91.0%98.0%94.6%90.1%
Bilateral FilteringSVM91.2%98.6%94.7%90.2%
NB86.6%98.3%92.1%85.9%
SVM: Support Vector Machine, NB: Naïve Bayes.
Table 4. Summary of RRMSE for the four different cases.
Table 4. Summary of RRMSE for the four different cases.
Noise Filtering TechniqueML TechniqueRMSE%
Gaussian BlurSVM11.8%
NB11.0%
Bilateral FilteringSVM10.6%
NB10.9%
SVM: Support Vector Machine, NB: Naïve Bayes.
Table 5. An example of rooftop usable area calculations.
Table 5. An example of rooftop usable area calculations.
IDsDetected Area (m2)After Removing Obstructions (m2)Final Usable Area (m2)
1294.46279.74139.86
2292.38277.76138.88
3289.02274.57137.29
4408.43388.00194.00
5286.88272.53136.27
Table 6. System losses in PVWatts calculator and PVGIS.
Table 6. System losses in PVWatts calculator and PVGIS.
CategoryLoss (%)
Soiling2
Shading3
Snow0
Mismatch 2
Wiring2
Connections0.5
Light-Induced Degradation 1.5
Nameplate Rating1
Age0
System Availability 2
SVM: Support Vector Machine, NB: Naïve Bayes.
Table 7. PV potential, energy compensation, and CO2 reduction using the three methods.
Table 7. PV potential, energy compensation, and CO2 reduction using the three methods.
Method/EstimationPVWatts PVGISArcGIS
PV potential (GWh/year)21.1024.9022.90
Energy compensation and carbon reduction (%)58.2968.7863.25
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Muhammed, E.; El-Shazly, A.; Morsy, S. Building Rooftop Extraction Using Machine Learning Algorithms for Solar Photovoltaic Potential Estimation. Sustainability 2023, 15, 11004. https://doi.org/10.3390/su151411004

AMA Style

Muhammed E, El-Shazly A, Morsy S. Building Rooftop Extraction Using Machine Learning Algorithms for Solar Photovoltaic Potential Estimation. Sustainability. 2023; 15(14):11004. https://doi.org/10.3390/su151411004

Chicago/Turabian Style

Muhammed, Eslam, Adel El-Shazly, and Salem Morsy. 2023. "Building Rooftop Extraction Using Machine Learning Algorithms for Solar Photovoltaic Potential Estimation" Sustainability 15, no. 14: 11004. https://doi.org/10.3390/su151411004

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop