Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Digital Image Processing

Final Project

Date Recognition Using


Local Binary Patterns
Khalid Al hamawi
Submitted to: Professor Ghulam Muhammad
06/2/2014
I. INTRODUCTION
The aim of this project is to develop an
automatic date classifications system using local
binary patterns algorithm. The system should be
able to recognize 4 kinds of dates: Ajwah, Sagai,
Sellaj and Sukkari. In the classification the date
image is compared with the images from the
database using LBP feature.
II. ALGORITHMS
Starting with summarizing the main steps of the
algorithms used in this project, then each step
will be will be described in detail. The date
recognition process consists of four main steps:
1) Preparing the training and testing images.
2) Decomposing each training image into
YCbCr channel.
3) Extracting LBP from each channel.
4) Finding the average histogram for all
channels for each kind of dates.
5) Finding the chi-square distance between
histograms of testing images and the
average histograms from previous step.
A. Preparing the images:
The below steps are used to prepare the images:
1) Using (I phone 5) camera, 20 images will
be taken from each kind of date. 10
images for training and the other 10 for
testing. That will be 80 images in total.
2) Resizing the images to 128256.
B. YCbCr channels:
Color
spaces
are
three-dimensional
arrangements of color sensations. Colors are
specified by points in these spaces. The RGB

(Red, Green, and Blue) space is the most


frequently used color space for image processing.
Since color cameras, scanners and displays are
most often provided with direct RGB signal input
or output, this color space is the basic one, which
is, if necessary, transformed into other color
spaces like in this project [1].
Each color is described by its RGB components
is represented by a point and can be found either
on the surface or inside the cube in figure 1. All
gray colors are placed on the main diagonal of
this cube from black (R = G = B = 0) to (R = G =
B = max) [1].

Figure 1: Representation of colors in RGB space


The difference between YCbCr and RGB is
that YCbCr represents color as brightness and
two color difference signals, while RGB
represents color as red, green and blue.
In YCbCr, Y is brightness perceived of the pixel
and it is defined to have 8-bit range of 16-235,
Cb is (Blue Y) and Cr is (Red Y) and they are
defined to have nominal range of 16-240 [2]. The
basic equations to convert between 8-bits digital
RGB data with a 0-255 and YCbCr are [2]:
1

Y = 0.257R + 0.504G + 0.098B +19


Cb = 0.439R -0.368G -0.071B +128

(1)

Cr = -0.148R -.0291G +0.439B +128

(3)

Figure 2 shows the


representation of image.

RGB

and

(2)

YCbCr

surrounding pixels, and function S is dened as


[3]:
{

(5)

In other words, the LBP 3x3 operator works


with the eight neighbors of a pixel, using the
value of this center pixel as a threshold. If a
neighbor pixel has a higher gray value than the
center pixel (or the same gray value) than a one is
assigned to that pixel, else it gets a zero. The
LBP code for the center pixel is then produced by
concatenating the eight ones or zeroes to a binary
code [4]. Figure 4 shows an example of finding
LBP of date of kind "Sukkari":

Figure 2: Example of RGB and YCbCr channels


of image
C. Local Binary Patterns:
The LBP operator is a non-parametric 3x3
kernel which summarizes the local special
structure of an image. It was rst introduced by
Ojala et al, and was proved a powerful means of
texture description. At a given pixel position
(xc, yc), LBP is dened as an ordered set of
binary comparisons of pixel intensities between
the center pixel and its eight surrounding pixels
as shown in figure 3 [3].

Figure 3: Example of LBP calculation


The decimal form of the resulting 8-bit word
(LBP code) can be expressed as follows [3]:

(4)

where ic corresponds to the grey value of the


center pixel (Xc, Yc), in to the grey values of the 8

Figure 4: LBP of Y-channel for date of kind


"Sukarri"
D. Finding the average histogram:
For each kind of dates there are 30 histograms,
10 for each channel. Average histogram will be
found of each channel to compare late with the
test one.
E. Chi-square distance:
Chi-square distance is one of the distance
measures that can be used as a measure of
dissimilarity between two histograms and has
been widely used in various applications such as
image retrieval, texture and object classification,
and shape classification [5]. In histograms of
many processes, the difference between large
bins is less important than the difference between
small bins and that should be reduced. The
chi-square histograms take this into account [5].
If p and q represent the probability distributions
of two events A and B with random variables,
i = 1, 2 n, the chi-square measure between
these two histograms is given by:

(6)

Chi square test will be used to find the


minimum distance between the test image
histograms, after converting it to YCbCr and find
LBP for each channel, and the average
histograms from the previous step.
III. ALGORITHM FLOW CHART
The below flowchart shows the training and
testing parts.

IV. RESULTS AND DISCUSION


The results of testing the proposed algorithm on
date recognition are illustrated in table 1. Here
the number of training dates was 10 dates for
each kind. Table 2 shows the results when the
training dates were 5 dates for each kind.
Table 1: Results for 10 training images of each
kind
result
test

Ajwah

Sagai

Sellaj

Sukkari

Ajwah
Sagai
Sellaj
Sukkari

10
1
0
0

0
9
0
0

0
0
10
0

0
0
0
10

Table 2: results for 5 training images of each


kind
result
test

Ajwah

Sagai

Sellaj

Sukkari

Ajwah
Sagai
Sellaj
Sukkari

0
1
4
0

10
9
0
0

0
0
6
0

0
0
0
10

V. CONCLUSION and FUTUR


IMPROVEMENTS

Training

Testing

Figure 5: Flowchart of training and testing parts

A. Conclusion:
In this report, date recognition algorithm was
introduced based on LBP features. The date
image is compared with the images from the
database. This method represents the local
feature of the date and matches it with the most
similar date image in database. The accuracy of
the system is above 97 %.
The number of training images has a large impact
on the results, as illustrated in table 2, the
accuracy of the system reduced to 63 % when the
number of training image reduced to 5 images
from each kind of dates.

B. Future Improvements:
This project can be improved to recognize the
condition of the date if it is in good condition or
not. Also it can be used as an application in smart
phones, where the user can take a photo of the
date before he buys it to know what kind it is and
is it in good condition or not.

VI. REFERENCES
[1]. Adrian Ford and AlanRoberts," Colour
SpaceConversions",August 11, 1998(b).
[2]. Keith Jack, "YCbCr to RGB Considerations",
March 1997
[3]. Yann RODRIGUEZ," Face Detection and
Verification using Local Binary Patterns",
OCTOBRE 2006.
[4]. Md. Abdur Rahim, Md. Najmul Hossain,
Tanzillah Wahid & Md. Shafiul Azam," Face
Recognition using Local Binary Patterns (LBP)",
Global Journal of Computer Science and
Technology, Year 2013
[5]. N. U. Bhajantri and P. Nagabhushan,
"GLCM based Chi-square Histogram Distance
for Automatic Detection of Defects on Patterned
Textures",New Horizon College of Engineering

You might also like