Advanced Edge Detection
Advanced Edge Detection
Abstract—Edge detection is a very essential part of image All the above methods use generic operators and do not
processing, as quality and accuracy of detection determines the consider the image characteristics. In this paper, we demon-
success of further processing. We have developed a new self strate an edge detection method based on image characteristics
learning technique for edge detection using dictionary comprised
of eigenfilters constructed using features of the input image. using a dictionary based algorithm. This method is different
The dictionary based method eliminates the need of pre or from traditional methods as it incorporates features of a given
post processing of the image and accounts for noise, blurriness, image, rather than using a set of pre-defined functions.
arXiv:1509.00714v1 [cs.CV] 2 Sep 2015
class of image and variation of illumination during the detection In section II, we review popular existing algorithms for edge
process itself. Since, this method depends on the characteristics detection to which the results are compared in later sections.
of the image, the new technique can detect edges more accurately
and capture greater detail than existing algorithms such as In section III, we present our algorithm of dictionary based
Sobel, Prewitt Laplacian of Gaussian, Canny method etc which edge detection. In section IV, we have compared the results
use generic filters and operators. We have demonstrated its with the popular techniques for different classes of images.
application on various classes of images such as text, face, We have also presented the application of the new method in
barcodes, traffic and cell images. An application of this technique barcode reading, counting of red blood cells and the results are
to cell counting in a microscopic image is also presented.
compared with existing algorithms. We conclude and discuss
Index Terms—Edge detection, dictionary, self-learning, eigen- further applications in section V.
filters
16
1X
Ψe = ei ∆i = ei − Ψe (10)
n i=1
4x4
Eigenvalue
16x1
Problem for
AAT 4x4
} Eigenfilter
Fig. 2: Matrix formed by elements of dictionary. Fig. 3: (a) 3d array of images (ei ) after convolution with
Γ and thresholding. Intermediate edge images obtained after
convolution with eigenfilter. (a) Edge image obtained by
pass and high pass filtering nature of averaging and subtraction eigenfilter 14. (b) Edge image obtained by eigenfilter 15.
operations, respectively.
The edge detection by individual eigenfilters is along one
n direction, as shown in fig. 3. Edges detected by each of the
1X
Ψs = si Φi = si − Ψs (7) eigenfilters for a binary object is shown in the appendix.
n i=1
To improve the quality of the edges, the edge images have
To find the key variations in each sub-image, principal to be combined. From edge image obtained, it is apparent
components have to analyzed. But, the calculation of principal that neighboring filters have similar characteristics. Thus, to
components for each sub-image involves solving of a large enhance the edges, each pair of consecutive elements in the β,
eigenvalue problem which may not be efficient to calculate. maximum for each pixel in consecutive images is calculated,
To get round this problem, we devised a method in which the maximum of ei and ei−1 , as each consecutive eigenfilter is of
n x n elements in the dictionary are transformed into column similar characteristics (such as derivative filters) but in almost
vectors of size n2 x 1 and concatenated in matrix A (fig. perpendicular direction (see fig. 12c and 12e, in appendix).
2) of size n2 x N 2 /n2 . For the calculation in this paper, N
= 512 and n = 4, hence the size of A is 16 x 16,384. The αi = max(ei , ei−1 ) (11)
technique to construct the dictionary based on PCA, which is
where, αi are stored in a 3D array β 0 . The second last
similar to the calculation of eigenfaces for recognition[8]. The
element of the new 3D array of 15 elements β 0 gives the
eigenvectors of covariance matrix AAT of size n2 x n2 (16
desired edge because the last eigenfilter just reduces the
x 16) are calculated. This reduces the number of eigenvalue
intensity of the image (as shown in appendix) and is not
problems for each sub-image to just eigenvalue problem for
useful for edge detection. The number of eigenfilter can vary
one matrix.
depending on the size of sub-images taken and eigenvectors
considered for convolution.
AAT →
−
vi = λi →
−
vi (8)
IV. R ESULTS AND A NALYSIS
ei = Γ ∗ ui (9) In this section, we have shown the application of the
dictionary method in edge detection on various classes of
Here, λi are the eigenvalues and →−vi are the eigenvectors, ∗ image and provide solution to the problems with traditional
represents convolution of original image (Γ) with ui , which methods. First, we have applied standard Sobel and Laplacian
are the rearranged eigenvectors to give ei , intermediate edge of Gaussian edge detection techniques on a Chinese character,
image stored in a 3D array (fig. 2). These n2 eigenvectors of which comprises of straight lines and curves and compared
size n2 x 1 (16 x 1) which are rearranged to form a dictionary the results with dictionary based method.
of 16 kernels (ui ) of size n x n, i.e 4 x 4 (fig.??). We have The edge found by the dictionary based method is much
termed the derived kernels as eigenfilters. They have to be more pronounced than the standard methods for simple im-
convoluted with image to detect edges along one direction, ages. To get the same performance in terms of edge continuity
like a filter. The name eigenfilter originates from the work from the traditional techniques, the edge image has to be fur-
of Vaidyanathan and Nguyen [9]. After convolution of each ther subjected to morphological image processing techniques,
eigenfilters with Γ, filtered images are stored stored in a 3D such as dilation. The difference in the edges detected can be
array (fig.3a). The average Ψe of this 3D array is subtracted observed from the following cases.
from individual elements of the array to give another 3D array For complex images such as the Lena image shown in fig.
β. 6a the output from dictionary based method is well defined,
capture more features of the image and produces a continuous
4
A. Barcode Reading
edge image as compared to Prewitt method. Also, for images
which are not completely focused, the new algorithm performs Barcodes have been used to store information for a long
much better. The calculation of eigenfilter by dividing into time. Primitive 1D barcodes are now being replaced by 2D
small segments increases the probability of capturing small barcodes which can contain much more data. But for reading
peaks. The subtraction of Ψe , reduces the remaining noise, these codes special hardware is required. Also, techniques to
improves edges as well as suppresses the background. The read 1D barcodes or stacked 2D barcodes such as, second
new dictionary based gives better results for every class of derivative, peak location and EM algorithm require high
5
resolution of scanned image [10]. In recent years, new smart- cells usually requires special apparatus which are expensive.
phone based reading barcode is gaining popularity. But still, For using techniques of snapshots of a sample to count and
for camera based interpretation of barcode is still limited, segment image, edge detection technique becomes extremely
as binarizing the image to compute the bit pattern is not important.
accurate in cases where image is blurred or distorted. To read
the a 2D barcode segmentation of image, size detection and
coordinates of four corners is required [10]. With accurate
edge detection, the process of segmentation, size detection
and corner locations can be enhanced. The edge image can
also be used to calculate the rotation or tilt in the image more
precisely.
As shown in fig. 7a, we have a 2D barcode named Aztec
Code. When edges are detected using Sobel and dictionary
based methods the results are not very different for image with
highest resolution. However, when the same image is blurred,
as would happen in most practical cases, the advantage of self (a) (b)
learning algorithm becomes evident. With the new algorithm
which can detect edges from low resolution images, camera
based interpretation of barcodes can be done more accurately
using smart phones or web-cameras.
(c) (d)
(a) (b) (c) Fig. 9: Application on red blood cells. (a) Original RBC
sample. (b) Edge detected by Sobel method. (c) Edge from
Fig. 7: Edge detection in highest resolution image of Aztec
Dictionary based method. (d) Estimation of number of RBC.
Code. (a) High quality Aztec Code image. (b) Edge detected
by Sobel method. (c) Dictionary based method. With the use of the method described in this paper, it is
possible to identify edges more accurately and in much more
detail. In this paper, we have used an image of RBC cells taken
from microscope with objective of 10x magnification(fig.9a).
The final image has dark background which has to be
removed to make the edges more clearer and display in
familiar form. For removing the background, a threshold on the
intensity values of the pixels is applied to remove background.
It is fairly simple, threshold varies slightly for different images
(a) (b) (c) and can be estimated from the histogram of the image. After
Fig. 8: Edge detection in blurred image of Aztec Code, blurred applying the threshold, advantage of proposed method over
by averaging filter of size 12. (a) Blurred Aztec Code image. the existing techniques become evident.
(b) Edge detected by Sobel method. (c) Dictionary based While for Sobel method the edge detected are fainter and
method. discontinuous. The dictionary based method is able to detect
very faint boundaries and also of cells which are in the process
Another possible application can be in scanning of text of division. Sobel method is unable to detect cells that are
images, where the edges are grainy or fonts are small to joined partially or completely and in some cases it has not
be captured clearly. Edge detection technique combined with picked up the cells at all.
average image capturing hardware can be used to produce high In fig. 10, a magnified view of two sections of image and
quality image. The output edge image from Prewitt method is corresponding edges detected by Sobel and dictionary methods
not continuous as compared to output from dictionary method has been presented. In first, the cells are joined together to
in the case where boundary of letters are not continuous and form a long string and in second, there is a cluster of cells of
this could lead to errors in cases where small font size is used. different sizes and present at varying spacing. These are two
types of sections in which estimating the boundary of cells
B. Counting of Red Blood Cells and subsequently estimating the number of cells can be most
In Biomedical imaging, edge detection algorithms can be difficult. As seen from the figure, dictionary based method
used to count cells, detection of tumors etc. Counting of produces a better edge image than Sobel method. To estimate
6
the number of cells, we have taken the advantage of circular At the beginning of the paper, we have highlighted major
shape of the red blood cells and fitted the edge image with issues that exists with the traditional methods. In general, they
circles using circular Hough transform based algorithm which reqires pre-processing of the image and it depends on the type
is also available in Matlab [11] [12]. This approach is used of noise, class of image etc. A method that takes the inputs
because of its performance in presence of noise and varying image and used its features for calculation edges eliminates
illumination. The radius of circles fitted has slight variation this step. Furthermore, dictionary based method demonstrated
to account to cells in different stages. The range of radius in this paper is not affected by noise, blurriness, class of image
of circle depends on the magnification of original image and or varying illumination, shown through various examples and
typical cells size which is obtained from edge image. Another provides a smooth solution to the problem of edge detection.
point to consider is that not all cells are circular and cells We have demonstrated its application in variety of areas
which are in the process of division look like two joined or and compared the results to that of existing algorithms. It can
half circles. Inter cellular space can also have similar circular detect accurate edges from blurry image, enabling accurate im-
features that can be picked in number estimation. From fig. age segmentation thus making barcode reading using cameras
10d, it can be seen that fitting depends on the quality of edges more reliable. It also improves the quality of text in cases
and hence the accuracy of count. where letters are grainy with small fonts. Dictionary based
method can also be used to count the number of red blood
cells in a sample without the need for specialized equipments.
R EFERENCES
[1] Rafael C. Gonzalez, Richard E. Wood, Digital Image Processing, Chapter
10, Second Edition, Prentice Hall, Upper Saddle River, New Jersey 07458.
[2] John Canny, A Computational Approach to Edge Detection, IEEE Trans-
actions on Pattern Analysis and Machine Intelligence, Vol. PAMI-8, No.
6, November 1986.
[3] Wenshuo Gao, Lei Yang, Xiaoguang Zhang, and Huizhong Liu, An
Improved Sobel Edge Detection, IEEE, 978-1-4244-5540-9/10, 2010.
[4] Xibin Jia, Haiyong Huang, Yanfeng Sun, Jianming Yuan, and David
M. W. Powers, A novel edge detection approach using a fusion model,
Springer Multimed Tools Appl, DOI 10.1007/s11042-014-2359-6, 2014.
Fig. 10: (a) Magnified view of RBC sample; (b) Edge detected [5] I. G.T. Shrivakshan, A Comparison of various Edge Detection Techniques
by Sobel method; (c) Edge detected by Dictionary based used in Image Processing, International Journal of Computer Science, Vol.
9, Issue 5, No. 1, September 2012.
method; (d) Estimation of number of cell by approximating [6] Michal Aharon, Michael Elad, and Alfred Bruckstein, K-SVD: An Algo-
cells to a circle. Hence, better detection of edges can lead to rithm for Designing Overcomplete Dictionaries for Sparse Representa-
better approximation and more accuracy of counting. tion, IEEE Transactions On Signal Processing, Vol. 54, No. 11, November
2006.
[7] Hongying Zhua, Ikbal Sencana, Justin Wonga, Stoyan Dimitrova, Derek
Thus, a few precautions that should be taken in fitting circles Tsenga, Keita Nagashimaa, and Aydogan Ozcan, Cost-effective and Rapid
Blood Analysis on a Cell-phone, NIH Public Access, Lab Chip. 13(7):
to count number of cells. In this paper, we have used range 12821288, April 7 2013 . doi:10.1039/c3lc41408f.
of radius from 3 to 8 pixels for both methods. From fig. 10, [8] Matthew Turk, Alex Pentland, Eigenfaces for Recognition, Journal of
estimation by Sobel method is not accurate as it misses many Cognitive Neuroscience, Volume 3, Number 1, 1991.
[9] P. P. Vaidyanathan and T. Q. Nguyen, Eigenfilters: A new approach to
cells, counts inter cellular spaces and size of the estimated least-squares FIR filter design and applications including Nyquist filters,
circle is not close to the cell size. Excluding the cells that IEEE Trans. Circuits System, Vol. 34, pp. 1123, Jan. 1987.
are not completely contained within the image, total number [10] Hao Wang, and Yanming Zou, 2D Bar Codes Reading: Solutions for
Camera Phones, World Academy of Science, Engineering and Technol-
of cells are 226, and the cells number of cells detected by ogy International Journal of Computer, Control, Quantum and Information
dictionary based method is 225, with an error of 0.44%. Engineering, Vol:1, No:6, 2007.
For applications such as counting of cells, the dictionary [11] T.J Atherton, D.J. Kerbyson. Size invariant circle detection, Image and
Vision Computing, Volume 17, Number 11,pp. 795-803, 1999.
based method has advantage over other methods as it detects [12] H.K Yuen, .J. Princen, J. Illingworth, and J. Kittler, Comparative
more accurate and continuous edges and allows fitting circles study of Hough transform methods for circle finding, Image and Vision
which not only counts the RBCs, but also estimates the average Computing, Volume 8, Number 1, pp. 7177, 1990.
and variation of radii of the cells.
V. C ONCLUSION
In this paper, we have proposed a new edge detection
algorithm using dictionary comprised of the key features of the
image. Since the eigenfilters are derived from the input image,
it becomes image specific and sensitive to its features. This
enables the algorithm to adapt to different classes of images
and produce better results. Its shown in the paper, results from
the new method is much more accurate and detailed than
existing algorithms.
7
A PPENDIX A
E IGENFILTERS AND C ORRESPONDING E DGE I MAGES