A Blind Blur Detection Scheme Using Statistical Features of Phase Congruency and Gradient Magnitude
The growing uses of camera-based barcode readers have recently gained a lot of attention. This has boosted interest in no-reference blur detection algorithms. Blur is an undesirable phenomenon which appears as one of the most frequent causes of image degradation. In this paper we present a new no-reference blur detection scheme that is based on the statistical features of phase congruency and gradient magnitude maps. Blur detection is achieved by approximating the functional relationship between these features using a feed forward neural network. Simulation results show that the proposed scheme gives robust blur detection scheme.
Barcodes are commonly used system of encoding of machine understandable information on most commercial products and services . Two-dimensional (2D) barcodes have higher density, capacity, and reliability than one-dimensional (1D) barcodes. Therefore, 2D barcodes have been progressively more adopted these days. For example, a consumer can access essential information from the web page of the magazine or book, when he reads it, by just capturing the image of the printed QR code (2D barcode) related to URL. In addition to the URLs, 2D barcodes can also symbolize visual tags in the supplemented real-world environment , and there exists the adaptation from the individual profiles to 2D barcodes. Whereas 1D barcodes are traditionally scanned with laser scanners, 2D barcode symbologies need imaging device for scanning. Detecting bar codes from images taken by digital camera is particularly challenging due to different types of degradations like geometric distortion, noise, and blurring in image at the time of image acquisition. Image blurring  is frequently an issue that affects the performance of a barcode identification system. Blur may arise due to diverse sources like atmospheric turbulence, defocused lens, optical abnormality, and spatial and temporal sensor assimilation. Two common types of blurs are motion blur and defocus blur. Motion blur is caused by the relative motion between the camera and object during image capture while the defocus blur is caused by the inaccurate focal length adjustment at the time of image capturing. Blurring induces the degradation of image sharpness like edges, specifically for barcode images where the encoded information is easily lost due to blurring.
Human visual system has good capability to perceive blur. However, the mechanism behind this capability is not completely understood for application in artificial visual systems. Therefore, it is hard to design a metric for blur estimation in images. Mean square error (MSE), peak-signal-to-noise ratio (PSNR), and Structural Similarity Index (SSIM) are few examples of metrics for image quality, but they are by definition based on references, which means that the system needs to have an idea of what an unblurred image is. We therefore require a mechanism that can detect blur with no use of references. Tong et al.  discussed a method to decide whether an image is blurred or not and up to what extent an image is blurred. They utilized Harr wavelet transform to discriminate different types of edges and by this estimation they decided the presence of blur. Yang et al.  presented the motion blur detection scheme, which uses support vector machine to classify the digital image in blurred or sharp categories. Aizenberg et al.  presented a work that considers the blur detection as a pattern classification problem. This work identifies type of blur and estimates blur parameters using neural network for four categories of blur, namely, defocus, rectangular, motion, and Gaussian. Crete et al.  used intentional blurring pixel difference (IBD) algorithm which does not require the use of edge detection. Another factor in considering IBD algorithm is its high computational speed. This algorithm is based on intentional blurring of the given image. This method is inspired by the observation that the intentional blurring of a sharp image gives significant gray scale variations. On the other hand, intentional blurring of an already blurred image gives small gray scale variations. Although it gives details on calculating the blur estimate, the blur decision threshold is not mentioned. The drawback of the suggested method by the authors is its inability to identify blur parameters when the blur size is small.
In this paper, we proposed no-reference blur detection scheme using phase congruency feature for barcode images which are blurred with motion blur, defocus blur, and coexistence of both blurs. We imagine that the original image is unknown and do not create any assumptions on the nature of content or the blurring model. We have carried out the experimental analysis of the statistical features of phase congruency and gradient magnitude maps for the effective blur detection in terms of precision and recall. In our approach, we start with computation of phase congruency map and gradient magnitude map of input image. Then, the statistical features mean, standard deviation, skewness, kurtosis, energy, entropy, and smoothness are computed by using the probability distribution of the phase congruency and gradient magnitude levels in the histogram. These features construct a feature vector which has the ability to discriminate blurred and sharp images. These vectors are used as training and testing database for designing of feed forward neural network.
The rest of the paper is organized as follows. Section 2 discusses image degradation model. Sections 3 and 4 describe phase congruency model and gradient magnitude model, respectively. Section 5 presents the blur detection scheme. Section 6 analyzes the experimental results of the proposed schemes on barcode images in terms of precision, recall, and accuracy. Finally, Section 7 concludes this paper.
2. Image Degradation Model
The image degradation process in spatial domain can be modelled by the following convolution process : where is the degraded image, is the uncorrupted original image, is the point spread function that caused the degradation, is the additive noise, and is convolution operator. Since convolution in spatial domain is equivalent to the multiplication in frequency domain, (1) can be written as where , , , and are frequency responses of , , , and , respectively. When the scene to be recorded translates relative to the camera at a constant velocity () under an angle of radians with the horizontal axis during the exposure interval , the distortion is one-dimensional. Defining the length of motion as , the PSF in spatial domain can be described as [8, 9] In most cases, the out-of-focus blur caused by a system with circular aperture can be modeled as a uniform disk with radius as [10, 11] In the case in which both out-of-focus blur and motion blur are present in the same image, the blur model is where , are point spread functions for motion and defocus blur, respectively.
3. Phase Congruency
The phase congruency model  is based on frequency domain processing of an image. It assumes that the visual system is more competent in performing operations using the phase and amplitude of the individual frequency components in an image than handing of image information spatially. Local phase of an image has the local structural information (e.g., edges or discontinuities) while the local amplitude represents the local energy of the image at some point. Phase congruency (PC) was first proposed by Morrone et al.  in terms of the Fourier series expansion of a signal at some position as where is the amplitude of the th Fourier component, is the local phase of the th Fourier component at location , and is the amplitude weighted mean local phase angle at location . If equals a maximal value of 1, all frequency components are in phase; otherwise takes on values between 0 and 1. Kovesi  addressed the problems encountered in the calculation of phase congruency according to (6) and developed a new and more sensitive measure of phase congruency. Furthermore, Kovesi extended the one-dimensional phase congruency to make it possible that the calculation of two-dimensional phase congruency of image by applying 1D analysis over several angles and arranging the results in definite order. To determine two-dimensional phase congruency of a given image, the image is first convoluted with a Log-Gabor filters bank. Let an image be , the even symmetric filter and odd-symmetric filter at scale and orientation are and , respectively. The responses of each quadrature pair of filters are a vector as where and are responses of convolution between image and even symmetric filter and odd-symmetric filter, respectively. From (7), the amplitude of this response at point is given by and phase at point is given by The 2D phase congruency is then calculated by where represents that the enclosed quantity is identical to itself if it is positive and equal to zero otherwise; is a measure of significance of frequency spread; is a small positive constant used to prevent division by zero; is a quantity introduced to compensate image noise; and is a sensitive phase deviation function defined as We have used MATLAB code for computing the 2D phase congruency designed by Kovesi . The sharp image features like line and edges will be apparent and highlighted in the two-dimensional phase congruency map of barcode image while these features will diminish in presence of blur. This observation is shown in Figure 1.
Figure 2 shows the phase congruency histogram of sharp and blurred barcode images. It is evident from the histogram that a sharp barcode image has high distribution on low phase congruency values and low distribution on higher values. On the contrary, the phase congruency distribution of a blurred image concentrates on low values.
4. Gradient Magnitude
Image gradient  can be defined as a transition in intensity. The gradient of an image is represented by a vector which consists of derivatives in the horizontal and vertical directions at each pixel. The gradient of an image is defined as where and are image gradients in horizontal and vertical direction, respectively. The gradient magnitude at any pixel is defined as the root mean square of image directional gradients along two orthogonal directions; that is, . The Prewitt, Roberts, Scharr, and Sobel filters or some specific purpose linear filters are generally used to calculate the gradient, which is achieved by convolving an image with one of these linear filters. We make use of the Prewitt filter to compute the gradient since it gives the better performance among the template gradient filters. Consider Gradient magnitude map highlighted the sharp image features like line and edges while these features weaken in presence of blur. This effect is shown in Figure 3.
Figure 4 shows the gradient histogram of sharp and blurred barcode images. It is obvious from the histogram that a sharp barcode image covers large span of gradient values. On the other hand, the gradient magnitude distribution of a blurred image is found intense on low gradient values.
5. Blur Detection Methodology
The statistical features  provide information about the properties of the probability distribution. We use statistical features of the phase congruency histogram () and gradient magnitude histogram () such as uniformity, smoothness, flatness, and contrast. The statistical quantities as mean, standard deviation, smoothness, skewness, uniformity, and entropy are computed by using the probability distribution of the different levels in the histogram bins of the histograms and . Let be a discrete random variable that represents different levels in a map and let be the respective probability density function. A histogram is an estimation of the probability of occurrence of values as measured by . The feature set of each histogram consists of six features as follows.
Mean (). Mean computes the average value. It is the standardized first central moment of the probability distribution in image. Consider
Standard Deviation (). Standard deviation computes the average contrast. It is the standardized second central moment of the probability distribution. Consider
Smoothness (). Smoothness computes the relative smoothness of the gray values in a region. has zero value for area of constant intensity and tends to 1 for areas with large variation in the value of its gray levels. Consider
Skewness (). Skewness computes the symmetry of distribution. gives zero value for a symmetric histogram about the mean and otherwise gives either positive or negative value depending on whether histogram has been skewed right or left to the mean. Consider
Uniformity (). Uniformity is also known as energy. A high value indicates that the distribution is available to a small number of levels. Consider
Entropy (). Entropy is a measure of randomness. The high value of entropy shows that the distribution is more among different levels in the histogram. Consider After the calculation of these statistical features for each and , the feature vectors and of these values are constructed as After construction of these feature vectors a hybrid feature vector is also constructed by combining these two feature vectors into a single vector as The feature vectors of all the blurred and sharp images are constructed and stored to create a feature database. The feature vector of the testing image is also calculated in the same manner. An artificial neural network (ANN) has the exceptional potential to obtain significant mapping of input features to output from complicated or vague data; therefore, ANN can be used to extract patterns and detect trends that are too complex to be identified by either humans or other computational methods . So, after feature extraction binary artificial neural network classifiers are designed with back-propagation learning algorithm that learns to classify an image as a degraded or sharp one, separately for each feature set, that is, phase congruency statistical features (PCSF), gradient magnitude statistical features (GMSF), and hybrid features (HF). Here, the term binary artificial neural network signifies property feed forward neural network consisting of single output layer to decide whether the image is blurred or not (i.e., yes/no). A schematic diagram of the designed neural network model for blur detection problem is shown in Figure 5, in which feed forward neural network consists of an input layer, a hidden layer, and an output layer. A feed forward networks often have one or more hidden layers of sigmoid neurons followed by an output layer of linear neurons. Multiple layers of neurons with nonlinear transfer functions permit the network to discover nonlinear and linear relationships between input and output vectors. The neural network is implemented using the function newff available in MATLAB neural network toolbox. In this work the transfer functions of hidden layers are hyperbolic tangent sigmoid functions. The numbers of neurons used in input layer is equal to the extracted features from image dataset which are six, six, and twelve each for PCSF, GMSF, and HF based neural network, respectively. All the features are normalized in the range . The output is determined by either one or zero, where a threshold value closer to one represents a blurred image and a value closer to zero represents a sharp image. The neural classifier is trained with different number of hidden layers. The final architecture is selected with single hidden layer of ten neurons which gives best performance.
6. Simulation Results
The performance of the proposed technique has been evaluated using numerous 1D and 2D barcode images. The performance of the proposed technique has been evaluated using camera based barcode images. To simulate the blur detection algorithm, we have considered two different barcode image databases. The first database is the WWU Muenster Barcode Database  consisting of 1D barcode images and the second one is the Brno Institute of Technology QR code image database  captured by digital camera. 100 images from each database were considered to introduce blur synthetically. Three different classes of blur, that is, motion blur, defocus blur, and combination of both, were synthetically introduced with different parameters to make the databases of 300 blurred images (i.e., 100 images with each class of blur) for each type of barcode images. 300 sharp images of the same databases are also selected. So, total 600 images are considered for implementation of proposed blur detection scheme for 1D barcode images and same for 2D barcode images. During training of neural network for each feature set, a cross-validation method is used to improve generalization ability. To carry out the cross-validation procedure, whole feature set is partitioned randomly into 3 sets: training set, validation set, and test set with ratios 0.5, 0.2, and 0.3, respectively, which means that out of 600 images 300 are chosen for training, 120 are selected for validation, and 180 are used for testing. The training set is used to learn the network. The validation set is used to validate the network, that is, to regulate network design parameters. The test set is used to test the generalization ability of the designed neural network. Finally, whole database is used to calculate overall accuracy of the models. To examine the accuracy of proposed scheme, we have used the following statistical measures.
Precision (Positive Predictive Value). Precision measures the fraction of samples that truly turns out to be positive in the group the classifier has categorized as a positive class. The higher the precision is, the lower the number of false positive errors committed by the classifier is. Consider
Sensitivity (Recall). It measures the actual members of the class which are accurately recognized as such. It is also referred to as true positive rate (TPR). It is defined as the fraction of positive samples categorized accurately by the classification model. High sensitivity value represents that a low number of positive samples are misclassified as the negative class. Consider
Accuracy. Accuracy is used as a statistical measure of how well a binary classification test identifies or excludes a condition. It is a measure of proportion of true results. Consider To examine the discrimination ability of model over a range of threshold probabilities, we have also plotted relative operating characteristic (ROC) curve. In the ROC graph the recall (TPR) is plotted against the false positive rate for a range of thresholds. The ROC curve superposes the line at orientation 45°, in the model which has no discrimination ability; that is, for all decision threshold values, the recall equals the false positive rate. Ideal discrimination is achieved as the ROC curve follows the left hand side and top axes of the unit square in the graph; that is, for all threshold values, the true positive rate equals one and the false positive rate equals zero.
We have also comparedour approach with the intentional blurring pixel difference (IBD) algorithm proposed by Crete et al. , which is based on the phenomenon that it is difficult to examine difference between blurred image and reblurred version of same image.
6.1. Experiment 1: Performance Analysis without Noise
The objective of this experiment is to analyze the performance of neural network with three different feature sets. It has been observed that neural network with hybrid feature set gives best results. The blur detection accuracies for 1D barcode images are 92.5%, 89.8%, and 95.3% using PCSF, GMSF, and HF, respectively, as shown in Table 1. Table 2 presents the blur detection accuracies for 2D barcode images, which are 93.2%, 95.8%, and 99.0% using PCSF, GMSF, and HF, respectively. It is evident that HF gives best results. The ROC curves plotted in Figures 6 and 7 also confirm that HF has the best discrimination ability between the blurred and sharp images. It is also obvious from the results that HF based blur detection has better results than IBD method.
6.2. Experiment 2: Performance Analysis with Noise
The objective of this experiment is to assess the robustness of the proposed blur detection scheme in presence of noise. Additive Gaussian noise of 40 dB blurred signal-to-noise ratio (BSNR) is added to create noisy blurred images. All neural networks models have been utilized to detect the blur. It has been observed that the noise influences badly the GMSF based neural network model. The results presented in Tables 3 and 4 show that HF gives 93.3% and 92.7% accuracies, respectively, for 1D and 2D barcode images, which are the highest among all the three feature sets. The ROC curves plotted in Figures 8 and 9 also confirm that HF has the best discrimination ability between the blurred and sharp images. It is also noticeable from the results that HF based blur detection has superior results than IBD method.
In this paper, we have proposed a new blur detection scheme for barcode images taken by digital cameras. The method utilized the statistical features of phase congruency and gradient magnitude maps. A comparative study among the statistical features of phase congruency, statistical features of gradient magnitude, and hybrid features is carried out in the experiments. Simulation results show that hybrid features give excellent results in noise free images as well as in the presence of noise. The performance of the gradient map based statistical features goes down because the noise affects the gradient map drastically.
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
The authors highly appreciate Faculty of Engineering and Technology, Mody University of Science & Technology, Laxmangarh, for providing facility to carry out this research work.
ISO/IEC 18004:2000, “Information technology—automatic identification and data capture techniques—Bar code symbology—QR Code,” 2000.View at: Google Scholar
S. Tiwari, V. P. Shukla, S. R. Biradar, and A. K. Singh, “Review of motion blur estimation techniques,” Journal of Image and Graphics, vol. 1, no. 4, pp. 176–184, 2013.View at: Google Scholar
H. Tong, M. Li, H. Zhang, and C. Zhang, “Blur detection for digital images using wavelet transform,” in Proceedings of the IEEE International Conference on Multimedia and Expo (ICME '04), vol. 1, pp. 17–20, June 2004.View at: Google Scholar
K.-C. Yang, C. C. Guest, and P. Das, “Motion blur detecting by support vector machine,” in Mathematical Methods in Pattern and Image Analysis, vol. 5916 of Proceedings of SPIE, pp. 261–273, 2005.View at: Google Scholar
I. Aizenberg, N. Aizenberg, T. Bregin et al., “Blur recognition on the neural network based on multi-valued neurons,” Journal of Image and Graphics, vol. 5, pp. 127–130, 2000.View at: Google Scholar
P. Kovesi, “Image features from phase congruency,” Journal of Computer Vision Research, vol. 1, no. 3, pp. 1–26, 1999.View at: Google Scholar
P. D. Kovesi, MATLAB code for calculating phase congruency and phase symmetry/asymmetry, 1996, http://www.cs.uwa.edu.au/~pk/Research/research.html.
R. C. Gonzalez and R. E. Woods, Digital Image Processing, Prentice Hall, Princeton, NJ, USA, 2007.
S. Tiwari, V. P. Shukla, S. R. Biradar, and A. K. Singh, “Texture features based blur classification in barcode images,” International Journal of Information Engineering and Electronic Business, vol. 5, no. 5, pp. 34–41, 2013.View at: Google Scholar
S. Tiwari, A. Kumar Singh, and V. P. Shukla, “Statistical moments based noise classification using feed forward back propagation neural network,” International Journal of Computer Applications, vol. 18, no. 2, pp. 36–40, 2011.View at: Google Scholar
S. Wachenfeld, S. Terlunen, and X. Jiang, http://cvpr.uni-muenster.de/research/barcode/.
I. Szentandrási, M. Dubská, and A. Herout, “Fast detection and recognition of QR codes in high-resolution images,” Graph@FIT, Brno Institute of Technology, 2012.View at: Google Scholar