GESTURE RECOGNITION
USING FPGA
Final Year Project Evaluation
2010 – 2011
15/03/2011
Guide: Jagadeesh Kumar P
Roll no Name
ECU07201 Aarathy Udayabhanu
ECU07214 Franklin Geo Francis
ECU07225 Namsheer K
ECU07228 Nithin Sarath
ECU07234 Rizwana A
2
Gesture Recognition using FPGA 15/03/2011
At a Glance….
• Introduction
• Basic Overview
• Video Decoder
• Video Receiver
• Edge Detection & Feature Extraction
• VGA Display
• Project Status
• Future Scope
3
• References
15/03/2011
Gesture Recognition using FPGA
Gestures Tell A Lot!!
• Gesture Recognition using FPGA
15/03/2011
AIM
• Implement a system to recognize a
Gesture
• Control a Windows Interface
based on this Gesture
Gesture Recognition using FPGA 15/03/2011
Block Diagram
MEMORY
LINE FIELD
CAMERA CONTROLL
DECODER
ER EDGE
DETECTION
&
FEATURE
VDEC Card EXTRACTION
MEMORY
FPGA VGA
I2C MASTER
CONTROLLER
CONTROLLER
MONITOR
Video Decoder
• Why??
Camera outputs are normally analog
A decoder is used to digitize the analog video input
Digitizes the (NTSC/PAL/SECAM) 4:2:2 YCbCr
format
Gesture Recognition using FPGA 15/03/2011
Digilent Video Decoder Board
Features
Inputs: Component,
Composite and S Video I2C
Compatible Serial Bus
High Speed Hirose FX2
Connector
Outputs : 8/16 bit
YCbCr ,HS,VS and Field
Signals
Programmable Controls :
Hue, Brightness, Saturation,
Contrast
• Carrier for the Analog Devices 8
ADV7183B Video Decoder Chip
15/03/2011
SDV Multiformat SDTV Video Decoder
ADV7183B
• High quality ,single chip
,multiformat video decoder
• i/p(Composite, S video,
Component video) o/p Digital
ITU-R BT.656
• Front End:
Three 10 Bit ADC ‘s
12 channel input Mux
Current and Voltage Clamps
• Two wire Serial MPU interface :
I2C Compatible 9
Gesture Recognition using FPGA 15/03/2011
Features
• ADV7183B is fabricated in a 3.3 V CMOS process
• Automatic NTSC/PAL/SECAM identification
• Digital output formats (8-bit or 16-bit)
• ITU-R BT.656 YCrCb 4:2:2 output + HS, VS, and FIELD
• Integrated analog muxing section that allows more than
one source of video signal to be connected to the decoder
• Programmable video controls
• Peak white/hue/brightness/saturation/contrast
• Integrated on-chip video timing generator
10
• Power-down mode
Gesture Recognition using FPGA 15/03/2011
I2C Interface
• Two inputs: Serial Data (SDA) & Serial Clock(SCK)
:Carries information b/w ADV7183B &
FPGA
• Each device has unique address & operates as either
slave or master
• Master : Initiates data transfer
(FPGA) : Generates Clock Signals
• Slave : Receives data sent by Master
(ADV 7183B) : Generates ACK bit
11
Gesture Recognition using FPGA 15/03/2011
• START High to Low on SDA
High in SCL
• 8 bits shifted: Address (7 bit ) + R/W
• Peripheral that recognizes the transmitted address pulls Data line
Low(the 9th clock pulse) Acknowledge bit.
• STOP Low to High on SDA
High on SCL
12
Gesture Recognition using FPGA 15/03/2011
I2C Communication in ADV7183B
• ADV 7183B has two slave address for Read and Write
• The data sent on the SDA line to the ADV7183 includes
7 bit slave address + 1 bit (R/W)– to identify the slave
8 bit register address - to select one of the 249 sub
addresses, thus enable access to the internal registers
8 bit data – the data to be stored in the selected register
13
Gesture Recognition using FPGA 15/03/2011
Bus Communication
• START condition
• Address of ADV 7183B SDA Line
• ACK bit occurs
• Sub address of the register
• ACK bit occurs
• Data sent from ADV 7183BFPGA 14
• ACK bit occurs 15/03/2011
• STOP condition
VHDL Implementation
VDEC CARD
with
ADV7183B
I2C MASTER
CONTROLLER
implemented on
FPGA
15
Gesture Recognition using FPGA 15/03/2011
16
15/03/2011
Video Receiver
Line Field
Decoder Memory
Memory
(Obtain the Controller
Luminance (Y)
(R/W) (BRAM)
from the Video
Stream)
17
Gesture Recognition using FPGA 15/03/2011
ITU-R BT 656 4:2:2 YCrCb Video Format
Parallel Data Format for NTSC video frames
18
Gesture Recognition using FPGA 15/03/2011
X Y Status Word
The XY status word an SAV / EAV sequence defined as:
• F = 0 for odd fields; F = 1 for even fields
• V = 1 during vertical blanking
• H = 0 at SAV, H = 1 at EAV
• P3-P0 = protection bits
• P3 = V xor H
• P2 = F xor H
• P1 = F xor V 19
• P0 = F xor V xor H
15/03/2011
20
15/03/2011
Memory
Distributed RAM
• Virtex II P
Block RAM
• 18Kb blocks of memory
• Generated Using Core Generator
• Stores 640x244 Pixels
21
Gesture Recognition using FPGA 15/03/2011
22
23
Memory Controller
• Controls Read & Write Operation
Writing
Checks for EAV and SAV Code
Stores only 244 lines
Next “WRITE” occurs only after entire memory is Read
Reading
After entire WRITE operation is over ,data is Read
o/p Passed over to the Edge Detection Module
Has to read data in 3x3 Matrix form
24
Gesture Recognition using FPGA 15/03/2011
640 pixels
244 pixels
3x3 Matrix Format
25
Gesture Recognition using FPGA 15/03/2011
Implementation
• In VHDL
26
Gesture Recognition using FPGA
15/03/2011
EDGE DETECTION
• Fundamental step in image processing
• Images contain redundant data
• Most important data Edges
• Represents regions with strong image contrasts
• Filters out useless information
27
Gesture Recognition using FPGA
15/03/2011
Gradient Method
• Edge Detection
Laplacian
• Our project Gradient Method
Robert Cross
Prewitt
Canny
Sobel
28
Gesture Recognition using FPGA
15/03/2011
Sobel Operator
• Performs a 2-D spatial gradient measurement on an
image
29
15/03/2011
• Two 3x3 Convolution Masks
Gradient in x –directionGx
Gradient in y-directionGy
• ‘A’ Input Image
• Magnitude of the gradient is calculated using the
equation
30
15/03/2011
Implementation
31
Gesture Recognition using FPGA 15/03/2011
MATLAB Outputs
Input
Image
32
15/03/2011
Horizontal Edge Vertical Edge
33
Gesture Recognition using FPGA 15/03/2011
Horizontal +Vertical Edges Edge Detection Output 34
Gesture Recognition using FPGA 15/03/2011
VHDL Implementation
• Edge detection for a 3x3 input pixels was implemented
in VHDL
• Simulated using ISE 10.1
• Input for the operation was read from BRAM
• “Non-Restoring Square root Algorithm” was written in
VHDL package for the calculation of the absolute value
• Based on the threshold value ,a ‘1’ or ‘0’ was assigned
35
Gesture Recognition using FPGA 15/03/2011
Testing
36
Gesture Recognition using FPGA 15/03/2011
Simulation Output
37
Gesture Recognition using FPGA 15/03/2011
Simulation Output
38
Gesture Recognition using FPGA 15/03/2011
Feature Vectors
• Mathematical Description of Image
• Feature vectors:-
• Area
• Perimeter
• Length and Width of fingers
• Moment of Area
• Centroid
• Compare the obtained values of feature vector with the
reference values
39
Gesture Recognition using FPGA 15/03/2011
FEATURE VECTORS
• Perimeter :No. of white pixels in the boundary
• Area :No. of black pixels inside the white
contour
• Length :Difference b/w top and bottom most
white pixels
• Width :Difference b/w left and right white
pixels
40
Gesture Recognition using FPGA 15/03/2011
In a nutshell …. A
Image (Y values from
BRAM) Feature Vectors
Calculated
Gx & Gy Computed
Edge Obtained
Magnitude Computed
Gestures recognized
Thresholding
Performed
41
A 15/03/2011
VGA Display
640
480
42
Gesture Recognition using FPGA 15/03/2011
43
Gesture Recognition using FPGA 15/03/2011
Timing Diagram
44
Gesture Recognition using FPGA 15/03/2011
Video Parameters
• HSYNC
• VSYNC
• FRONT PORCH
• BACK PORCH
45
Gesture Recognition using FPGA 15/03/2011
Implementation
R,G,B Ra
Gest (8)
Colour Rb
VGA
Generation DAC Rg
Controller
Logic
HSYNC
VSYNC
SYNC Generator
46
Gesture Recognition using FPGA 15/03/2011
Video Controller Settings
• Output Format : 640 x 480 @ 60 Hz
• Pixel Clock :25 MHz
• H Active Pixels :640 V Active Pixels : 480
• H Front Porch :16 V Front Porch : 9
• H Back Porch :48 V Back Porch :29
• H Total 800 V Total 520
47
Gesture Recognition using FPGA 15/03/2011
Implemented Windows
48
Gesture Recognition using FPGA 15/03/2011
Project Status
• Configuring ADV 7183b
• Synthesizable VHDL Code generated
• Debugging Process Going on
• Video Receiver
• Memory & its Controller
• Sobel Edge Detection & Feature Extraction
• VGA Display
49
Gesture Recognition using FPGA 15/03/2011
Future Applications
• Help for disabled people
• Medicine
• Communication
• Entertainment
50
Gesture Recognition using FPGA 15/03/2011
References
[1] Digilent, “VDEC1 Reference Manual” , doc:502.046
[2] Analog Devices, “Multi format SDTV Video Decoder -
ADV 7183 Datasheet”, Norwood, MA, 2005
[3]Xilinx Virtex II Pro FPGA User Guide
[4]Xilinx,” Line Field Decoder”, Dec 13,2001, Greg Hawks
[5]Xilinx University Program Virtex II Pro Development
System : Hardware Reference Mannual,March 8th 2005
51
Gesture Recognition using FPGA 15/03/2011