Color Edge Detection using Quaternion Convolution and Vector
Gradient
Nadia BenYoussef and Aicha Bouzid
Signal, Image, and Information Technology Laboratory, National Engineering School of Tunis, Tunis, Tunisia
{nadia_benyoussef, bouzidacha}@yahoo.fr
Keywords: Quaternion Convolution, Gradient Vector, Edge Detection, Color Image.
Abstract: In this paper, a quaternion-based method is proposed for color image edge detection. A pair of quaternion
mask is used for horizontal and vertical filter since quaternion convolution is not commutative. The
detection procedure consists of two steps: quaternion convolution for edge detection and gradient vector to
enhance edge structures. Experimental results demonstrate its capabilities on natural color images.
1 INTRODUCTION
Color image segmentation remains a challenge area
in computer vision. The problem consists in the
choice of the method according to which a color
image will be segmented. The techniques used to
solve the problem of color images edge detection are
classified into two categories: monochromatic-based
techniques and vector-valued techniques (Koschan
and Abidi, 2008).
The first category applies the existed gray-level
segmentation methods by dealing out each color-
channel (red, green, and blue) separately and then
combines them to obtain a final segmentation result.
The second category defines discontinuity of the
chromatic information as a vector-valued and
processes the three color channels simultaneously
(Pei and Cheng, 1997; Denis and al., 2007).
Recently, a new technique named quaternion has
been employed to represent color images (Sangwine,
1996).
Quaternion extend the Fourier transform
representation to hypercomplex numbers that can be
used to encode color. Consequently, a color image
will be represented as a matrix of quaternion having
the same dimension and the color information
described by the three components in the RGB color
space will be represented in the imaginary part of the
quaternion. Quaternion algebra for color image was
first used in color image processing by Sangwine
and Pei (Pei and Cheng, 1997), (Sangwine, 1996);
then there have been several applications using
quaternion in color image processing, such as color
sensitive filtering (Sangwine and Ell, 2000), edge
detection in color images (Sangwine, 1998), (Evans
and al., 2000)., cross correlation of color images
(Moxey and al., 2003), watermarking (Ma and al.,
2008).
To better understand the implementation of
quaternion filters for edge detection, quaternion
convolution will be briefly introduced in the next
section. This article presents a method of color edge
detection based on quaternion convolution followed
by gradient vector to enhance edge structures. This
article is organized as follows: the properties of
quaternion convolution are presented in Section 2;
Section 3 exposes the proposed edge detection
method, Experiments related to the proposed method
are given in Section 4; Section 5 draws the
conclusion.
2 PROPERTIES OF
QUATERNION CONVOLUTION
The theory of quaternion was first introduced by
Hamilton in 1843 (Hamilton, 1853). A quaternion q
is an hypercomplex number and has four
components: one is a real scalar number, and the
other three orthogonal components. It is usually
represented as the following form:
dkcjbiaq
(1)
where a, b, c and d are real numbers, and the
elements i, j and k are three imaginary units with the
rules below:
BenYoussef N. and Bouzid A.
Color Edge Detection using Quaternion Convolution and Vector Gradient.
DOI: 10.5220/0006229601350139
In Proceedings of the 12th International Joint Conference on Computer Vision, Imaging and Computer Graphics Theory and Applications (VISIGRAPP 2017), pages 135-139
ISBN: 978-989-758-225-7
Copyright
c
2017 by SCITEPRESS Science and Technology Publications, Lda. All rights reserved
135
1
222
kji
(2)
ij ji k 
(3)
ikjjk
(4)
ki ik j 
(5)
The number a is referred to the scalar part of a
quaternion q denoted as S[q] and bi+cj+dk is its
vector or imaginary part denoted as V[q].
The conjugate of a quaternion takes the
following form:
q a bi cj dk
and its
modulus equals
222 2
qqqabcd
.
If
1q
then q is a unit quaternion. If the
scalar part S[q] is equal to 0, then q is called a pure
quaternion. If
1q
and S[q] = 0, then q is a unit
pure quaternion.
The addition and subtraction of two quaternion
q
1
and q
2
are defined as follows:

12 111 1 22 2 2
12 12 12 1 2
()( )
()
qq abicjdk abicjdk
aa bbiccjddk
 
 
(6)
And their multiplication is defined as follows:



12 12 12 12 12
12 12 1 2 12
12 12 12 1 2
1 2 12 12 12




qq aa bb cc dd
ab ba cd dc i
ac ca db bd j
ad da bc cb k
(7)
The following notation can also be used to
describe the quaternion number
ri j k
qq qiqjqk
. In fact, a vector in R
3
can be represented as a quaternion by setting the real
part q
r
to zero. Therefore, a color image (R, G, B)
can be shown as a quaternion with q
i
= R, q
j
=G and
q
k
=B.
Sangwine
(Sangwine, 1996) and S.C. Pei (Pei and
Cheng, 1997) proposed to implement the quaternion
to encode color images. Thus a color information
represented in the RGB color space by three
components will be described by the imaginary part
of the quaternion. Therefore, each pixel of
coordinates (m, n) of a color image will be encoded
as follows:
,, , ,
rg b
f
mn f mni f mn j f mnk
(8)
with

,
r
f
mn
,

,
g
f
mn
and
,
b
mn
represent
respectively the red, green and blue components of
the coordinate pixel (m, n).
3 THE PROPOSED METHOD
FOR COLOR EDGE
DETECTION
Our approach for color edge detection can be
summarized in quaternion filtering and enhancement
of edges by gradient calculation.
The image filtering can be performed by convolving
a quaternion filter with an image. Since quaternion
multiplication is not commutative, a pair of
quaternion masks is required to define the following
filters:
0(,)0



hq
qR RfxyR R
(9)
0(,)0










vq
RR
qfxy
RR
(10)
where
(, )
q
f
xy
is the original image encoded
by quaternion, the value of R is given by,
R
e
and
is a three-dimensional unit vector represented
by a pure unit quaternion. This pair of quaternion
masks is used for both of horizontal and vertical
filters
h
q
and
v
q
to detect color edges in the two
directions.
We consider, in this work,
3
ijk

and
2
(Sangwine and Ell, 2000), (Jin and Li, 2007).
This color edge detection filter uses a rotation in
the color space around an axis named the "gray line"
of the RGB space such that r = g = b and which
combines all achromatic pixel values (Jin and Li,
2007). Any rotation around this axis traverses one
color pixel value to another with the same luminance
but with a different hue.
The color produced by this filter at an outline
between two colors is halfway between the colors in
the direction of the hue. Reversing the direction of
the filter by interchanging R and R * in the masks
changes the directions of color rotation (Sangwine,
1998). The modulus used in our algorithm in the two
directions are defined as (Xu and al., 2010):
222
1
(,) (,) (, ) (,)
qhiqhjqhkq
qf xy q f xy q f xy q f xy
(11)
222
2
(, ) (, ) (, ) (, )
qviqvjqvkq
qf xy q f xy q f xy q f xy
(12)
VISAPP 2017 - International Conference on Computer Vision Theory and Applications
136
and the modulus is proportional to:
22
12
(, ) (, ) (, )
qqq
M
fxy qfxy qfxy
(13)
In order to obtain the edge points of the color images
we opted to extract them using a vector gradient.
The use of the gradient serves to enhance the edge
points present in an image in order to extract the
most relevant information in the image.
The use of the gradient for edge enhancement is
firstly based on the calculation of the gradient of the
image in two orthogonal directions and subsequently
the modulus of the gradient. Then, the most marked
pixels obtained following the first operation are
selected to identify the points having the strongest
contrast by a suitable thresholding. The gradient is
defined as a vector equivalent to a two-dimensional
first derivative.

(, )
x
y
f
G
x
Gfxy
f
G
y










(14)
The gradient modulus is given by:

22
(, )
x
y
Gfxy G G
(15)
and its direction is defined by:
1
(, ) tan ( )
y
x
G
xy
G
(16)
We applied this operation to the image resulting
of quaternion filtering operation. We finally obtain
the edge which will be initially in gray level, and
after an automatic thresholding and thinning phase
we obtain a binary representation of the final edge.
4 EXPERIMENTAL RESULTS
In this section, we present the results of our
approach tested on five natural color images. All the
images and ground truths used in this work can be
found in the Berkeley segmentation dataset and
benchmark (Martin and al., 2001). Fig. 1 shows the
comparison results of the quaternion filtering
associated to the gradient vector with the marginal
approach of Multiscale Product (MP). The MP uses
the first derivative of a Gaussian function as
wavelet. The scales used in this work are s
1
=1/16
and s
2
=1/20. The choice of the MP's approach is due
to the fact that this marginal method outperformed
many marginal states-of-the-art edge detectors
(BenYoussef and al., 2014), (BenYoussef and al.,
2016).
The results obtained with our approach show a
large number of missed detections in some case such
as image n°118035 and 8068; and more details
detected in other cases like image n°67079
compared with MP's approach.
In order to check the validity of our approach, we
propose to make experiments using two parameters:
The accuracy, which uses the true and false edges
(eq. 17); and the Signal-to-noise ratio (SNR) with a
white Gaussian noise having a variance value of
0,01 (eq. 18).
Accuracy=((TP+TN)/(TP+TN+FP+FN))*100
(17)
Where TP, TN, FP and FN are respectively True-
Positive, True-Negative, False-Positive and False-
Negative edge points. These parameters are
explained by the confusion matrix presented below.
The confusion matrix is commonly used to
expose results for binary decision problems
(Kirkwood and Sterne, 2003),
(Khaire, and Thakur,
2012). By comparing the marked pixels provided by
a classification method, four cases are available as
shown in the following table.
Table 1: Confusion matrix for the edge detection problem.
Reality
Edge Non-Edge
Classification
Edge TP FP
Non-Edge FN TN
The edge detector attempted to extract edges that
can be classified into four categories: True Positive
(TP), False Positive (FP), True Negative (TN), and
False Negative (FN). The first category determinates
edge pixel detected correctly as edge. The second
defined non edge pixels which are extracted wrongly
as edge pixel. The TN is the category of non edge
pixel detected correctly as non edge pixel. Finally,
the FN defined edge pixel detected wrongly as non
edge pixel.


11
2
00
11
2
00
(, )
10log
(, ) (, )
NM
xy
NM
xy
Mf x y
SNR
Mf x y Mf x y






(18)
Where
M
f and
M
f
are respectively the edges of
the clean and the noisy image.
Color Edge Detection using Quaternion Convolution and Vector Gradient
137
Image
Image Ground truth MP's approach Proposed approach
42049.jpg
296059.jpg
67079.jpg
118035.jpg
8068.jpg
Figure 1: Comparison of edge detectors. From left to right: Image No., BSDS Image, Ground Truth, MP's approach,
Proposed approach.
The tables (Table 2) and (Table 3) below show
values of the considered parameters in terms
accuracy and SNR concerning our approach and
MP's approach.
We note that the proposed approach is
characterized by the best accuracy rate of 97,65%
against 96,84% for the MP's approach. However, in
terms of SNR, the MP is more suitable for edge
detection with an SNR rate of 17.23 against 15,91
for our proposed approach.
Table 2: Comparison of accuracy parameter of the
proposed approach and MP's approach.
Image
MP's approach
Proposed
approach
Accuracy(%) Accuracy (%)
42049 96.30 97.07
296059 97.54 98.33
67079 96.48 98.32
118035 96.17 96.55
8068 97.70 98.00
Average 96.84 97.65
Standard
deviation
0.724 0.735
VISAPP 2017 - International Conference on Computer Vision Theory and Applications
138
Table 3: Signal-to-noise ratio of the proposed approach
and MP's approach.
N° Image
SNR
MP's approach
SNR
Proposed approach
42049 17.51 17.46
296059 18.74 14.97
67079 14.11 12.33
118035 17.21 17.30
8068 18.56 17.49
Average 17.23 15.91
5 CONCLUSIONS
In this paper, a vector approach for extraction of the
most significant edges in color images has been
presented. Our proposed method consists mainly of
a quaternion filtering followed by a gradient vector
to enhance the edge points. A pair of masks is
employed for quaternion convolution to extract
boundaries. The performance of our vector method
was tested and compared with MP's edge detector
which is a marginal method. Experimental results
show that the proposed method gives better results
on the studied images from Berkley database
without noise. Indeed, its accuracy rate is higher
than that of the MP's approach. In the presence of
noise, the MP's approach outperforms our vector
approach.
REFERENCES
Koschan, A., Abidi, M., 2008. Digital color image
processing, John Wiley & Sons.
Pei, S. C., Cheng, C. M., 1997. A novel block truncation
coding of color images using a quaternion-moment-
preserving principle. In IEEE Transactions on
Communications, 45(5), 583-595.
Sangwine, S. J., 1996. Fourier transforms of colour images
using quaternion or hypercomplex, numbers.
In Electronics letters, 32(21), 1979-1980.
Moxey, C. E., Ell, T. A., Sangwine, S. J., 2002,
September. Hypercomplex operators and vector
correlation. In Signal Processing Conference, 2002
11th European (pp. 1-4). IEEE.
Denis, P., Carre, P., Fernandez-Maloigne, C., 2007.
Spatial and spectral quaternionic approaches for colour
images. In Computer Vision and Image
Understanding, 107(1), 74-87.
Sangwine, S. J., Ell, T. A., 2000. Colour image filters
based on hypercomplex convolution. In IEEE
Proceedings-Vision, Image and Signal Processing,
147(2), 89-93.
Sangwine, S. J., 1998. Colour image edge detector based
on quaternion convolution. In Electronics Letters,
34(10), 969-971.
Evans, C. J., Sangwine, S. J., Ell, T. A., 2000.
Hypercomplex color-sensitive smoothing filters. In
Image Processing, 2000. Proceedings. 2000
International Conference on (Vol. 1, pp. 541-544).
IEEE.
Moxey, C. E., Sangwine, S. J., Ell, T. A., 2003.
Hypercomplex correlation techniques for vector
images. In IEEE Transactions on Signal Processing,
51(7), 1941-1953.
Ma, X., Xu, Y., Song, L., Yang, X., Burkhardt, H., 2008,
June. Color image watermarking using local
quaternion Fourier spectral analysis. In 2008 IEEE
International Conference on Multimedia and Expo
(pp. 233-236). IEEE.
Hamilton, W. R., 1853. Lectures on quaternions.
Pei, S. C., Cheng, C. M., 1997, September. Novel block
truncation coding of image sequences for limited-color
display. In International Conference on Image
Analysis and Processing (pp. 164-171). Springer
Berlin Heidelberg.
Jin, L., Li, D., 2007. An efficient color-impulse detector
and its application to color images. IEEE Signal
Processing Letters, 14(6), 397-400.
Xu, J., Ye, L., Luo, W., 2010. Color edge detection using
multiscale quaternion convolution. International
Journal of Imaging Systems and Technology, 20(4),
354-358.
Martin, D., Fowlkes, C., Tal, D., Malik, J., 2001. A
database of human segmented natural images and its
application to evaluating segmentation algorithms and
measuring ecological statistics. In Computer Vision,
2001. ICCV 2001. Proceedings. Eighth IEEE
International Conference on (Vol. 2, pp. 416-423).
IEEE.
BenYoussef, N., Bouzid, A., Ellouze, N., 2014. Multiscale
Product for Edge Detection. Journal of Electronic
Science and Technology, 1, 022.
BenYoussef, N., Bouzid, A., Ellouze, N., 2016, March.
Color image edge detection method based on
multiscale product using Gaussian function. In
Advanced Technologies for Signal and Image
Processing (ATSIP), 2016 2nd International
Conference on (pp. 228-232). IEEE.
Kirkwood, B. R., Sterne, J. A., 2003. Medical statistics.
Medical statistics.
Khaire, P. A., Thakur, N. V., 2012. A fuzzy set approach
for edge detection. International Journal of Image
Processing (IJIP), 6(6), 403-412.
Color Edge Detection using Quaternion Convolution and Vector Gradient
139