You are on page 1of 5

Fast Global Blur Estimation Using A Learning-based Approach

Shalin Mehta and Baoxin Li


Department of Computer Science and Engineering
Arizona State University
Tempe, AZ, USA

ABSTRACT computation is a key requirement. A fast algorithm for


local blur estimation was proposed in [2], which was
In this paper a novel learning-based approach is proposed found in our study to be sensitive to the choice of the trial
for global focal blur estimation in a given image. The blur filters.
focal blur is modeled as Gaussian low-pass filtering and
In this paper a novel learning-based approach is
the radius of the Gaussian kernel is identified for different
proposed for global focal blur estimation for a given
degrees of blur. A set of training images are then used to
image. The focal blur is modeled as a Gaussian low-pass
learn the mapping between the estimated blur and the
filtering and the radius of the Gaussian kernel is identified
actual one. Empirical study also leads to a method for
for different degrees of blur. The paper also proposes a
finding reliable pixel positions at which the blur
method for finding reliable pixel positions at which the
estimation should be carried out. The proposed method
blur estimation should be carried out. Using a set of high-
was tested with over 40 test images of various contents,
resolution training images, blur estimation is performed
and it was found to be able to estimate the Gaussian blur
with a simulated blur radius varying from 0.2 to 3 in steps
with very good accuracy while being computational
of 0.1. The mapping between the estimated blur and the
efficient.
actual blur is learned using this training set and is used to
find the blur metric for any new test image.
1. INTRODUCTION The rest of the paper is organized as follows. Section
2 briefly describes a local blur estimator proposed in [2],
Focal blur occurs in the image or video when the object is which forms the basis of the proposed method. Section 3
placed out of the focal range of the camera [1]. Some describes our proposed algorithm, followed by the
other types of blur may also be approximated by focal experimental results in Section 4. The conclusion and a
blur. Identifying the exact amount of blur in a given image short discussion on future work are given in Section 5.
is essential in many applications. For example, in image
restoration the blur radius is often necessary for modeling
the degradation. Blur metric also plays a key role in 2. LOCAL BLUR ESTIMATION
subjective quality measurement of images or videos.
Digital auto-focusing system extensively relies on the The proposed method makes use of the local blur
output of automatic blur estimation. estimator described in [2] for initial blur estimation. For
completeness, the algorithm is briefly presented below
Focal blur is usually modeled as Gaussian blurring Readers are referred to the original paper for more details.
[3], and thus the problem of blur estimation boils down to Consider an image f(x) blurred by a Gaussian kernel
identifying the Gaussian point spread function (PSF). having an unknown blur radius . The focal blur is
Many techniques have been proposed to address this modeled by a normalized Gaussian function:
problem [4-7]. For example, some methods are based on
autoregressive moving average (ARMA) models [5, 6]. 1 n2
Also, a blur estimation algorithm was proposed in [7] by g ( n, ) = exp( 2 ), n I (1)
2 2
Elder and Zucker, in which local scale control is used for
blur estimation in complex images. Such techniques are
typically computationally expensive. For real-time Then the blurred image b(x) is given by the
applications such as video processing for television, fast convolution of original image with the Gaussian kernel:
b ( x ) = f ( x n ) g ( n, ) (2) 3.1. Finding reliable pixel positions for blur estimation
nI The accuracy of a blur estimation algorithm relies on the
According to this algorithm, the given blurred image pixels chosen for blur estimation. Typical techniques focus
b(x) is first further blurred with two different blur radii a on regions around edges in the image [7, 8]. Edge
and b. After that, the ratio of the differences between the detection by itself is a difficult task. Even worse, not all
original blurred image and two newly-blurred versions the edge pixels support good blur estimation.
ba(x) and bb(x) is calculated for every position x, as shown In our approach, we first blur an input image with a
in the equation below, Gaussian kernel of radius 1. Since the input image has an
b( x ) ba ( x ) original blur of radius , convolving it with the Gaussian
r (x ) = (3) kernel of radius 1 would result in another Gaussian with
ba ( x ) bb ( x ) radius given below.
This ratio becomes maximal at edge positions in the g (n, ) * g (n, 1 ) = g (n, 2 + 12 ) (5)
image. Unknown blur radius can then be calculated
using the equation below. After performing the above step, the local blur
estimation algorithm of [2] is carried out at each and every
1 1 position in the image using Equations (3) and (4). A pixel

+ a2
2 is considered to be reliable if and only if it satisfies the
r ( x) max = (4) constraint below.
1 1
1 < ( x) < 2 (6)
2 + a2 2 + b2
where (x) is the blur estimated at position x. The reason
To find the closed-form expression for , it can be for choosing the lower threshold 1 is that, even if the
assumed that a , b >> , as proposed in [2]. But this image is blurred with radius 1, some pixels continue to
assumption requires Gaussian kernels with very large show very low amount of blur, especially some of the edge
radius, which may include some of the unwanted regions pixels. These pixels are considered to be outliers, as they
in the neighborhood of an actual edge and thus do not show adequate amount of blur to support blur
deteriorating the blur estimation result. Also, a large radius estimation and thus are excluded.
for the Gaussian kernel is also problematic for edges that The reason for choosing the upper threshold 2 is to
are very close to each other. In order to overcome these eliminate the pixels which already have very high degree
limitations, a lookup table approach can be used, in which of blur. They are generally associated with the shading
the values of the ratio is stored for a range of (0 to 5), blur. By choosing appropriate value for 2, shading blur
with a very small step size. can be distinguished from the focal blur and the pixels
The advantage of the method in [2] is that, it does not associated with the shading blur can be eliminated in the
require edge detection as preprocessing, as the ratio blur estimation process.
maximizes at edge locations and is independent of edge
amplitude and offset. The method estimates local blur
only. The algorithm also fails to distinguish between
shading blur and focal blur. Further, the estimation result
is dependent of the trial blur filters (i.e., the choice of a
and b).

3. PROPOSED APPROACH

In the proposed approach, we first design an algorithm for


identifying pixels that should be used for blur estimation.
Then the method of [2] is used to perform initial blur
estimation. The results from a set of trainings images are
then used to learn a proper mapping from the initial
estimates to the actual blur. This learned mapping is then
used for blur estimation for any given image. The details Fig. 1. Pixels selected with a blur radius 2.0.
of these steps are presented subsequently.
value of _initi j, over all the training images for a given
Fig. 1 illustrates the pixels selected for the Lena value of j, i.e.,
image, blurred using the Gaussian kernel of radius 2.0. As
50
expected, most of the points are concentrated near the
edges but not all pixels on the edges are picked. _ init
i =1
ij
_ mean j = , j = 0.2,0.3,..,3. (7)
Experimentally it is found that 1=2, 1=3.4 and 50
2=3.8, gives the optimum results for the blur estimation
algorithm proposed in this paper. Fig. 3 shows the curve of _mean versus the actual
value of sigma.
3.2. Initial blur estimation Curves of Estimated Value of Blur for training images
2.8
The initial blur estimation is performed on the block 2.6
basis, with block size of 8x8. For each of the blocks, we
2.4
first estimate the blur for all the pixels chosen above, and

Estimated Blur Value


2.2
then pick the pixel which gives the maximum ratio defined
in [2] and use its for the entire block. It is possible that 2

none of the pixels in the entire block satisfies Equation 1.8

(6). In that case, the block is simply not considered for 1.6

blur estimation. 1.4

After finding the blur value for each block, the mean 0 0.5 1 1.5 2 2.5 3
Actual Blur Value
of all these values is calculated and is denoted by _init.
Our experiments showed that this mean value does not Fig. 2. Estimated blur versus the actual blur for
directly provide the blur in the image, since it is dependent training images.
of the choice of the trial blur filters. To alleviate this
Mean Value vs. Actual Value of Blur
problem, we propose a learning procedure to find the
proper mapping between this value and the actual blur 2.6
value, under fixed trial blur filters.
Mean value of Blur

2.4

3.3 A learning-based algorithm 2.2

This step aims at learning the mapping between the initial 2

blur (_init) and the actual blur through a set of training


1.8
images. Two procedures are involved, as elaborated
below. 1.6
0 0.5 1 1.5 2 2.5 3
Actual Blur

3.3.1 Training Fig. 3. The mean of estimated blur value for the
training images
The training procedure comprises the initial blur
estimation with a set of 50 high resolution training images Now, _mean is considered to be piece-wise linear
under various degrees of artificially-introduced blur, using between two successive values of j and the slope of each
the method described above. Fig. 2 shows the blur section of the line is found using the equation given below.
estimation curves for these images, where the horizontal
axis is the blur radius used in creating a blurred version of
( _ mean j +1 _ mean j )
the original high-resolution image. In our experiments, the _ slope j = (8)
radius of the focal blur induced in the images varies from 0 .1
0.2 to 3 in steps of 0.1. The reason for beginning from 0.2
is that, no matter how good the resolution of the images is, where j = 0.2, 0.3,..., 2.9.
it always has some degree of inherent blur.
This slope will be used in the mapping process. With
Suppose that the initial estimated blur radius is the training procedure, we have a curve that best
denoted by _initij, where i denotes the image number and represents all the training images and a slope for each
j denotes the actual blur, which varies from 0.2 to 3. After section of this curve. The values found in Equations (7)
generating the plots shown in Fig. 2, the next task is to and (8) are stored and is used to map _init to the output
find a single curve that best represents all these curves. value of sigma as described in the next subsection.
Here a simple approach is used, which finds the mean
3.3.2 Mapping initial estimate to the final output 0.3 to 3 in steps of 0.1. Fig. 6 shows the mean of the
absolute estimation error over the test images. The figure
Let _init denote the initial estimated value of the blur in
also shows maximum and minimum value of the
a given image. The first task is to identify the value of j
estimation error for each degree of blur.
such that,

_ mean j < _ init < _ mean j +1 (9) Input Image (I), with the input blur ( ).

This indicates the section of the curve of _mean, in


which _init lies. This is necessary as each segment of the Find the reliable pixel positions for
curve has a different slope. The output value of the blur a given image (Sect. 3.1).
_out can then be calculated using the equation below,

_ init _ mean j
_ out = + j (10) Perform initial blur (_init )
_ slope j estimation (Sect. 3.2)

Fig. 4 shows the curves of the mapped blur values for


the training images after the mapping is performed. This
illustrates that, after the learning procedure, the estimated Map the initial estimated blur to the
blur is much closer to the true blur and the residual error output blur (_out ) using the learnt
becomes more uniform across all images and across all mapping (Sect. 3.3.2)
degrees of blur.
Fig. 5. Summary of the blur estimation process.
Curves for output value of blur for training images
3

0.9
2.5 Average Error
0.8 Maximum Error
Minimum Error
2 0.7
Output Blur

Blur Estimation Error

0.6
1.5
0.5
1
0.4

0.5 0.3

0.2
0
0 0.5 1 1.5 2 2.5 3
0.1
Actual Blur

Fig. 4. The mapped blur value for the training images. 0


0 0.5 1 1.5 2 2.5 3
Input Blur

3.4 Testing on a new image Fig. 6. Error in Blur Estimation for testing images.

Given a new input image I, the following steps are From the figure, it is evident that the error in blur
performed to estimate the global blur. First, we find the estimation is independent of the input blur radius unlike
pixel positions on which the blur estimation should rely. algorithms whose performance deteriorates with increase
Second, initial blur estimation is carried out based on in the input blur. It is also found from the plot that the
pixels chosen from the first step. Last, the mapping learnt average error is quite small (only about 0.2 away from the
from the training set is used to correct the initial blur ground truth).
estimate. Fig. 5 summarizes the processing flow. To take a closer look at the performance of the
proposed algorithm, the results of the method are
4. EXPERIMENTAL RESULTS illustrated below with three images of different visual
characteristics: a portrait, a close-range shot of an object
The blur estimation algorithm proposed in the previous scene, and an outdoor (long-shot) scene, as illustrated in
section was tested over 40 high-resolution testing images, Fig. 7. (These are named Image 3, 4, and 5, respectively
which are not among the training images. The test images thereafter.) Fig. 8 shows the estimated blur value versus
were blurred artificially using a blur radius varying from the actual blur value for these three images, and Fig. 9
shows the blur estimation error. From these figures it can while the technique proposed here produces an absolute
be concluded that the performance of the proposed blur metric.
algorithm is insensitive to the visual content of the images.

5. CONCLUSION AND FUTURE WORK

A novel learning-based approach is proposed in this paper


for estimating global focal blur in a given image. The
algorithm has very low complexity and runs very fast. The
robustness of the algorithm was verified by testing it on a
Fig. 7. Three images of different visual contents. Note variety of images.
that the original images are of high resolution, and We plan to pursue two future directions: (i) to study
shown here are just thumbnails of the original images. the effect of noise on blur estimation; and (ii) to support
region-based local blur estimation for images with
3
spatially-varying degree of blur.
Image3
2.5 Image4
Image5
Input Blur
6. REFERENCES
Estimated Blur

1.5 [1] A. Pentland, A New Sense for Depth of Field, IEEE


Transactions on Pattern Analysis and Machine
1
Intelligence, Vol. 9, No. 4, pp. 523-531, July 1987.
0.5
[2] H. Hu and G. de Haan, Low Cost Robust Blur
0 Estimator, IEEE International Conference on Image
0 0.5 1 1.5 2 2.5 3
Input Blur Processing, 2006.
Fig. 8. Estimated blur vs the actual blur for images [3] A. Pentland, T. Darrell, M. Turk andW. Huang, A
3,4 and 5. Simple Real Time Range Camera, IEEE Computer
Society Conference on computer Vision and Pattern
Image3
Recognition, pp. 256-261, 1989.
0.5
Image4
Image5 [4] P. Vivirito, S. Battiato, S. Curti, M. La Cascia and R.
0.4 Pirrone, Restoration of Out of Focus Images Based
Blur Estimation Error

on Circle of Confusion Estimate, Proceedings of


0.3
SPIE 47th Annual Meeting, 2002.
0.2 [5] R. L. Lagendijk, A. M. Tekalp, and J. Biemond,
Maximum Likelihood Image and Blur Identification:
0.1
A Unifying Approach, Optical Engineering, vol. 28
0
(5), pp. 422-435, 1990.
0 0.5 1 1.5 2 2.5 3
Input Blur
[6] G. Pavlovic, A. M. Tekalp, Maximum likelihood
Fig. 9. Blur estimation error for images 3, 4 and 5. parametric blur identification based on a continuous
spatial domain model, IEEE Transactions on Image
In summary, the learning-based approach results in a Processing, vol. 1, Issue 4, pp. 496-504, Oct. 1992.
blur estimation algorithm that is independent of the trial [7] J. H. Elder and S. W. Zucker, Local Scale Control
blur filters (i.e., the values of a and b) as opposed to the for Edge Detection and Blur Estimation, IEEE
technique proposed in [2], in which the blur estimation Transactions on Pattern Analysis and Machine
relies on the selection of a and b. In the approach of [2], Intelligence, Vol. 20, No. 7, July 1998.
as one changes the values of a and b, the blur estimation
curve shifts up or down. This problem is alleviated by the [8] F. Rooms, and A. Pizurica, '"Estimating image blur in
proposed training procedure. In this sense, the algorithm the wavelet domain," ProRISC 2001, pp. 568-572.
proposed in [2] provides only a relative blur measure,

You might also like