30
118 CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE DETECTION AND HEX-GABOR BASED EDGE DETECTION ON HEXAGONAL GRIDS 4.1 Introduction Edge detection is one of the important preprocessing steps in many of the image processing applications. Also, it is an important operation in both biological vision and computer vision. In biological vision, there is significant evidence that primary visual cortex serves to spatially arrange the visual stimuli in to maps of oriented edges. In computer vision, edge detection is a pre-processing step in many applications such as object recognition, boundary extraction and segmentation [10]. The basic assumption used in most edge detection is that the edges are characterized by large changes in intensity. Hence, at the location of the edge the first derivative of the intensity function should be a maximum or the second derivative should have a zero crossing [47]. Various edge detection techniques exist for images on rectangular grid such as classical operators [47], Cellular Logic Array Processing (CLAP) algorithm [20] and wavelet based edge detection [109]. Wavelet based edge detection was found to be a better technique for specific application such as iris recognition system [110], wavelet speckle reduction for Synthetic Aperture Radar (SAR) image [111], and edge detection for pulp fibre image [112]. With the advances in the VLSI technology hardware implementation has become an attractive speedy alternative for the image processing operations. Muthukumar Venkatesan et.al., [57], Hussmann and Thian [58] proposed hardware based edge detection on rectangular grid. An attempt is made in this work to perform hardware based edge detection on hexagonal grid. CLAP algorithm is chosen for this operation as the hardware complexity is lowered by cellular automata techniques and the procedure is limited to comparison of neighborhood rather than multiplications used in the existing work. In this section, edge detection of the image based on CLAP algorithm proposed by E.G. Rajan et.al. [20] is reviewed. They used the CLAP algorithm to detect edges on mimicking hexagonal sub sampled images by alternately suppressing rows and columns of rectangular grid. This method has the following

CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

118

CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE

DETECTION AND HEX-GABOR BASED EDGE DETECTION ON

HEXAGONAL GRIDS

4.1 Introduction

Edge detection is one of the important preprocessing steps in many of

the image processing applications. Also, it is an important operation in both

biological vision and computer vision. In biological vision, there is significant

evidence that primary visual cortex serves to spatially arrange the visual stimuli in

to maps of oriented edges. In computer vision, edge detection is a pre-processing

step in many applications such as object recognition, boundary extraction and

segmentation [10]. The basic assumption used in most edge detection is that the

edges are characterized by large changes in intensity. Hence, at the location of the

edge the first derivative of the intensity function should be a maximum or the

second derivative should have a zero crossing [47].

Various edge detection techniques exist for images on rectangular grid

such as classical operators [47], Cellular Logic Array Processing (CLAP)

algorithm [20] and wavelet based edge detection [109]. Wavelet based edge

detection was found to be a better technique for specific application such as iris

recognition system [110], wavelet speckle reduction for Synthetic Aperture Radar

(SAR) image [111], and edge detection for pulp fibre image [112]. With the

advances in the VLSI technology hardware implementation has become an

attractive speedy alternative for the image processing operations. Muthukumar

Venkatesan et.al., [57], Hussmann and Thian [58] proposed hardware based edge

detection on rectangular grid. An attempt is made in this work to perform

hardware based edge detection on hexagonal grid. CLAP algorithm is chosen for

this operation as the hardware complexity is lowered by cellular automata

techniques and the procedure is limited to comparison of neighborhood rather

than multiplications used in the existing work.

In this section, edge detection of the image based on CLAP algorithm

proposed by E.G. Rajan et.al. [20] is reviewed. They used the CLAP algorithm to

detect edges on mimicking hexagonal sub sampled images by alternately

suppressing rows and columns of rectangular grid. This method has the following

Page 2: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

119

limitations. (i) Alternate suppression of pixels row wise and column wise results

in poor visual quality due to the elimination of pixels provides. (ii) There is a

presence of hazy edges when we use this method. (iii) This method is not suitable

for hardware implementation as it will results in loss of visual quality of the

image. There is a need for choosing a suitable addressing scheme in order to

overcome these limitations. Hence, a new addressing scheme as explained in the

section 4.3.6 is proposed for hardware based edge detection using CLAP

algorithm. In addition, Edge detection is performed using the proposed Hex-

Gabor kernel (Ref: Chapter 3).

The author’s contributions in this chapter are mainly:

(i) FPGA based solution for edge detection on hexagonal structure which is a new

attempt. A new architecture is designed for CLAP algorithm based edge

detection.

(ii) Low pass filtering using Hex-Gabor is proposed as a preprocessing step for

the edge detection operation on the hexagonal lattice. This can bring out dominant

contours in the image as it is considering the intra pixel distances and directions

of adjacent pixels. Training of images is done to obtain specific orientation or

circular features in an image for the purpose of super resolution [55, 56].

However, no such training is required in Hex-Gabor case as edge enhancement

simultaneously takes care of the smooth parts of the image.

4.2 Operator Based Edge detection – A Review

Even though consistent gradient operators were designed [10, 79, 113]

for hexagonal lattice, it was not proved its efficiency on the mimicking scheme

other than spiral addressing scheme [113]. The reasons are (i) The intra pixel

distances in the two orientations differ (ii) Pixels do not physically exist in the

processed square lattice space. Edge detection was performed on spiral

addressing scheme using gradient operators and successful results were obtained

[10, 114].

This section examines three commonly used techniques for edge

detection based on the derivative operation on hexagonal grid. The three

techniques are the Prewitt edge operators, the Laplacian of Gaussian (LoG) and

the canny edge detector [10]. The Prewitt edge operators are first derivative

Page 3: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

120

operators while LoG is a second derivative operator. In terms of directional

sensitivity, the Prewitt operators essentially are maximally sensitive to edges in

horizontal and vertical directions. LoG image is obtained by smoothing the

original image with the Gaussian smoothing mask, followed by application of the

Laplacian mask then it will be isotropic. The Canny edge detector is a good

example of a near optimal edge detector combining features of the Prewitt and

LoG operators.

Figure 4.1 The masks used in the Prewitt edge detector implementation

(a) square (b) hexagonal [10]

On a square lattice, the Prewitt operator is designed to approximate the

gradient computation in two orthogonal directions which are the two principal

axes of symmetry for a square [47]. With reference to Middletone and Jayanthi

sivasamy [10], computing gradients aligned along each of three axes symmetry

of the hexagonal lattice gives the three masks illustrated in Figure 4.1.

However, one mask is redundant as it can be written as a combination of the

other two. For instance, the mask aligned along 00 can be obtained by taking

the difference between masks at 600 and 1200. Generally, edge detection

algorithms on square images are often employed to find both edge strength and

direction. For this reason the masks are computed in orthogonal directions.

Let h1 = The mask aligned along 00

h2 = The mask aligned along 600

h3 = The mask aligned along 1200

The mask aligned along 060 can be obtained by taking the difference between

masks at 00 and 1200. Using the redundancy, orthogonal gradients can be

computed from any two masks. The mask h2 can be computed as 312 hhh −= .

Page 4: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

121

Using this three axes framework, gradient magnitude M can be computed from

the masks h1 and h3 as [9, 129],

b � c(�� � (W� � (�(W

(4.1) and direction,

G � de�N� � (��B��(W�(� *�(W

(4.2)

The size of the mask is determined by the neighborhood of a pixel on the given

lattice. Hence, the hexagonal masks are specified by seven weights as compared

to nine weights for the square masks.

4.3 CLAP Algorithm based edge detection

4.3.1 Overview of CLAP Algorithm

The term cellular automaton (CA) [117, 118], denotes a regular uniform

lattice usually infinite in extent, with a discrete variable at each site. The state of

a CA at a time instant is determined by the array of values of these variables at

that time instant. So, we can model digital images as CA configurations.

Traditionally, an image processing operation in spatial domain is expressed as a

transformation [ ]),(),( yxfTyxg = , where ),( yxf is the input image, ),( yxg is

the output image and T is the transformation operator on f, defined over some

neighborhood of the pixel ),( yx . The general approach of edge detection is to

scan a given 2-D array by a 33× window and update all the pixel values with the

computed ones. The computations involve the coefficients of the window and the

value of the image pixels scanned by it. The CA sites are updated in parallel at

each evolution. The realization of parallel computation using a serial processor is

called Cellular Logic Array Processing (CLAP).

While performing CLAP operations we need to use various Basis

Structures to filter the values of interest from the scan window which is

discussed in the next section.

4.3.2 Basis Structures

Page 5: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

122

Basis structures are chosen to be the convex polygons that will enclose

the pixel in consideration. The 33× grid itself is one such polygon. Other

polygons can be obtained by removing the corner pixels of the 33× grid in

various combinations. One such polygon is shown in Figure 4.2 obtained by

removing the top-left corner pixel of the window. The nomenclature of these

basis structures is as per E.G.Rajan et.al. [20].

Figure 4.2 The Convex Polygon with top-left corner pixel removed [20]

Figure 4.3 The Basis Structures over the 3 x 3 Rectangular grid [20].

All the 2D convex polygons form a lattice as shown in Figure 4.4 with A and E

as the supremum and infimum. 16 such convex polygons can be formed as

shown in Figure 4.3.

Page 6: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

123

Figure 4.4 Lattice formed by 16 convex polygons [20]

Similarly the basis structures for a hexagonal lattice can be defined as the

possible convex polygons that enclose the central pixel in the 7-neighbourhood

hexagonal lattice as shown in Figure 4.5.

Figure 4.5 The pixel and its 7-neighborhood structure in a hexagonal lattice

From the convex polygon connecting all the neighboring pixels of the central

pixel (Figure 4.5), 18 convex polygons are obtained over the 7- neighborhood

hexagonal lattice by removing the neighborhood pixels in various combinations.

The pixel wise representation of these polygons over the 7- neighborhood grid

is shown in Figure 4.6.

Figure 4.6 The Basis Structures over the 7-neighbourhood Hexagonal lattice [20]

There are four levels in the lattice. These polygons form a lattice with A as the

supremum as shown in Figure 4.7. All the elements in a level constitute a

Page 7: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

124

subgroup of the set of elements in the immediate higher level. Among the 18

convex polygons, five are basis patterns namely D 1, 3, 5, D 2, 4, 6 , C 1, 4, C 2, 5

and C 3, 6 for the hexagonal lattice which are present in lowest level. The run-

time implication of this is to perform edge detection operation; it is enough to

execute the CLAP algorithm on these 5 patterns instead of all 18 patterns.

Because of this reason, for the hardware implementation, only 5 comparators

were used to compare the values in the S_block registers such as

(S11,S31,S23),(S21,S12,S32),(S11,S21,S32,S23),(S12,S21,S31,S23) and

(S12,S11,S31,S32) (Ref: Figure 4.11).

.

Figure 4.7 Lattices formed by 18 convex polygons [20]

4.3.3 General Procedure for Edge Detection

In CLAP algorithm, the given digital image is scanned by the 55×

windows. On each move, the 55× sub image covered by the scan window is

checked for the different basis structures as explained in the previous section

.The values in this polygon or basis structure in the sub image are examined to

see whether the gray-distance D, which is the difference between the maximum

gray value Gmax and the minimum gray-value Gmin, is less than or equal to a

threshold value T. If D is less than or equal to T, then the central cell is assigned

the gray-value 0. Otherwise the original value contained in the central cell is left

as it is. This procedure is continued till the entire image is scanned. The overall

effect is that the boundaries of various regions in the given image that appear to

be uniform are retained and their interior parts are erased thus giving us the

Page 8: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

125

edge. For an example, the rectangular sub sampled image (Figure 4.8(a)) and

hexagonal sub sampled image (Figure 4.8(b)) are shown which is based on

alternately suppressing the pixels row wise and column wise (a method used by

E.G.Rajan [20]). Edge detection on hexagonal grid using CLAP algorithm

(Figure 4.8(b)) is elaborated in the next section.

Figure 4.8(a) Neighborhood of the pixel in the rectangular subsampled image

and (b) Neighborhood of the pixel in the hexagonal subsampled image [20]

4.3.4 Algorithm for Detecting Edges of Various Regions in Hexagonal Sub

Sampled Images (Used in the existing work)

• Slide the 25-neighbourhood structure over the image;

• Get the maximum pixel value (Gmax) from the basis structure ; e.g.;

Neighborhood of pixels in the hexagonal sub sampled image of Figure

4.8(b) is (2,4,11,13,15,22,24) considering 13 as center pixel. One of the

basis structures is 2,11,15 and 24;

• Get the minimum pixel value (Gmin) from the basis structure 2,11,15,24

- C 2, 5;

• Compute the Gray level distance as D = Gmax − Gmin;

• Select a user defined threshold / adaptive threshold as T;

• If ( D ≤ T) then assign the center pixel value 13 = 0;

• move the structuring element to the next position;

• continue till image is completely scanned;

Page 9: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

126

Similarly, the algorithm is executed on the other polygons of the

selected window (Figure 4.8(b)) with pixel values 4,11,24 (Polygon D 1, 3 , 5) ,

2,15,22 (Polygon D 2, 4, 6) , 4,11,15,22 (Polygon C 1, 4), and 2,4,22,24 (Polygon

C3,6). The advantage of CLAP algorithm is, it is enough to perform computation

on the 5 basis patterns namely D 1, 3 , 5 , D 2, 4 , 6 , C 1, 4 , C 2, 5 and C 3, 6 for the

hexagonal lattice which are present in lowest level among 18 convex polygons

(Figure 4.6). Similarly, the CLAP algorithm can be performed on rectangular

sub sampled image (Figure 4.8(a)).

4.3.5 Hardware Implementation of Edge Detection using CLAP algorithm

(Proposed method)

In the work proposed by Muthukumar Venkatesan et.al., [57], the image

processing algorithms were simulated and synthesized using Handel-C

hardware description language with the Celoxica DK2 environment for the edge

detection operation. Canny edge detection was performed in this work and

latency was found to be high using the developed architecture. Hussmann and

Thian [58] proposed FPGA implementation of a real-time sub-pixel edge

detector. The hardware model was implemented using the DK2 IDE tool on the

RC1000 Xilinx Vertex FPGA based board. As this method of edge detection is

based on convolution operation, it needs two longer FIFOs and multipliers. It

occupies more memory and more time for multiplication operation. A new

architecture is proposed for the hexagonal grid based edge detection operation

using CLAP algorithm in this work.

4.3.5.1 Features of the Proposed Architecture

The proposed architecture in this work has the modules such as address

generator, ‘In system memory’ or Block RAM and Demultiplexer (In this work,

‘In system memory’ and Block RAM are used interchangeably). The features of

the proposed architecture are: (i) The architecture is suitable for both

rectangular and hexagonal lattices (ii) It is capable of producing one edge-pixel

every clock cycle (iii) The proposed architecture does not contains multipliers

as it is based on CLAP algorithm and needs less registers compared with canny

edge detection architecture proposed by Hussmann and Thian [58] (iv)

Page 10: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

127

Hardware requirements are less using the proposed architecture compared with

the existing architecture..

4.3.5.2 Description of Altera’s Cyclone II FPGA

Altera’s low-cost Cyclone II FPGA family is based on a 1.2-V, 90-nm

SRAM with densities over 20K logic elements (LEs). It has features like

embedded multipliers to support high-performance DSP applications and Phase

- Locked Loops (PLLs) for system clock management. It provides dedicated

memory resources called M4K blocks (‘In system memory’). Each M4K block

contains 4096 memory bits, which can be configured to implement memories of

various sizes. Some aspect ratios supported by the M4K block are 4K x 1, 2K x

2,1K x 4, and 512 x 8. 52 such M4K blocks are there in Altera Cyclone II 2C20

FPGA. 32 M4K blocks are used and divided into two parts for storing input

image in one of the block and output image in another block (Figure 4.9).

Figure 4.9 Cyclone II 2C20 FPGA

4.3.5.3 Description of the Proposed Architecture

Figure 4.10 shows the general block diagram of the proposed architecture for

edge detection based on CLAP algorithm. It has the following modules (i) ‘In

system memory’ for storing and retrieving the image data (ii) Address generator

to generate the address in order to create the virtual hexagonal grid structure

(iii) R_block is a set of registers to store the data selected depending on the

select line of the Demux (iv) S_block registers called window registers which

are used to create the hexagonal window in order to execute CLAP algorithm.

Page 11: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

Input Image Output Image

Figure 4.10 General block diagram of the proposed Architecture

Figure 4.11 Proposed architecture for the edge detection using hexagonal

structure

Figure 4.11 shows the detailed block diagram of the architecture. It

includes the comparators in order to compare the pixel values stored in the

S_block to obtain maximum and minimum v

algorithm. The working of each block is explained in the following section.

128

Figure 4.10 General block diagram of the proposed Architecture

Proposed architecture for the edge detection using hexagonal

Figure 4.11 shows the detailed block diagram of the architecture. It

includes the comparators in order to compare the pixel values stored in the

S_block to obtain maximum and minimum values in order to perform CLAP

algorithm. The working of each block is explained in the following section.

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.

Figure 4.10 General block diagram of the proposed Architecture

Proposed architecture for the edge detection using hexagonal

Figure 4.11 shows the detailed block diagram of the architecture. It

includes the comparators in order to compare the pixel values stored in the

alues in order to perform CLAP

algorithm. The working of each block is explained in the following section.

Page 12: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

129

4.3.6 Architecture Modules

4.3.6.1 Address Generation

In this section, the working of address generator is elaborated for both

rectangular and hexagonal lattices. S_block is explained which is forming a

hexagonal window with 6 registers S11,S12,S21,S22,S23,S31 and S32 while

reading the data. The window movement for every three clock pulses for an

image of size 8 x 8 is explained as follows. The window is initialized with zeros

as shown in Figure 4.12(c). After the first three clock cycles, the first pixel of

each row (Figure 4.12(a)) is stored in the S11,S21 and S31 registers ( i.e. The

pixel values 0,8 and 16 respectively using right edge generation - Figure

4.12(b),4.13)

Figure 4.12(a) Pixel addressing in hexagonal grid (b) S-block Group of registers

(c) Operation of S_block registers

.

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.

Page 13: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

130

Figure 4.13 Status of S_block registers after first three clock cycle Edge is computed for the center pixel value of register S22 using comparator

blocks C1, C2, C3, C4, and C5 (Figure 4.11). The reason for choosing only 5

comparators was explained in section 4.3.2. The pixel values in the S12, S21,

S32 registers are given to C1 comparator. Similarly, corresponding pixel values

are given to the comparators C2 to C5 in order to check the basis structures 5

for the execution of CLAP algorithm. In each comparator, we are finding

maximum and minimum pixel values and the difference (D) between them.

Difference (D) is Compared with the threshold value (T) to find out an edge.

The result is ‘1’ when D is greater than T, else ‘0’. The result is again stored

into the ‘In system memory’ for further processing. User defined threshold

value is used for comparison with gray distance. Then window is moved to the

right and after next three clock cycle, the status of the S-block registers is

shown in Figure 4.14.

Figure 4.14 Status of S_block registers after second three clock cycles

i.e. The data in the S11, S21, S31 registers are shifted to S12, S22, S32

registers respectively and the next pixel values (1,9,17 in the above example -

Figure 4.12(a)), are stored into the S11,S21,S31 registers. The process is

continued till the last column of the first row. After the completion of the first

row the address pointer is incremented using left edge address generation. The

even number row values and odd number row values will be stored using left

edge address generation and right edge address generation respectively.

Likewise, the entire image is scanned and the edge is computed for every three

clock cycles. The computed values are stored in the ‘In system memory’. Using

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.

Page 14: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

the same procedure, edge is computed for rectangular lattice also. For this, data

can be read directly from the ‘In system memory’ without using address

pointers. The results were compared with the edge detection on hexagonal

window which are discussed in

4.3.6.2 Demultiplexer and Selection Counter:

With reference to the Figure 4.15,

sent to corresponding register through 1:3 Demultiplexer and the selection

counter. For every three clock pulses th

(Figure 4.11) is moved to the hexagonal window at a time as explained in the

previous section.

Figure 4.15 Demultiplexer and selection counter

4.4 Wavelet Based Edge Detection on Rectangular and Hexagonal

Grid

Many classical edge detectors have been developed over time [47]. They

are based on the principle of matching local image segments with specific edge

patterns. However, classical edge detectors usually fail to handle images with

strong noise. With the growth of wavelet theory, the wavelet transform have

been found to be remarkable mathematical tool to analyse the singularities

including the edges and further to detect them effectively [42, 115]. The wavelet

transform characterizes the local re

into elementary building blocks that are well localized both in space and

frequency. This not only explains the underlying mechanism of classical edge

detectors, but also indicates a way of constructing optimal ed

specific working conditions.

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.

131

the same procedure, edge is computed for rectangular lattice also. For this, data

can be read directly from the ‘In system memory’ without using address

pointers. The results were compared with the edge detection on hexagonal

window which are discussed in Section 4.6.1.

Demultiplexer and Selection Counter:

With reference to the Figure 4.15, for each clock cycle the input data is

sent to corresponding register through 1:3 Demultiplexer and the selection

counter. For every three clock pulses the data in the registers R1, R2 and R3

(Figure 4.11) is moved to the hexagonal window at a time as explained in the

Figure 4.15 Demultiplexer and selection counter

4.4 Wavelet Based Edge Detection on Rectangular and Hexagonal

Many classical edge detectors have been developed over time [47]. They

are based on the principle of matching local image segments with specific edge

patterns. However, classical edge detectors usually fail to handle images with

With the growth of wavelet theory, the wavelet transform have

been found to be remarkable mathematical tool to analyse the singularities

including the edges and further to detect them effectively [42, 115]. The wavelet

transform characterizes the local regularity of signals by decomposing signals

into elementary building blocks that are well localized both in space and

frequency. This not only explains the underlying mechanism of classical edge

detectors, but also indicates a way of constructing optimal edge detectors under

specific working conditions.

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.

the same procedure, edge is computed for rectangular lattice also. For this, data

can be read directly from the ‘In system memory’ without using address

pointers. The results were compared with the edge detection on hexagonal

for each clock cycle the input data is

sent to corresponding register through 1:3 Demultiplexer and the selection

the registers R1, R2 and R3

(Figure 4.11) is moved to the hexagonal window at a time as explained in the

4.4 Wavelet Based Edge Detection on Rectangular and Hexagonal Sampled

Many classical edge detectors have been developed over time [47]. They

are based on the principle of matching local image segments with specific edge

patterns. However, classical edge detectors usually fail to handle images with

With the growth of wavelet theory, the wavelet transform have

been found to be remarkable mathematical tool to analyse the singularities

including the edges and further to detect them effectively [42, 115]. The wavelet

gularity of signals by decomposing signals

into elementary building blocks that are well localized both in space and

frequency. This not only explains the underlying mechanism of classical edge

ge detectors under

Page 15: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

132

4.4.1 The Wavelet Point of View of Some Classical Edge Detectors

The edge detectors are actually discretized wavelet functions. The

convolution with edge detectors gives the wavelet transform of the image at a

certain scale. If we approximate the continuous wavelet models, it will result in

the classical edge detectors when discretized. Once we have a continuous

model, we can then change the scales and detect edges on different scale levels.

Canny edge detector is an operator which uses the first derivative of a

Gaussian as its filter; it is very close to the method of wavelet transforms.

However, from the point of view of wavelet transforms, we can use a more

effective algorithm to adjust the scale of the filters. In this work, edge detection

operation was performed using the operators on some standard images. This

method is suitable for hexagonal grid if the lattice is represented by true

hexagon like spiral addressing scheme. The visual quality of the edge detected

images obtained using operator based edge detection on hexagonal lattice was

found to be poor when mimicking hexagons were used. Hence, it is important to

choose suitable edge detection approach even when the mimicking hexagons are

used. Hence, Hex-Gabor based edge detection is proposed as a preprocessing

step for the hexagonal lattice.

4.5 Hex-Gabor Based Edge Detection

Overview of Gabor filter was given in section 3.7.1.The Gabor filter

multichannel system is used to represent an image in various orientations and

frequencies [116]. When an image is processed by a Gabor filter, the output is

the convolution of the image H��� 2 and the Gabor function ��� 2 , H� 9� f��� 2 � 1��� 2 g H��� 2 where * denotes the two dimensional

convolution. This process can be used at different frequencies and different

orientations and the result is a multichannel filter bank. Figure 4.16 illustrates

the multi-channel filtering system. The Gabor filters produce orientation based

improvement of edges in an image if it is used as preprocessing step. We can

exploit this property in two ways: (i) By performing filtering in three distinct

directions (00, 600 and 1200) on hexagonal lattice and adding the responses (ii)

by applying Hex-Gabor kernel. This edge detection approach on hexagonal

Page 16: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

133

lattice can able to bring out dominant contours in an image due to (a) directional

selectivity of the Gabor filter (b) improved angular resolution of the hexagonal

lattice.

Figure 4.16 Multichannel Gabor System [116]

In Figure 4.16, operator | · | is the magnitude operator, and gk ( x, y) is the Gabor

function in the kth channel, which denotes a specific frequency and orientation.

4.6 Results and discussion

4.6.1 Hardware implementation results

4.6.1.1 Verilog simulation results

Figure 4.17 shows the verilog simulation results of the designed

architecture for the edge detection of images on rectangular structure and

hexagonal structure. It was possible to detect the edges successfully and from

the results it has been observed that there is a marginal improvement in the

visual quality of the image while processing with hexagonal structure and

curved features are very clear. Since there is no dedicated hardware available

for hexagonal-based image capture and display, conversion has to be done from

square to hexagonal image before hexagonal-based image processing. The

difference will be clear only if we have hexagonal based image capture and

display systems. Figure 4.18 is the edge maps for the images specified in the

UC Berkely Benchmarking of Segmentations database.

Page 17: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

134

Figure 4.17 Verilog simulation results of CLAP algorithm (a), (d) Original

images (b), (e) Edge detected images on rectangular structure (c),(f) Edge

detected images on hexagonal structure

(a) Original Image - 3096 Airplane Image (b)Edge map using CLAP

algorithm(Size 481 x 321)

Page 18: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

135

( c ) Original Image - 227092 (d) Edge map using CLAP algorithm

Antique Museum piece (size 321 x 481)

Figure 4.18 UC Berkely Benchmarking of Segmentations dataset results

It can be observed from the results that the edge maps obtained by the verilog

simulation results of CLAP algorithm yields some false edges which is the

limitation of this work. The performance can be improved by choosing adaptive

threshold and by smoothing the image before edge detection.

4.6.1.2 FPGA Implementation Results

Due to memory constraints, while implementing into FPGA (cyclone II

2C20F484C7), 64 x 64 image was downloaded into ‘In system memory’. It has

been processed and stored in the same memory. Table 4.1 shows the timing

summary for this architecture for a 64 x 64 image. The maximum clock

frequency is 109.63 MHz. Total logic elements used were 943/18,752 (only 5

%) and no multipliers were involved (Table 4.2).

Table 4.1 Flow summary of the proposed architecture using hexagonal

structure

Flow status successful

Quartus II version 6.0 Build 178 SJ Web edition

Revision Name edge_hex

Top-level Entity Name edge_hex

Family Cyclone II

Device EP2C20F484C7

Page 19: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

136

Timing Models Final

Met timing requirements No

Total logic elements 943/18752(5%)

Total Registers 455

Total pins 6/315(2%)

Total virtual pins 0

Total memory bits 131,072/239,616(55%)

Embedded Multiplier 9-bit element 0/52 (0%)

Total PLLs 0/4 (0%0

Table 4.2 Timing Summary of the proposed architecture using hexagonal

structure

Type Slack Required time Actual time

Worst-case tsu N/A None 5.379 ns

Worst-case tpd N/A None 2.810 ns

Worst-case th N/A None 3.701 ns

Clock setup: in_clk

N/A None 109.63 MHz ( period = 9.122 ns )

Page 20: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

137

Figure 4.19 FPGA results using ALTERA DE-1 board (a) Original Image (b)

Edge detection on hexagonal structure (c)Edge detection on rectangular

structure

Figure 4.19 shows FPGA results using ALTERA DE-1 board. Few images of

size 64 x 64 were created and edge detection operation was performed on both

rectangular lattice and hexagonal lattice using CLAP algorithm. Edge was

detected successfully as shown and edge detected images on hexagonal

structure have thinner edges than that on rectangular structure. Due to memory

constraints of FPGA size of the image was restricted to 64 x 64 and the image

size can be extended with the advanced FPGA.

4.6.2 Hex-Gabor Filter Based Edge detection (Proposed method)

The objective of edge detection is in object recognition. An

enhancement system which also preserves image quality is our objective while

considering visual system. When edges are enhanced, its detection is also

becoming easy. The author’s aim of this chapter is to bring out active contours

Page 21: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

138

from the edge detection operation. Initially, the performance of existing edge

detection approaches such as classical operator based edge detection on

mimicking hexagonal grid were verified experimentally for comparison. The

results are not convincing and, it is not possible to obtain dominant contours.

With the Hex-Gabor based edge detection proposed in this work, it is able to

detect edges and it is possible to bring out the dominant contours.

Although pseudo hexagonal lattice is giving similar results as

rectangular lattice for the operator based edge detection, it still does not perform

as best as a spiral addressed lattice scheme [10, 66, 113], as this takes care of

the geometry, absolutely. Figure 4.20 shows the results of Hex-Gabor based

edge detection. The images (b),(e),(h) and (k) are obtained by the canny

operator. The images (c),(f),(i),(l) are obtained by canny operator after low pass

filtering the original images with the Hex-Gabor Kernel. The smallest edge

detected components which are closed contours can be visualized by this

method, which is not true in rectangular domain. The three orientation axes

information gets added in this case, which may consider the direction of the

edges and also modify existing pixel values. This may be used to gather mutual

information simultaneously between three neighboring pixels and in three

directions, if intra-pixel information is derived.

The Gabor filters at three directions (00, 600 and 1200) on hexagonal grid

is able to capture the distinctions along the border of object regions. The reason

is that Gabor filters only choose higher frequency information (which stands for

edge/boundary property) from original images, and as a result, the edge is

maximized and different objects are separated. When compared with the Hex-

Gabor results (Figure 4.20(c), (f), (i) and (l), the gradient edge detection

algorithm (Figure 4.20(b), (e), (h) and (k) does not successfully capture some of

the weak borders. The Canny method finds edges by looking for local maxima

of the gradient of the image. The gradient is calculated using the derivative of a

Gaussian filter, and it is likely to detect true weak edges with minor differences.

However, pure edge detection algorithm cannot provide level information

between object regions.

Page 22: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

139

Figure 4.20 Edge detection using Hex-Gabor on hexagonal grid (a),(d),(g),(j)

Original images: Image.1, Image.2, image.3 , image 4 respectively. (b),(e),(h),(k)

Page 23: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

140

Edge detection using canny operator (c),(f),(i),(l) Edge detection using Hex-

Gabor Filter

Ratio of edge pixels to image size is one of the edge detection

performance measures [10]. As the author’s aim is to obtain the closed contours

this performance measure is considered. For the thinner and less noisy images

the ratio of edge pixels to image size is more. Ratio of edge pixels to image size

is computed for the images using Hex-Gabor as preprocessing step and with

canny operator alone. The results are summarized in Table 4.3 for the edge

detected images shown in Figure 4.20. For Hex-Gabor based edge detection

results, the ratio of edge pixels to image size obtained is more. It shows better

connected components and continuity in edge pixels.

Table 4.3 Performance of Hex-Gabor based edge detection

Type of image Number of edge pixels using canny

operator

Number of edge pixels using Hex-

Gabor

Ratio of edge pixels to

image size using canny

operator

Ratio of edge pixels to

image size using Hex-

Gabor

Image 1 1222 1231 7.46% 7.51%

Image 2 1078 1712 10.78% 17.12%

Image 3 961 1591 9.61% 15.91%

Image 4 1028 1613 10.8% 16.13%

It is evident from the results that, it is possible to obtain edges of objects with

circular shape which are missing with canny operator. This is due to greater true

angular placement of the hexagonal lattice. It is possible to bring out active

contours of the recognizable components in any image. In order to prove the

efficiency of Hex-Gabor filter, performance comparison with rectangular grid is

made and the results are shown in Figure 4.21. It is proved that, the

performance of Hex-Gabor based edge detection is better with respect to visual

appeal and ratio of edge pixels to image size which is summarized in Table 4.4.

Page 24: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

141

Table 4.4 Performance of rectangular grid based edge detection using

canny operator and Hex-Gabor based edge detection on hexagonal grid

Type of image Rectangular grid Hexagonal grid

Number of edge pixels using canny

operator

Ratio of edge pixels to

image size

Number of edge pixels using Hex-

Gabor

Ratio of edge pixels to

image size using Hex-

Gabor

Image 1 1222 7.46% 1231 7.51%

Image 2 1050 10.50% 1712 17.12%

Image 3 1011 10.11% 1591 15.91%

Image 4 1056 10.56% 1613 16.13 %

Figure 4.21 shows the performance comparison of edge detection operation on

rectangular and hexagonal grid. Results on rectangular grid are obtained by

using canny operator. The results on hexagonal grid are obtained by using Hex-

Gabor as a preprocessing step. It is evident from the results that, Hex-Gabor is

able to recognize contours in the image and has more ‘ratio of edge pixels to

image size’ compared with rectangular grid based operation. The smallest edge

detected components using Hex-Gabor are closed contours, which is not true in

rectangular domain. It is concluded that Hex-Gabor is able to produce better

connected components and continuity in edge pixels.

Page 25: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

142

Figure 4.21 Performance comparison on rectangular grid and hexagonal grid

(a),(d),(g),(j) Original images: Image.1, Image.2, image.3 , image 4 respectively.

Page 26: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

143

(b),(e),(h),(k) Edge detection using canny operator on rectangular grid

(c),(f),(i),(l) Edge detection using Hex-Gabor filter

In order to validate the results, the performance of hex-Gabor based edge

detection has been evaluated using Berkeley Segmentation dataset images.

Figure 4.22 shows the image results (image 35010). The analysis based on True

positive, True negative, False positive and False negative are listed in the

Tables 4.5, 4.6, 4.7 and 4.8. Performance of Hex-Gabor was evaluated with

canny edge detector. The results prove that the true detection rate of Hex-Gabor

has been considerably increased and false detections are reduced while

compared to classic canny edge detection (Except for the images 37073 and

124084 which contains shadows).

(a) Original image (35010) (b) Edge map using Hex-Gabor

( c ) Edge map using canny (d) Ground truth image

Figure 4.22 Comparison results of Hex-Gabor and canny operator for UC

Berkeley Segmentation dataset images

Table 4.5 Performance comparison of True Positives:

Page 27: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

144

S.No Image Ground Truth Canny Hexgabor 1 35010 9215 1488 1703 2 37073 8114 1709 1580 3 65019 8108 1144 1703 4 124084 4736 820 696 5 135069 2678 309 399 6 145086 5714 815 1560 7 189011 5574 855 924 8 232038 5481 859 1032 9 241004 5086 792 817 10 295087 5215 723 793

Table 4.6 Performance comparison of True Negatives:

S.No Image Ground Truth Canny Hexgabor 1 35010 9215 133786 134375 2 37073 8114 136558 136176 3 65019 8108 136234 136979 4 124084 4736 137822 137796 5 135069 2678 150867 150379 6 145086 5714 133506 135179 7 189011 5574 138451 139051 8 232038 5481 134176 135241 9 241004 5086 133836 138117 10 295087 5215 132366 133282

Table 4.7 Performance comparison of False Positives:

S.No Image Ground Truth Canny Hexgabor 1 35010 9215 11400 10811 2 37073 8114 9729 10111 3 65019 8108 10059 9314 4 124084 4736 11843 11869 5 135069 2678 856 1344 6 145086 5714 15181 13508 7 189011 5574 10376 9776 8 232038 5481 14744 13679 9 241004 5086 15479 11198 10 295087 5215 16720 15904

Table 4.8 Performance comparison of False Negative:

Page 28: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

145

S.No Image Ground Truth

Canny Hex-Gabor

1 35010 9215 7727 7512 2 37073 8114 6405 6534 3 65019 8108 6964 6405 4 124084 4736 3916 4040 5 135069 2678 2369 2279 6 145086 5714 4899 4184 7 189011 5574 4719 4650 8 232038 5481 4622 4449 9 241004 5086 4294 4269 10 295087 5215 4492 4422

4.7 Comparitive study of edge detection results on hexagonal grid with

the existing work

In recent work [113], A design procedure for first order tri directional

derivative operators was developed for use on hexagonal images based on

spiral architecture which is not hardware based algorithm. From the CLAP

algorithm based edge detection, using proposed architecture (hardware

based), it was possible to get similar results as shown in Figure (4.23(c)).

Hex-Gabor based edge detection (Figure 4.23(d)) is providing thin edges

and closed contours compared with the existing methods.

Page 29: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

146

Figure 4.23(a) Original image (Lena) (b) Edge map using the spiral architecture

[113], (c) Edge map using proposed CLAP algorithm based architecture

(Hardware based) and (d) Edge map using proposed Hex-Gabor.

In the work proposed by Muthukumar Venkatesan et.al., [57], Canny

edge detection was performed and latency was found to be high using the

developed architecture. The edge detection algorithm was performed in Handel-

C on a DK2 environment. The design was implemented on RC1000-PP Xilinx

Vertex-E FPGA based platform. On a PC with Pentium III 1.3 GHz, time taken

for canny edge detection of a 256 x 256 size grey scale image was 47 ms. Using

the proposed architecture, it was possible to obtain less computational time in

the order of nano seconds ( 9.22 ns which is shown in timing summary table 4

.2). Hussmann and Thian [58] proposed FPGA implementation of a real-time

sub-pixel edge detector. As this method of edge detection is based on

convolution operation, it needs two longer FIFOs and multipliers. It occupies

more memory and more time for multiplication operation. These limitations are

overcome by the proposed method and following observations were made:

Page 30: CHAPTER 4 - HARDWARE IMPLEMENTATION OF EDGE …shodhganga.inflibnet.ac.in/bitstream/10603/3894/14/14... · 2015-12-04 · section 4.3.6 is proposed for hardware based edge detection

147

(i) Hardware complexity is lowered by cellular automata techniques where the

procedure is limited to comparison of neighborhood rather than multiplications.

(ii) Total Logic elements utilized is less than 5% (943/18752 – Table 4.3) of

that available in FPGA.

(iii) The performance of the CLAP algorithm can be still improved if we use the

adaptive thresholding instead of user defined threshold.

It may be argued that the edge detection results are away from ground

truth images (based on earlier methods). However, it purely depends on the

levels that are required in a segmentation process. It is therefore emphasized

that, in the other methods, the continuity of curved surfaces are not maintained

to the level that Hex-Gabor is able to generate (Ref: Figure 4.20).

4.8 Summary

For the hexagonal grid based operation of edge detection, the efficiency

of consistent gradient operators was proved to be better for the spiral addressing

scheme [10, 79, 113]. For other mimicking schemes we have to take care of intra-

pixel distances in the two orientations (60 degrees and 120 degrees) of the

hexagonal lattice. FPGA based solution for edge detection on hexagonal grid

using CLAP algorithm is proposed. It was possible to detect the edges

successfully. The performance can be improved further by incorporating adaptive

thresholding and smoothing. For simulation based edge detection on hexagonal

grid, Hex-Gabor based edge detection is proposed to bring out closed contours

when the gradient edge detection algorithm does not successfully capture some of

the weak borders.