Implementation Of Kite Cross Diamond Search (KCDS) Algorithm For Motion Estimation Using MATLAB.

(1)

IMPLEMENTATION OF KITE CROSS DIAMOND SEARCH (KCDS) ALGORITHM FOR MOTION ESTIMATION USING MATLAB

TAN CHEE CHONG

This thesis is submitted in partial fulfillment of the requirements for the award of Bachelor of Electronic Engineering (Telecommunication Electronics)

With Honours

Faculty of Electronic and Computer Engineering Universiti Teknikal Malaysia Melaka


(2)

UNIVERSTI TEKNIKAL MALAYSIA MELAKA

FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

BORANG PENGESAHAN STATUS LAPORAN

PROJEK SARJANA MUDA II

Tajuk Projek : IMPLEMENTATION OF KITE CROSS DIAMOND SEARCH (KCDS) ALGORITHM FOR MOTION ESTIMATION USING MATLAB Sesi

Pengajian : 1 0 / 1 1

Saya TAN CHEE CHONG mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-syarat kegunaan seperti berikut:

1. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.

2. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja.

3. Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi pengajian tinggi.

4. Sila tandakan ( ) :

SULIT*

*(Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIA RASMI 1972)

TERHAD** **(Mengandungi maklumat terhad yang telah ditentukan oleh

organisasi/badan di mana penyelidikan dijalankan)

TIDAK TERHAD

Disahkan oleh:

__________________________ ___________________________________ (TANDATANGAN PENULIS) (COP DAN TANDATANGAN PENYELIA) Alamat Tetap: 19 LRG BKT SETONGKOL BARU 7

TMN FAIRMOUNT FASA 2 25200 KUANTAN PAHANG


(3)

“I hereby declare that this report is the result of my own work except for quotes as cited in the references”

Signature : ……….…

Author : TAN CHEE CHONG


(4)

“I hereby declare that I have read this report and in my opinion this report is sufficient in terms of the scope and quality for award of Bachelor of Electronic

Engineering (Telecommunication Electronic) With Honours.”

Signature : ………..

Supervisor‟s Name : REDZUAN BIN ABDUL MANAP


(5)

(6)

ACKNOWLEDGEMENT

I would like to thank my supervisor, Mr. Redzuan Bin Abdul Manap for his guidance, lesson, and motivational advices. Without his constructive critiques, this final year project would not be successfully accomplished. Besides that, I also indebted to Universiti Teknikal Malaysia Melaka (UTeM) and Faculty of Electronic and Computer Engineering (FKEKK) for providing some facilities.


(7)

ABSTRACT

The purpose of this project is to implement Kite Cross Diamond Search (KCDS) algorithm, which uses kite and diamond search patterns to achieve the fast searching process. Full Search (FS) algorithm is the initial method to search the block with minimum distortion but it requires substantial amount of computational workload. To overcome this problem, many fast Block Matching Algorithm (BMA‟s) have been designed and developed, where KCDS algorithm is the one of these fast BMA. The KCDS algorithm was tested using several video sequences and have a better performance in search points and elapsed time compared to other algorithms. The simulation results indicate that KCDS algorithm is suitable for all fast and slow motion video sequences.


(8)

ABSTRAK

Projek ini bertujuan untuk melaksanakan algoritma „Kite Cross Diamond Search‟ (KCDS), yang menggunakan corak pencarian „Kite‟ dan „diamond search‟ untuk mencapai proses pencarian yang cepat. Algoritma „Full Search‟ (FS) adalah kaedah awal untuk mencari blok dengan gangguan minimal tetapi ianya memerlukan beban kerja perkomputeran yang tinggi. Untuk mengatasi masalah ini, banyak „Block Matching Algorithm‟ (BMA) yang cepat telah direka dan dibangunkan, di mana algoritma KCDS adalah salah satu BMA yang cepat. Algoritma KCDS diuji dengan menggunakan beberapa video dan mempunyai prestasi yang lebih baik dari aspek titik pencarian dan masa simulasi berbanding dengan algoritma-algoritma yang lain. Keputusan simulasi menunjukkan bahawa algoritma KCDS sesuai untuk video yang mempunyai gerakan cepat mahupun gerakan lambat.


(9)

TABLE OF CONTENT

CHAPTER CONTENT PAGE

PROJECT TITLE i

BORANG PENGESAHAN STATUS LAPORAN ii

DECLARATION iii

DEDICATION v

ACKNOWLEDGEMENT vi

ABSTRACT vii

ABSTRAK viii

TABLE OF CONTENT ix

LIST OF TABLE xii

LIST OF FIGURE xiii

LIST OF ACRONYMS xviii 1 INTRODUCTION 1.1 Introduction 1

1.2 Problem Statements 2

1.3 Objective 2


(10)

2 LITERATURE REVIEW 4

1.5 Video Compression 4

1.6 Motion Estimation 4

1.7 Block Matching Algorithm 5

1.8 Full Search Algorithm 8

1.9 Three Step Search Algorithm 8

1.10 Hexagon Based Search Algorithm 9

1.11 Diamond Search Algorithm 10

1.12 New Cross Diamond Search Algorithm 11

1.13 Video Characteristics 13

3 METHODOLOGY 14

3.1 Methodology 14

3.1.1 Literature Review 15

3.1.2 Initial Work with MATLAB 15

3.1.3 KCDS Development 15

3.1.4 Performance Analysis 16

3.2 Theory 16

4 RESULTS 19


(11)

4.2 First Stage Result 20

4.2.1 Akiyo Video 20

4.2.2 Salesman Video 21

4.2.3 Foreman Video 23

4.2.4 Coastguard Video 24

4.2.5 News Video 26

4.2.6 Tennis Video 27

4.3 Single Frame Simulation 30

4.4 Fifty Frames Simulation 33

4.5 Hundred Frames Simulation 43

5 DISCUSSION AND CONCLUSION 51


(12)

LIST OF TABLE

NO TITLE PAGE

2.1 Type of video file 13

2.2 Characteristics of video file 13

4.1 Elapsed time, average points and average

PSNR for KCDS algorithm for all video sequences 29 4.2 Elapsed time in single frame simulation for

TSS, HEXBS, DS, NCDS and KCDS algorithms 30

4.3 Average search point in single frame simulation

for TSS, HEXBS, DS, NCDS and KCDS algorithms 30

4.4 Average PSNR in single frame simulation for

TSS, HEXBS, DS, NCDS and KCDS algorithms 31

4.5 Elapsed time in fifty frames simulation for

TSS, HEXBS, DS, NCDS and KCDS algorithms 33

4.6 Average search point in fifty frames simulation for

TSS, HEXBS, DS, NCDS and KCDS algorithms 34

4.7 Average PSNR in fifty frames simulation for

TSS, HEXBS, DS, NCDS and KCDS algorithms 34

4.8 Elapsed time in hundred frames simulation for

TSS, HEXBS, DS, NCDS and KCDS algorithms 43

4.9 Average search point in hundred frames simulation for

TSS, HEXBS, DS, NCDS and KCDS algorithms 43

4.10 Average PSNR in hundred frames simulation for


(13)

LIST OF FIGURE

NO TITLE PAGE

2.1 The two frames used to determine the motion

vector of a given block 6

2.2 Block matching a macroblock 6

2.3 Hexagon Based Search Pattern 9

2.4 Large Diamond Search Pattern 10

2.5 Small Diamond Search Pattern 10

2.6 SCSP and LCSP 12

3.1 Flow chart for methodology 14

3.2 Flow chart for KCDS algorithm 16

3.3 Search pattern KCDS 18

3.4 Kite Search Patterns:

(a) Up kite (b) Left kite (c) Down kite (d) Right kite 18 4.1 The original and predicted images for KCDS algorithm 20

4.2 Average PSNR for KCDS algorithm 20


(14)

4.4 The original and predicted images for KCDS algorithm 21

4.5 Average PSNR for KCDS algorithm 22

4.6 Average Points for KCDS algorithm 22

4.7 The original and predicted images for KCDS algorithm 23

4.8 Average PSNR for KCDS algorithm 23

4.9 Average Points for KCDS algorithm 24

4.10 The original and predicted images for KCDS algorithm 24

4.11 Average PSNR for KCDS algorithm 25

4.12 Average Points for KCDS algorithm 25

4.13 The original and predicted images for KCDS algorithm 26

4.14 Average PSNR for KCDS algorithm 26

4.15 Average Points for KCDS algorithm 27

4.16 The original and predicted images for KCDS algorithm 27

4.17 Average PSNR for KCDS algorithm 28

4.18 Average Points for KCDS algorithm 28

4.19 The original and predicted images for TSS algorithm 31 4.20 The original and predicted images for HEXBS algorithm 32 4.21 The original and predicted images for DS algorithm 32 4.22 The original and predicted images for NCDS algorithm 32 4.23 The original and predicted images for KCDS algorithm 33 4.24 The original and predicted images for TSS algorithm in


(15)

4.25 The original and predicted images for HEXBS algorithm

in Tennis video 35

4.26 The original and predicted images for DS algorithm in

Tennis video 35

4.27 The original and predicted images for NCDS algorithm in

Tennis video 36

4.28 The original and predicted images for KCDS algorithm in

Tennis video 36

4.29 Average points in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Akiyo video 37

4.30 Average PSNR in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Akiyo video 37

4.31 Average points in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Salesman video 38

4.32 Average PSNR in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Salesman video 38

4.33 Average points in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Foreman video 39

4.34 Average PSNR in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Foreman video 39

4.35 Average points in fifty frames simulation for TSS, HEXBS,


(16)

4.36 Average PSNR in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Coastguard video 40

4.37 Average points in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in News video 41

4.38 Average PSNR in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in News video 41

4.39 Average points in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Tennis video 42

4.40 Average PSNR in fifty frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Tennis video 42

4.41 Average points in hundred frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Akiyo video 44

4.42 Average PSNR in hundred frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Akiyo video 45

4.43 Average points in hundred frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Salesman video 45

4.44 Average PSNR in hundred frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Salesman video 46

4.45 Average points in hundred frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Foreman video 46

4.46 Average PSNR in hundred frames simulation for TSS, HEXBS,


(17)

4.47 Average points in hundred frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Coastguard video 47

4.48 Average PSNR in hundred frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Coastguard video 48

4.49 Average points in hundred frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in News video 48

4.50 Average PSNR in hundred frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in News video 49

4.51 Average points in hundred frames simulation for TSS, HEXBS,

DS, NCDS and KCDS algorithm in Tennis video 49

4.52 Average PSNR in hundred frames simulation for TSS, HEXBS,


(18)

LIST OF ACRONYMS

BDM - Block Distortion Measure

BMA - Block Matching Algorithm

BMME - Block Matching Motion Estimation

DS - Diamond Search

FS - Full Search

HEXBS - Hexagon Based Search

KCDS - Kite Cross Diamond Search

KSP - Kite Search Pattern

LCSP - Large Cross-Shaped Pattern

LDSP - Large Diamond-Shaped Pattern

MAD - Mean Absolute Difference

MB - Marcoblocks

MBD - Minimum Block Distortion

ME - Motion Estimation

MSE - Mean Squared Error

NCDS - New Cross Diamond Search

PSNR - Peak Signal-to-Noise Ratio

SCSP - Small Cross-Shaped Pattern

SDSP - Small Diamond-Shaped Pattern


(19)

CHAPTER 1

INTRODUCTION

1.1 Introduction

Block Matching Motion Estimation (BMME) is known as a technique to achieve high compression ratio in video coding and it has been generally adopted in various coding standards. This technique is implemented conventionally by exhaustively testing all the candidate blocks within the search window. Full Search (FS) Algorithm is the type of implementation which provides the optimum solution. However, this algorithm requires substantial amount of computational workload. To overcome this imperfection, many fast Block Matching Algorithms (BMA‟s) have been designed and developed. In order to find the optimum motion vector with minimal number of required search points, different search patterns and strategies are exploited.

One of these fast BMA‟s, which is proposed to be implemented in this project, is called Kite Cross Diamond Search (KCDS) Algorithm. The student is required to implement the algorithm in MATLAB and then compare its performance to FS algorithm as well as to other fast BMA‟s in terms of the peak signal-to-noise ratio (PSNR) produced, number of search points required and computational complexity.


(20)

1.2 Problem Statements

Block matching method is to seek for the best matched block from the previous frame, which is the first single frame, within a fixed-sized of search window, W: Initially, this method use FS technique. In order to search the block with minimum distortion, FS matches all possible displaced candidate block within the search area in the reference frame, consequently FS algorithm uses more search point to do the block matching process. It also introduces high and intensive computation of work. Many fast motion estimation algorithms have been proposed to give a faster estimation with similar block distortion compared to FS over the last two decades. Example of these fast algorithms are the three step search (TSS), the hexagon based search (HEXBS), the diamond search (DS), the new cross diamond search (NCDS) and KCDS.

1.3 Objective

The main objective of this project is to implement one of the available fast BMA, namely KCDS algorithm. Detail objectives are as follows:

a) To implement and develop the of KCDS algorithm using MATLAB. b) To compare the performance of KCDS algorithm with other algorithms. c) To produce working MATLAB program code for the algorithm


(21)

1.4 Scope of Works

The scopes of works in this project are:

a) Background Study:

Study on video or image compression, Motion Estimation, BMA and KCDS algorithm.

b) Implementation of the KCDS algorithm using MATLAB.

The proposed algorithm is implemented and simulated using MATLAB. c) Performance Analysis

The performance of KCDS algorithm is compared with existing fast block matching motion estimation algorithms.


(22)

CHAPTER 2

LITERATURE REVIEW

2.1 Video Compression

Video compression is to simplify the quantity of data used to represent digital video images, and is a combination of spatial image compression and temporal motion compensation. Its plays an important role in digital libraries, video in demand and high definition television which are an example of applications of digital video. To exploit the spatial and temporal redundancy of video sequence, it needs used fewer bits to represent a video sequence at an acceptable visual distortion. Besides that, it also represents the objective of a video compression algorithm [1].

2.2 Motion Estimation

Motion estimation (ME) is the action of determining motion vectors that delineate the transformation from one 2D image to another; usually from adjoining frames in a video sequence. The temporal prediction technique used in MPEG video is based on ME. To send a full frame, the inherently have less energy and can be


(23)

compressed by sending a encoded difference images, it need to save on bits. This is the idea of ME based video compression. From the video sequence, the ME takes out the motion information.

Besides that, ME is a multistep action that combination of techniques, such as motion starting point, motion search patterns, and modify control to restrain the search, dodge of search stationary regions, etc. To find the most accurate motion vector (MV), the ME algorithm is an embodiment of several effective ideas and it also aim to maximize the encoding speed as well as the visual quality [2].

2.3 Block Matching Algorithm

The temporal redundancy removed technique between two or more successive frame is called BMA. It is an integral part for most of the motion-compensated video coding standards. The frames are being divided into regular size blocks and these blocks are called Marcoblock (MB). The MB is compared with equal block and its adjacent neighbors in the previous frame to create a vector that stipulates the movement of a MB from one location to another in the previous frame. In the current frame, all MBs comprise a frame and this movement is calculated [3].

Block matching method is to seek for the best matched block from the previous frame, usually the first single frame, within a fixed sized of search window (W). The displacement of the best matched block will be described as the motion vector to the block in the current frame based on a block distortion measure (BDM) or other matching criteria.


(24)

Figure 2.1: The two frames used to determine the motion vector of a given block [3].


(1)

CHAPTER 1

INTRODUCTION

1.1 Introduction

Block Matching Motion Estimation (BMME) is known as a technique to achieve high compression ratio in video coding and it has been generally adopted in various coding standards. This technique is implemented conventionally by exhaustively testing all the candidate blocks within the search window. Full Search (FS) Algorithm is the type of implementation which provides the optimum solution. However, this algorithm requires substantial amount of computational workload. To overcome this imperfection, many fast Block Matching Algorithms (BMA‟s) have been designed and developed. In order to find the optimum motion vector with minimal number of required search points, different search patterns and strategies are exploited.

One of these fast BMA‟s, which is proposed to be implemented in this project, is called Kite Cross Diamond Search (KCDS) Algorithm. The student is required to implement the algorithm in MATLAB and then compare its performance to FS algorithm as well as to other fast BMA‟s in terms of the peak signal-to-noise ratio (PSNR) produced, number of search points required and computational complexity.


(2)

1.2 Problem Statements

Block matching method is to seek for the best matched block from the previous frame, which is the first single frame, within a fixed-sized of search window, W: Initially, this method use FS technique. In order to search the block with minimum distortion, FS matches all possible displaced candidate block within the search area in the reference frame, consequently FS algorithm uses more search point to do the block matching process. It also introduces high and intensive computation of work. Many fast motion estimation algorithms have been proposed to give a faster estimation with similar block distortion compared to FS over the last two decades. Example of these fast algorithms are the three step search (TSS), the hexagon based search (HEXBS), the diamond search (DS), the new cross diamond search (NCDS) and KCDS.

1.3 Objective

The main objective of this project is to implement one of the available fast BMA, namely KCDS algorithm. Detail objectives are as follows:

a) To implement and develop the of KCDS algorithm using MATLAB.

b) To compare the performance of KCDS algorithm with other algorithms.


(3)

1.4 Scope of Works

The scopes of works in this project are:

a) Background Study:

Study on video or image compression, Motion Estimation, BMA and KCDS algorithm.

b) Implementation of the KCDS algorithm using MATLAB.

The proposed algorithm is implemented and simulated using MATLAB.

c) Performance Analysis

The performance of KCDS algorithm is compared with existing fast block matching motion estimation algorithms.


(4)

CHAPTER 2

LITERATURE REVIEW

2.1 Video Compression

Video compression is to simplify the quantity of data used to represent digital video images, and is a combination of spatial image compression and temporal motion compensation. Its plays an important role in digital libraries, video in demand and high definition television which are an example of applications of digital video. To exploit the spatial and temporal redundancy of video sequence, it needs used fewer bits to represent a video sequence at an acceptable visual distortion. Besides that, it also represents the objective of a video compression algorithm [1].

2.2 Motion Estimation

Motion estimation (ME) is the action of determining motion vectors that delineate the transformation from one 2D image to another; usually from adjoining frames in a video sequence. The temporal prediction technique used in MPEG video is based on ME. To send a full frame, the inherently have less energy and can be


(5)

compressed by sending a encoded difference images, it need to save on bits. This is the idea of ME based video compression. From the video sequence, the ME takes out the motion information.

Besides that, ME is a multistep action that combination of techniques, such as motion starting point, motion search patterns, and modify control to restrain the search, dodge of search stationary regions, etc. To find the most accurate motion vector (MV), the ME algorithm is an embodiment of several effective ideas and it also aim to maximize the encoding speed as well as the visual quality [2].

2.3 Block Matching Algorithm

The temporal redundancy removed technique between two or more successive frame is called BMA. It is an integral part for most of the motion-compensated video coding standards. The frames are being divided into regular size blocks and these blocks are called Marcoblock (MB). The MB is compared with equal block and its adjacent neighbors in the previous frame to create a vector that stipulates the movement of a MB from one location to another in the previous frame. In the current frame, all MBs comprise a frame and this movement is calculated [3].

Block matching method is to seek for the best matched block from the previous frame, usually the first single frame, within a fixed sized of search window (W). The displacement of the best matched block will be described as the motion vector to the block in the current frame based on a block distortion measure (BDM) or other matching criteria.


(6)

Figure 2.1: The two frames used to determine the motion vector of a given block [3].