You are on page 1of 8

Available online at www.sciencedirect.

com

Energy Procedia 33 (2013) 335 – 342

PV Asia Pacific Conference 2012

Block Matching Algorithms: Their Applications and


Limitations in Solar Irradiance Forecasting

Yang Dazhia,∗, Wilfred M. Walsha , Dong Ziboa , Panida Jirutitijaroenb ,


Thomas G. Reindla
a Solar
Energy Research Institute of Singapore, National University of Singapore, 7 Engineering Drive 1, Block E3A,
Singapore 117574, Singapore
b Department of Electrical and Computer Engineering, National University of Singapore, 4 Engineering Drive 3, Block E4,

Singapore 117576, Singapore

Abstract
Block matching algorithms (BMAs) are widely used in motion analyses of 2D image data. Comparisons are made
between one subregion and all adjacent subregions at consecutive timesteps to seek the the most likely 2D evolution of
the subregion using the minimisation of various cost functions such as cross-correlation coefficient, sum of the absolute
value of difference and sum of squared difference. BMAs are based on the assumption that the inter-frame motion is
small. Therefore, in situations where high spatial and temporal resolution irradiance data is used, the algorithms can
generate motion vectors describing the changes in irradiance maps and cloud images. We demonstrate the application of
BMAs to irradiance map forecasting using global horizontal irradiance data collected from 10 Singapore meteorological
stations. We then discuss the application of BMAs in cloud forecasts, which can as well be used for radiation assessment.
We also propose a cloud boundary tracking method used in situations where the cloud image has low spatial resolution.
The proposed algorithms act as a preliminary step to achieve high-accuracy 2D solar irradiance forecasts.
© 2013 The Authors. Published by Elsevier Ltd. Open access under CC BY-NC-ND license.

c 2013 Published
Selection by Elsevier
and peer-review Ltd.responsibility
under Selection and/or peer-review
of Solar Energyunder responsibility
Research InstituteofofSolar Research
Singapore Institute
(SERIS) of Sin-
– National
University
gapore of Singapore
(SERIS) – National(NUS). The of
University PVSingapore
Asia Pacific Conference
(NUS). 2012Pacific
The PV Asia was jointly organised
Conference 2012by
wasSERIS
jointlyand the Asian
organised
Photovoltaic
by SERIS andIndustry
the AsianAssociation
Photovoltaic(APVIA)
Industry Association (APVIA).

Keywords: Block matching, Irradiance map, Cloud image, Cloud boundary tracking

1. Introduction

Block matching algorithms (BMAs) are the dominant methods in motion analyses, not only for me-
teorological applications but also for many other object tracking tasks such as traffic control [1] and face
detection [2]. The core assumption of all the BMAs is that the inter-frame changes are small. Based on this
assumption, various cost functions are used to compare all the likely inter-frame motions. Cross-correlation
coefficient (CCC), sum of the absolute value of difference (SAVD) and sum of squared difference (SSD) are
three common metrics.

∗ Correspondingauthor. Tel.: +65 9159 0888; fax: +65 6775 1943


Email address: yangdazhi.nus@gmail.com (YANG Dazhi)

1876-6102 © 2013 The Authors. Published by Elsevier Ltd. Open access under CC BY-NC-ND license.
Selection and peer-review under responsibility of Solar Energy Research Institute of Singapore (SERIS) – National University of Singapore
(NUS). The PV Asia Pacific Conference 2012 was jointly organised by SERIS and the Asian Photovoltaic Industry Association (APVIA)
doi:10.1016/j.egypro.2013.05.074
336 Yang Dazhi et al. / Energy Procedia 33 (2013) 335 – 342

Equal sized templates (groups of pixels) are extracted from two time consecutive frames 1 . The dis-
placement of a template from the primary frame to the target frame is governed by intensity conservation
equation:
I(x, y, t) = a × I(x + δx, y + δy, t + δt) + m + n (1)
where a is a scale factor which describes the differences in image contrast, and m is a bias term modelling
the possible differences in mean intensity level. The intensity in this application is referred to image color
intensity, for example, the grey level.2 A term n is also introduced to account for the unavoidable noise in
real world imagery. Equation (1) describes the possible displacement of the template centered at (x, y) at
time t. δt is always constrained by the temporal resolution of the data. Unless the behaviour of motion vec-
tors at various temporal scales needs to be studied, the smallest δt is always used to satisfy the assumption
of small inter-frame motions.

Novel BMAs research concentrates on three different aspects, namely, the cost function, the computation
speed and the vector field smoothing techniques. SAVD and SSD are faster and sometimes more accurate
than CCC, but CCC describes the possible second order statistic in the data. Therefore, the choice of cost
function is subjective to the application. The exhaustive search method [3], also known as full search, is the
most computationally expensive block matching algorithm of all as it computes the cost function for every
possible match within the search distance. A three-steps search can be used to overcome the disadvantages
of the exhaustive search, but the accuracy is limited by the reduced number of matching candidates. Refer-
ence [4] proposed a new three-step search by strategically adding eight extra candidates per step to improve
on the original three-steps search. Such algorithms greatly improve the computational speed. Reference [5]
describes an iterative method to smooth the vector fields based on maximum likelihood.

We utilise some of these techniques to perform block matching on consecutive irradiance maps with
temporal resolution of five minutes. The irradiance maps are obtained by fitting a 2D spline interpolated
trend surface over the global horizontal irradiance (GHI) data from 10 irradiance measurement stations in
Singapore. Reference [6] has shown that the statistical irradiance forecast accuracy can be significantly
improved by considering cloud cover. We thus demonstrate the technique on cloud forecast. A new cloud
boundary tracking method using cubic B-spline is proposed to deal with situations where cloud images have
low resolution.

This paper is organised as follows. Section 2 briefly describes the irradiance data collection and pro-
cessing procedures. Section 3 introduces the proposed algorithm for irradiance map motion analyses. As
only the preliminary results of our work is shown, we omit any forecast results. Section 4 demonstrates
the application of BMAs on cloud images. As the cloud image has low resolution, we propose a boundary
movement method to track the clouds. Section 5 summarizes the findings of this work.

2. Data Collection and Processing

Figure 1 shows the geographical locations of 10 irradiance measurement stations in Singapore. These
stations are designed to perform monitoring and control for solar PV systems availability and reliability.
Silicon sensors are employed at each station to measure solar irradiance. The installation of the sensors
generally follows the tilt angle and azimuth of the PV systems being monitored. In this work, we aim to
capture the dynamics of the spatial-temporal process, so horizontal irradiance data is needed for all station
locations. Therefore we convert the irradiance measurements on tilted planes to global horizontal irradiance.

1 Overlaps of pixels between neighbouring templates are allowed.


2 One can imagine the intensity at each pixel corresponds to the cloud density at that pixel. We believe the processes of extinction
and creation of clouds can not complete in a short period, e.g., within two consecutive frames, thus the intensity conserves.
Yang Dazhi et al. / Energy Procedia 33 (2013) 335 – 342 337

S105
S104

S109 S110
S108
S102
S103
S106
S107
S101

Fig. 1: Geographic locations of the 10 irradiance measurement stations used in this study (red triangles).
Source: Google Map, retrieved 11 June 2012. The size of Singapore is 41.8 kms ENE-WSW and 22.5 kms
SSE-NNW.

Various transposition models have been proposed to convert solar irradiance on the horizontal plane to
that on the tilted plane. The global irradiance, It , on a tilted plane, whose tilt is s degrees from the horizontal,
can be evaluated from the classic equation [7]:

It = IDir cos θ + IDif Rd + ρIGlo Rr (2)

where IDir is direct normal solar irradiance (DNI), IDif is the diffuse horizontal irradiance (DHI), IGlo is GHI,
θ is the angle of incidence of the sun rays on the tilted plane, Rd is the diffuse transposition factor, ρ is the
foreground’s albedo, and Rr is the transposition factor for ground reflection. In Equation (2), incidence angle
θ is purely geometric, the formulation is straightforward. Rd and Rr are functions of the tilted angle s under
isotropic approximation [8, 9]. In our situation, It is known. We can solve Equation (2) to obtain all three
irradiance components, namely, GHI, DHI and DNI, through:

IGlo = IDir cos Z + IDif (3)

and various decomposition models. Decomposition models provide a representation of DNI using GHI
[see reference 10, for details]. Theoretically, we have three unknowns (three irradiance components) and
three equations (Equation (2), (3) and decomposition model) to arrive at unique solutions. In reality, the
non-negatively constrained nonlinear piecewise equations are not straightforward to solve and are hence
described in details separately [11]. For this analysis, we use five minute GHI data from those 10 stations.

3. Irradiance Map Motion Analyses

The solar irradiance images are obtained by fitting a 2D spline interpolated surface to the measured val-
ues at the 10 stations. Figure 2 shows two irradiance image samples. The colors on the maps indicate the
global horizontal irradiance. Some variations of irradiance at east and west of the island are observed while
the irradiance at the center of the island has little variation. These variations are likely caused by local small
338 Yang Dazhi et al. / Energy Procedia 33 (2013) 335 – 342

Fig. 2: The irradiance maps from two consecutive time steps. Top map is from 2012 April 4, 11:40 am
Singapore local time; bottom map is from 2012 April 4, 11:41 am.

cloud movements.

Figure 3 illustrates the BMA used in this work. A template (the light green box in the figure) is selected
from time step T − 1. Within the search distance (the dotted blue box), the best match template (the dark
green box) from time T is selected based on the error metrics, for example, the candidate with the smallest
SSD is selected. A vector is thus drawn from the center of the primary template to the center of target tem-
plate. By repeating the procedure across the map, we obtain a vector map such as the one shown in Figure
4 3 . By adjusting the irradiance level pixel by pixel according to the nearest vector, we obtain a forecast
irradiance map.

We now describe several considerations for BMAs. The first consideration is the size of the template.
A small template can result in insufficient pixels to justify the displacement maximum likelihood estimate.
Large templates lead to insufficient number of vectors to describe the irradiance variations. Various template
sizes are generally considered to identify an optimum for a given dataset. The second consideration is
the search distance. The search distance may be described using meteorological parameters such as daily
average wind speed. After the search distance is defined, cost functions are chosen based on performance.
In this work, the BMA model is selected as follows based on our previous experiences:
• Template size: 25 pixels × 25 pixels
• Search distance: 18 pixels × 18 pixels

3 The actual BMA is performed on grey level plots.


Yang Dazhi et al. / Energy Procedia 33 (2013) 335 – 342 339

Fig. 3: Left: a conceptual plot of the block matching algorithm. Right: a zoomed view of the search area.

Fig. 4: Vector field generated by BMAs shows 2D variation in irradiance within two consecutive time steps
as shown in Figure 2.

• Cost function: cross correlation coefficient

• Search method: exhaustive (search all 18×18 possibilities within the search distance)
• Vector smoothing technique: none
Note that the search distance in our application is chosen to be slightly smaller than the template size. This
is to ensure that the derived vectors can justify the displacement maximum likelihood (more pixels provide
more information for template comparisons).

4. Cloud Image Motion Analyses

As discussed earlier, BMAs are based on the assumption that the inter-frame motion is small; in situ-
ations where the spatial and temporal resolution is low, the algorithms often fail to realise smooth motion
vectors. Under such conditions, we propose a new algorithm to track the cloud contour. Note that the cloud
images we are dealing in this section are obtained by meteorological measurements; they are not derived
from the previous irradiance map.
340 Yang Dazhi et al. / Energy Procedia 33 (2013) 335 – 342

1.5

1.0

0.8
1.4

0.6

0.4
1.3

0.2

0.0
1.2

103.6 103.7 103.8 103.9 104.0 104.1

Fig. 5: Demonstration for contour tracking algorithm. Green triangles are the boundaries of cloud in primary
frame (at time t − 1), blue crosses are the boundaries of cloud in target frame (at time t). Red arrows indicate
various contour displacements at the boundaries. Color bar shows the gray level. Persistence can be used to
forecast the movement in the next time step (at time t + 1).

Contour models are widely used for computer vision problems including image segmentation, edge
detection and visual tracking [12]. Contour estimation and tracking is a seemingly good solution to our
problem, namely, quantify the multiple piecewise cloud evolution. Instead of displaying highly complex
mathematics equations [13] of contour tracking, we present a qualitative argument below.

The first step of our algorithm is to determine the cloud contours. We use the standard implementation
offered by the statistics software R [14] to discretise the contour at specific levels. The contour for gray
level 0.2 is used in the example plot, Fig. 5. It is worth noting two things at this stage. First, to capture
the cloud motion, not only at the boundary but also within the cloud, contours at different discrete levels
need to be considered. Second, there might exist more than one contour in the frame. The R implementation
automatically takes care of the second issue but not the first. We can easily achieve the first using an iterative
procedure when needed.

After the contours are determined, a single cubic B-spline is used to fit all the points described by the
contours for each frame. To understand the cubic B-spline fitting, one can imaging using a thread to connect
a series of check points (knots). The thread has to satisfy continuity of constraints (first and second order
Yang Dazhi et al. / Energy Procedia 33 (2013) 335 – 342 341

derivatives) at each knot. A group of equidistant points is selected from the B-spline 4 . Our final step is to
map the points from the primary frame to those in the target frame. The minimal energy criterion exists in
all coordinate mapping techniques. In our application, the minimal distance between a primary point and
a target point is used as the energy function. To avoid the problem of many-to-one mapping, the sum of
distance of a group of points is considered, i.e, a one-to-one mapping within a group of points is preferred.
In Fig. 5, a group of five points is used; we establish a one-to-one mapping between five primary points and
five target points.

We demonstrate the above procedure in Fig. 5. The red arrows indicate various contour displacements at
the cloud boundaries. Instead of considering a vector field, the cloud movement is described by a collection
of single point displacements. Thus by applying persistence model on the displacement vectors, we can
forecast the cloud movement. Note that some primary points (green triangles) do not have any match as we
set a threshold displacement. These points represent the extinction of cloud at the specific locations. The
proposed method is more precise than the motion vectors developed using a low resolution cloud image
based on our preliminary results.

5. Conclusion

Block matching algorithms show potential in solar irradiance map forecasts. However, BMAs have
limitation when the inter-pixel/pixel groups similarity is high. A new contour tracking method focusing on
boundary elements is proposed. We aim to integrate the results from irradiance map and the cloud forecast,
and investigate the correlation between clouds and irradiance maps in near future.

Acknowledgment

This work is supported by “Novel monitoring and control unit for enhanced availability and reliability
of solar PV systems optimisation of photovoltaic electricity generation in tropical power grids through ra-
diation forecasting and system monitoring”. The project is funded by the National Research Foundation
of Singapore under the Clean Energy Research Programme Grant No. NRF2010EWT-CERP001-030. We
acknowledge LabView programming by Marek Kubis of SERIS, and thank Andre Nobre for his assistance
with the PV irradiance data.

References
[1] E. Viarani, Extraction of traffic information from images at deis, in: Image Analysis and Processing, 1999. Proceedings. Interna-
tional Conference on, 1999, pp. 1073 –1076. doi:10.1109/ICIAP.1999.797741.
[2] T. Nakai, T. Okakura, K. Arakawa, Face recognition across age progression using block matching method, in:
Communications and Information Technologies (ISCIT), 2010 International Symposium on, 2010, pp. 620 –625.
doi:10.1109/ISCIT.2010.5665063.
[3] M. Sayed, A fast architecture for exhaustive search block matching algorithm with mpeg-4 applications, in: Elec-
tronics, Circuits, and Systems, 2009. ICECS 2009. 16th IEEE International Conference on, 2009, pp. 787 –790.
doi:10.1109/ICECS.2009.5410777.
[4] R. Li, B. Zeng, M. Liou, A new three-step search algorithm for block motion estimation, Circuits and Systems for Video Tech-
nology, IEEE Transactions on 4 (4) (1994) 438 –442. doi:10.1109/76.313138.
[5] Q. X. Wu, A correlation-relaxation-labeling framework for computing optical flow - template matching from a new perspective,
IEEE Trans. Pattern Anal. Mach. Intell. 17 (9) (1995) 843–853. doi:10.1109/34.406650.
URL http://dx.doi.org/10.1109/34.406650
[6] D. Yang, P. Jirutitijaroen, W. M. Walsh, Hourly solar irradiance time series forecasting using cloud cover index, Solar Energy
86 (12) (2012) 3531 – 3543. doi:10.1016/j.solener.2012.07.029.
URL http://www.sciencedirect.com/science/article/pii/S0038092X12003039
[7] C. A. Gueymard, Direct and indirect uncertainties in the prediction of tilted irradiance for solar engineering applications, Solar
Energy 83 (3) (2009) 432 – 444. doi:10.1016/j.solener.2008.11.004.
URL http://www.sciencedirect.com/science/article/pii/S0038092X08002983

4 The choice of distance measurement is set by the user.


342 Yang Dazhi et al. / Energy Procedia 33 (2013) 335 – 342

[8] C. A. Gueymard, Direct and indirect uncertainties in the prediction of tilted irradiance for solar engineering applications, Solar
Energy 83 (3) (2009) 432–444.
[9] R. Perez, R. Seals, J. Michalsky, All-weather model for sky luminance distribution–preliminary configuration and validation,
Solar Energy 50 (3) (1993) 235 – 245. doi:10.1016/0038-092X(93)90017-I.
URL http://www.sciencedirect.com/science/article/pii/0038092X9390017I
[10] D. G. Erbs, S. A. Klein, J. A. Duffie, Estimation of the diffuse radiation fraction for hourly, daily and monthly-average global
radiation, Solar Energy 28 (4) (1982) 293 – 302.
[11] D. Yang, Z. Dong, P. Jirutitijaroen, W. M. Walsh, Evaluation of transposition and decomposition models for converting global
solar irradiance from tilted surface to horizontal in tropical region, in prep.
[12] A. Blake, M. Isard, Active Contours: The Application of Techniques from Graphics,Vision,Control Theory and Statistics to
Visual Tracking of Shapes in Motion, 1st Edition, Springer-Verlag New York, Inc., Secaucus, NJ, USA, 1998.
[13] W. Tao, X.-C. Tai, Multiple piecewise constant with geodesic active contours (mpc-gac) framework for interactive image segmen-
tation using graph cut optimization, Image and Vision Computing 29 (8) (2011) 499 – 508. doi:10.1016/j.imavis.2011.03.002.
URL http://www.sciencedirect.com/science/article/pii/S0262885611000254
[14] R Development Core Team, R: A Language and Environment for Statistical Computing, R Foundation for Statistical Computing,
Vienna, Austria, ISBN 3-900051-07-0 (2011).
URL http://www.R-project.org/

You might also like