83
PROJECT ON CONTENT BASED IMAGE RETRIEVAL USING GABOR WAVELET To be submitted by:- Yadav Satyam CONTENT BASED IMAGE RETRIEVAL Page 1

Final Doc Cbir

Embed Size (px)

Citation preview

Page 1: Final Doc Cbir

PROJECT ON

CONTENT BASED IMAGE RETRIEVAL USING GABOR WAVELET

To be submitted by:-

Yadav Satyam

CONTENT BASED IMAGE RETRIEVAL Page 1

Page 2: Final Doc Cbir

Thakur Degree College of Science & Commerce.

Shyamnarayan Thakur Marg, Thakur Village,

Kandivali (E), Mumbai-400101.

Date: _______________

CERTIFICATE OF APPROVAL

This is to certify that:

Yadav Satyam

Student’s of “Master of Science (Information Technology)” of “Thakur Degree College of

Science & Commerce” have successfully completed and submitted the project entitled “Content

Based Image Retrieval (CBIR) using Gabor Wavelet” in the partial fulfillment as per the syllabus

defined by the University of Mumbai.

The project is the original study work and the important sources used have been

dually acknowledged in the report.

________________ ______________________

Project Guide Head of Department

_____________________

External Examiner

CONTENT BASED IMAGE RETRIEVAL Page 2

Page 3: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 3

Page 4: Final Doc Cbir

Acknowledgement

I am pleased to have this opportunity to express my profound gratitude to the management

of Thakur College of Science & Commerce for giving me the opportunity to accomplish

this project

I am thankful to the Honorable Principal Mrs. C. T. Chakraborty and the Head of the IT

Department (H.O.D.) Mr. Santosh Kumar Singh for their great support.

I am very much grateful to Mrs. VarshaTurkar, my Project Guide for the valuable

guidance and suggestions which helped me accomplish the project.

I am very much grateful to Mr. RavindraPatil, for his suggestions which helped me in the

project.

CONTENT BASED IMAGE RETRIEVAL Page 4

Page 5: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 5

Page 6: Final Doc Cbir

SYNOPSIS

INTRODUCTION:

Content Based Image Retrieval (CBIR) is a system, which retrieves the images from

images from an image collection where the retrieval is based on a query, which is specified by

content and by index or address. The CBIR system retrieves relevant images from an image

collection based on automatic derived features. The derived features include primitive features

like texture, color, and shape.

Content-Based Image Retrieval (CBIR) allows to automatically extracting target images

according to objective visual contents of the images itself.

Problem Definition:

Image retrieval can be divided into Text-Based Image Retrieval (TBIR) and Content-

Based Image Retrieval (CBIR). The text-based image retrieval technique first annotates the

images by text, and then uses text-based database management systems to perform image

retrieval.

The TBIR system has following problems:

When the size of image collection is large considerable amount of labor is

required for manual image annotation.

The other difficulty is the subjectivity of human perception that is, for the same

image content different people may perceive it differently. The perception

subjectivity and annotation impreciseness may cause unrecoverable mismatches

in later retrieval processes.

CONTENT BASED IMAGE RETRIEVAL Page 6

Page 7: Final Doc Cbir

Project Explanation:

CBIR is the retrieval of images based on visual features such as color, texture and shape.

1. Feature Extraction: The first step in the process is extracting image features to a

distinguishable extent.

2. Matching: The second step involves matching these features to yield a result that is

visually similar.

Algorithm to be implemented:

Extract the feature vector of the images.

Store the feature vector in the database.

Extract the feature vector of the Query image.

Compare the feature vector of the query image with database features

Apply similarity measures.

Retrieves similar images.

Technology:

MATLAB

Reasons for using MATLAB:

MATLAB is a high performance language for technical computing. It allows easy matrix

manipulation, plotting of function and data, implementation of algorithm, creation of user

interfaces and interfacing with programs in other language.

MATLAB also provides wide range of elementary functions. It supports various types of

data files and it also has Object Oriented capabilities

INDEXCONTENT BASED IMAGE RETRIEVAL Page 7

Page 8: Final Doc Cbir

Sr. No Content Page No.

1. Introduction

1.1 Content Based Image Retrieval1.2 Digital Image and its Features

1.2.1 Feature Vectors2. Wavelet

2.1 Introduction

2.2 Wavelet Transform

2.3 Gabor Wavelet

3. System Overview

3.1 Working of the project

3.2 Flow chart of the CBIR systems

4. System Analysis and Design

4.1 Methodology

4.2 Hardware and Software Requirement

4.3 Gantt Chart

4. Introduction to Matlab

5. Screenshots

6. Testing

7. Cost Estimation

8. Annexure

8.1 Limitation of the System

8.2 Future Enhancements

9. Conclusion

10. Appendix

Bibliography

CONTENT BASED IMAGE RETRIEVAL

Image retrieval is the process of browsing, searching and retrieving images from a large database

of digital images. The collection of images in the web are growing larger and becoming more

CONTENT BASED IMAGE RETRIEVAL Page 8

Page 9: Final Doc Cbir

diverse .Retrieving images from such large collections is a challenging problem. One of the

main problems they highlighted was the difficulty of locating a desired image in a large and

varied collection. While it is perfectly possible to identify a desired image from a small

collection simply by browsing, more effective techniques are needed with collections containing

thousands of items. To search for images, a user may provide query terms such as keyword,

image file/link, or click on some image, and the system will return images "similar" to the query.

The similarity used for search criteria could be meta tags, color distribution in images,

region/shape attributes, etc. Unfortunately, image retrieval systems have not kept pace with the

collections they are searching. The shortcomings of these systems are due both to the image

representations they use and to their methods of accessing those representations to find images.

The problems of image retrieval are becoming widely recognized, and the search for solutions an

increasingly active area for research and development.

In recent years, with large scale storing of images the need to have

an efficient method of image searching and retrieval has increased. It can simplify many tasks in

many application areas such as biomedicine, forensics, artificial intelligence, military, education,

web image searching. Most of the image retrieval systems present today are text-based, in which

images are manually annotated by text-based keywords and when we query by a keyword,

instead of looking into the contents of the image, this system matches the query to the keywords

present in the database. This technique has its some disadvantages:

a) Firstly, considering the huge collection of images present, it’s not feasible to manually

annotate them.

b) Secondly, the rich features present in an image cannot be described by keywords completely.

These disadvantages of text-based image retrieval techniques call for another relatively new

technique known as Content-Based Image Retrieval (CBIR).

E.g.

CONTENT BASED IMAGE RETRIEVAL Page 9

Page 10: Final Doc Cbir

Fig 1.1 Multiple ways of describing an Image

DIGITAL IMAGE & its FEATURE VECTORS

A digital image is a representation of a two-dimensional image using ones and zeros (binary).

Depending on whether or not the image resolution is fixed, it may be of vector or raster type.

Without qualifications, the term "digital image" usually refers to raster images also called bitmap

images. Raster images have a finite set of digital values, called picture elements or pixels. The

digital image contains a fixed number of rows and columns of pixels. Pixels are the smallest

individual element in an image, holding quantized values that represent the brightness of a given

color at any specific point. Raster images can be created by a variety of input devices and

techniques, such as digital cameras, scanners, coordinate-measuring machines, seismographic

profiling, airborne radar, and more. They can also be synthesized from arbitrary non-image data,

CONTENT BASED IMAGE RETRIEVAL Page 10

Page 11: Final Doc Cbir

such as mathematical functions or three-dimensional geometric models; the latter being a major

sub-area of computer graphics. The field of digital image processing is the study of algorithms

for their transformation.

Digital image processing is the use of computer algorithms to perform image processing on

digital images. As a subcategory or field of digital signal processing, digital image processing

has many advantages over analog image processing. It allows a much wider range of algorithms

to be applied to the input data and can avoid problems such as the build-up of noise and signal

distortion during processing. Since images are defined over two dimensions (perhaps more)

digital image processing may be modeled in the form of Multidimensional Systems.

Feature Vectors:-

In pattern recognition and machine learning, a feature vector is an n-dimensional vector of

numerical features that represent some object. Many algorithms in machine learning require a

numerical representation of objects, since such representations facilitate processing and

statistical analysis. When representing images, the feature values might correspond to the pixels

of an image, when representing texts perhaps to term occurrence frequencies.

Some important feature vectors of the image are as follows:

1. Mean: Mean gives the overall distribution of the pixel’s gray level.

2. Variance: The variance is a measure of dispersion. It tells us something about the scatter

of scores (here pixels) around the mean. It is defined as the mean squared deviation from

the mean, and symbolized by a small sigma squared. Its formula is:

Variance = σ x2= ∑ (X −M) 2 /N

Where X=Pixel value

M=Mean of the Image

N=Total number of pixel

3. Standard Deviation:

The standard deviation is the square root of the variance and is Symbolized by a small

Greek sigma - σ. Its formula is the square root of any of the formulae for the variance,

e.g. x=∑(x)2/N

CONTENT BASED IMAGE RETRIEVAL Page 11

Page 12: Final Doc Cbir

(a) Clouds

(b) Bricks

(c) Rocks

4. Entropy:

Entropy is a statistical measure of randomness that can be used to characterize the texture

of the input image.

5. Texture:

Texture is that innate property of all surfaces that describes visual patterns, each having

properties of homogeneity. It contains important information about the structural

arrangement of the surface, such as; clouds, leaves, bricks, fabric, etc. It also describes

the relationship of the surface to the surrounding environment. In short, it is a feature that

describes the distinctive physical composition of a surface.

Texture properties include: Coarseness, Contrast, Directionality, Line-likeness,

Regularity, and Roughness in the image.

Texture is one of the most important defining features of an image.

It is characterized by the spatial distribution of gray levels in a neighborhood. In order to

capture the spatial dependence of gray-level values, which contribute to the perception of

texture, a two-dimensional dependence texture analysis matrix is taken into

consideration. This two-dimensional matrix is obtained by decoding the image file; jpeg,

bmp, etc.

Fig 1.2 Examples of Textures

CONTENT BASED IMAGE RETRIEVAL Page 12

Page 13: Final Doc Cbir

6. Color :

One of the most important features that make possible the recognition of images by

humans is color. Color is a property that depends on the reflection of light to the eye and

the processing of that information in the brain. We use color every day to tell the

difference between objects, places, and the time of day. Usually colors are defined in

three dimensional color spaces. These could either be RGB (Red, Green, and Blue), HSV

(Hue, Saturation, and Value) or HSB (Hue, Saturation, and Brightness). The last two are

dependent on the human perception of hue, saturation, and brightness.

7. Shape :

Shape may be defined as the characteristic surface configuration of an object; an outline

or contour. It permits an object to be distinguished from its surroundings by its outline.

Shape representations can be generally divided into two categories:

Boundary-based, and

Region-based.

Fig.1.3 Boundary-based & Region-based

WAVELET

CONTENT BASED IMAGE RETRIEVAL Page 13

Page 14: Final Doc Cbir

In Mathematics wavelet transform refers to the representation of a signal in terms of finite

length or fast decaying oscillating waveform known as mother wavelet. Wavelet analysis allows

the use of long time intervals where we want more precise low-frequency information, and

shorter regions where we want high-frequency information.

Wavelet analysis is capable of revealing aspects of data that other signal analysis techniques miss

aspects like trends, breakdown points, discontinuities in higher derivatives, and self-similarity.

Furthermore, because it affords a different view of data than those presented by traditional

techniques, wavelet analysis can often compress or de-noise a signal without appreciable

degradation.

Wavelet transforms are broadly divided into three classes: the continuous wavelet transform, the

discretized wavelet transform and multi-resolution based wavelet transform. DWT is good for

signal having high frequency components for short durations and low frequency components for

long duration e.g. images. When a wavelet transform of the image is performed, a coefficient in a

low sub-band can be thought of having four descendants in the next higher sub-band. The four

descendants each have four descendants in the next higher sub-band.

Discrete wavelet transform (DWT), transforms a discrete time signal to a discrete wavelet

representation. A 2D wavelet transforms works as follows:

Fig.2.1Working of 2D Wavelet Transform

WAVELET TRANSFORM

CONTENT BASED IMAGE RETRIEVAL Page 14

Page 15: Final Doc Cbir

Textures can be modeled as quasi-periodic patterns with spatial/frequency representation. The

wavelet transform transforms the image into a multi-scale representation with both spatial and

frequency characteristics. This allows for effective multi-scale image analysis with lower

computational cost. According to this transformation, a function, which can represent an image,

a curve, signal etc., can be described in terms of a coarse level description in addition to others

with details that range from broad to narrow scales.

Unlike the usage of sine functions to represent signals in Fourier transforms, in wavelet

transform, we use functions known as wavelets. Wavelets are finite in time, yet the average value

of a wavelet is zero. In a sense, a wavelet is a waveform that is bounded in both frequency and

duration. While the Fourier transform converts a signal into a continuous series of sine waves,

each of which is of constant frequency and amplitude and of infinite duration, most real-world

signals (such as music or images) have a finite duration and abrupt changes in frequency. This

account for the efficiency of wavelet transforms. This is because wavelet transforms convert a

signal into a series of wavelets, which can be stored more efficiently due to finite time, and can

be constructed with rough edges, thereby better approximating real-world signals.

Wavelet Decomposition:

Wavelets are functions defined over a finite interval and having an average value of zero. In

wavelet decomposition, an image is decomposed into four components namely Approximate

coefficients, Horizontal coefficients, Diagonal coefficients and Vertical coefficients.

Image

Approximate Coefficients (AC) Vertical Coefficients (VC)

Horizontal Coefficients (HC) Diagonal Coefficients (DC)

AC HC DC VC

Fig.2.2 Wavelet Decomposition of an image

CONTENT BASED IMAGE RETRIEVAL Page 15

Page 16: Final Doc Cbir

This kind of two-dimensional DWT leads to a decomposition of approximation coefficients at level j in four components: the approximation at level j+1, and the details in three orientations (horizontal, vertical, and diagonal).

Discrete Wavelet Transform

In numerical analysis and functional analysis, a discrete wavelet transform (DWT) is any wavelet

transform for which the wavelets are discretely sampled. As with other wavelet transforms, a key

advantage it has over Fourier transforms is temporal resolution: it captures both frequency and

location information (location in time).

Discrete Wavelet Transform

Fig.2.3 Discrete wavelet transform

CONTENT BASED IMAGE RETRIEVAL Page 16

Page 17: Final Doc Cbir

2-D DWT for Image

Fig.2.4 2-D DWT for Image

Fig.2.5 (A) Fig.2.5 (B) Fig.2.5(C)

CONTENT BASED IMAGE RETRIEVAL Page 17

Page 18: Final Doc Cbir

GABOR WAVELET

In image processing, a Gabor filter, named after Dennis Gabor, is a linear filter

used for edge detection. Frequency and orientation representations of Gabor filter are similar to

those of human visual system, and it has been found to be particularly appropriate for texture

representation and discrimination. In the spatial domain, a 2D Gabor filter is a Gaussian kernel

function modulated by a sinusoidal plane wave. The Gabor filters are self-similar – all filters can

be generated from one mother wavelet by dilation and rotation.

Its impulse response is defined by a harmonic function multiplied by a Gaussian function.

Because of the multiplication-convolution property (Convolution theorem), the Fourier transform

of a Gabor filter's impulse response is the convolution of the Fourier transform of the harmonic

function and the Fourier transform of the Gaussian function.

Gabor filter (or Gabor wavelet) is widely adopted to extract texture features from the images for

image retrieval and has been shown to be very efficient. Manjunath and MA [5] have shown that

image retrieval using Gabor features outperforms that using pyramid-structured wavelet

transform(PWT) features, tree-structured wavelet transform (TWT)features and multiresolution

simultaneous autoregressive model(MR-SAR) features. Basically, Gabor filters are a group of

wavelets, with each wavelet capturing energy at a specific frequency and a specific direction.

Expanding a signal using this basis provides a localized frequency description, therefore

capturing local features/energy of the signal. Texture features can then be extracted from this

group of energy distributions. The scale (frequency) and orientation tunable property of Gabor

filter makes it especially useful for texture analysis.

CONTENT BASED IMAGE RETRIEVAL Page 18

Page 19: Final Doc Cbir

Gabor Filter Formula

The filter has a real and an imaginary component representing orthogonal directions. The two

components may be formed into a complex number or used individually.

Real:

Imaginary:

Where

And

In this equation,λ:represents the wavelength of the sinusoidal factor.θ represents the orientation of the normal to the parallel stripes of a Gabor function.ψ is the phase offset, σ is the sigma of the Gaussian envelope.γ is the spatial aspect ratio, and specifies the ellipticity of the support of the Gabor function.

CONTENT BASED IMAGE RETRIEVAL Page 19

Page 20: Final Doc Cbir

Fig.2.6 Demonstration of a Gabor filter applied to Chinese character. Four orientations are

shown on the right 0°, 45°, 90° and 135°. The original character picture and the superposition of

all four orientations are shown on the left.

CONTENT BASED IMAGE RETRIEVAL Page 20

Page 21: Final Doc Cbir

Matlab Implementation of Gabor Filter

functiongb=gabor_fn(sigma,theta,lambda,psi,gamma)

sigma_x = sigma;sigma_y = sigma/gamma;

% Bounding boxnstds = 3;xmax = max(abs(nstds*sigma_x*cos(theta)),abs(nstds*sigma_y*sin(theta)));xmax = ceil(max(1,xmax));ymax = max(abs(nstds*sigma_x*sin(theta)),abs(nstds*sigma_y*cos(theta)));ymax = ceil(max(1,ymax));xmin = -xmax; ymin = -ymax;[x,y] = meshgrid(xmin:xmax,ymin:ymax);

% Rotation x_theta=x*cos(theta)+y*sin(theta);y_theta=-x*sin(theta)+y*cos(theta);

gb= 1/(2*pi*sigma_x *sigma_y) * exp(.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi)

CONTENT BASED IMAGE RETRIEVAL Page 21

Page 22: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 22

Page 23: Final Doc Cbir

Working of the project

CBIR provides the retrieval of the digital images similar to the query image from the large

storage of the database according to their content.

When user gives the query image Gabor transform is applied over the image.

Features (Mean, Entropy & Standard Deviation) of the transformed are calculated.

Next the query image is split into R, G and B plane.

Features (Mean, Entropy & Standard Deviation) of each plane are calculated again.

Query image is then transformed with discrete wavelet Transform (DWT) 1-level.

Again, the features of the each component of transformed image are calculated.

Now the same procedure is applied on each image of the database.

The Feature Vector of the database images (Fd) is obtained.

The Feature Vector of the query image (Fq) is obtained.

Similarity measurement using Euclidean distance is done between the feature vectors of

database & query image.

Images whose distance is more than the predefined threshold is retrieved from the image

database.

The following diagram shows the working of the system.

CONTENT BASED IMAGE RETRIEVAL Page 23

Page 24: Final Doc Cbir

Fig.3.1 Overview of CBIR System

The diagram above describes the overview of the Content Based Image Retrieval (CBIR) system. Each block of the figure describes a particular process in the system. As shown in the figure all the feature vectors of the images are stored in the databases called as the feature database, the corresponding feature vectors of query image is extracted and it is compared with all the feature vectors stored in the database using a suitable similarity measurement technique and relevant images are retrieved on the basis of predefined threshold.

CONTENT BASED IMAGE RETRIEVAL Page 24

Page 25: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 25

Page 26: Final Doc Cbir

Fig.3.2 Flow Diagram of CBIR System

CONTENT BASED IMAGE RETRIEVAL Page 26

Page 27: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 27

Page 28: Final Doc Cbir

Methodology

Iterative Enhancement Model:

Iterative and Incremental development is a cyclic software development process developed in

response to the weaknesses of the waterfall model. It starts with an initial planning and ends with

deployment with the cyclic interaction in between.

Fig 4.1 Iterative Model

Incremental development is a scheduling and staging strategy, in which the various parts of the

system are developed at different times or rates, and integrated as they are completed. It does not

imply, require nor preclude iterative development or waterfall development - both of those are

rework strategies. The alternative to incremental development is to develop the entire system

with “big bang” integration.

Iterative development is a rework scheduling strategy in which time is set aside to revise and

improve parts of the system. It does not presuppose incremental development, but works very

well with it. A typical difference is that the output from an increment is not necessarily subject to

further refinement, and it’s testing or user feedback is not used as input for revising the plans or

specifications of the successive increments. On the contrary, the output from iteration is

examined for modification, and especially for revising the targets of the successive iterations.

CONTENT BASED IMAGE RETRIEVAL Page 28

Page 29: Final Doc Cbir

Hardware and Software Requirement

For every successful project proper use of its resources is the major factor. For the

success of software projects proper intelligent use of the available hardware and software is

important.

Hardware Requirement:

Processor-Pentium IV

RAM -512 MB or more.

Hard Disk of 40 GB

Monitor

Software Requirement:

Matlab 9.0

CONTENT BASED IMAGE RETRIEVAL Page 29

Page 30: Final Doc Cbir

Gantt Chart

Project development

Step August September October November December January

Requirement & specification

Analysis &

Research

Coding

System Testing

Writing Manual

Fig.4.2 Gantt chart

The above Gantt chart shows the development life cycle of the proposed system. It shows the

allotted time for each phase of the cycle and the actual time taken to go through a phase.

CONTENT BASED IMAGE RETRIEVAL Page 30

Planed Duration Actual Duration

Page 31: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 31

Page 32: Final Doc Cbir

Matlab

MATLAB is a high-performance language for technical computing. It integrates

computation, visualization, and programming in an easy-to-use environment where problems and

solutions are expressed in familiar mathematical notation.

MATLAB is an interactive system whose basic data element is an array that does not require

dimensioning. This allows you to solve many technical computing problems, especially those

with matrix and vector formulations.

The MATLAB system consists of five main parts:

Development Environment: -This is the set of tools and facilities that help you use MATLAB

functions and files.

The MATLAB Mathematical Function Library:- This is a vast collection of computational

algorithms ranging from elementary functions to more sophisticated functions.

The MATLAB Language:-This is a high-level matrix/array language with control flow

statements, functions, data structures, input/output, and object-oriented programming features.

Graphics: - MATLAB has extensive facilities for displaying vectors and matrices as graphs, as

well as annotating and printing these graphs. It includes high-level and low-level functions.

The MATLAB Application Program Interface (API):- This is a library that allows you to

write C and FORTRAN programs that interact with MATLAB.

CONTENT BASED IMAGE RETRIEVAL Page 32

Page 33: Final Doc Cbir

To work with MATLAB implementations on several different computer systems, or need to

transmit MATLAB applications to users on other systems. MATLAB applications consist of M-

files containing functions and scripts, and MAT-files containing binary data. Both types of files

can be transported directly between machines: M-files because they are platform independent

and MAT-files because they contain a machine signature in the file header. MATLAB checks the

signature when it loads a file and, if a signature indicates that a file is foreign, performs the

necessary conversion.

CONTENT BASED IMAGE RETRIEVAL Page 33

Page 34: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 34

Page 35: Final Doc Cbir

Query Image

Fig.6.1 Query Image

Fetched Image

Fig.6.2 Fetched Image

CONTENT BASED IMAGE RETRIEVAL Page 35

Page 36: Final Doc Cbir

Query Image

Fig.6.3 Query Image

Fetched Image

Fig.6.4 Fetched Image

CONTENT BASED IMAGE RETRIEVAL Page 36

Page 37: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 37

Page 38: Final Doc Cbir

Testing

Software Testing is a process of evaluating a system.

by manual or automatic means

verify that the system satisfies the specified requirement

identify differences between expected and actual results

Testing analyzes a program with the intent of finding problems and errors that measures system

functionality and quality. Testing includes inspection and structured peer reviews of requirement

and design, as well as execution test of code. The code developed during coding activity is likely

to have some requirement errors and design errors in addition to the errors introduced during the

coding activity. Testing perform a very critical role for quality assurance and for ensuring the

reliability of software. The system must be tested to evaluate the actual system functionality.

The two basic approaches to testing are:

Black Box or Functional Testing.

White Box or Structural Testing.

White Box Testing:

White Box Testing is related with structure of the program. To test the logic of the program

various test cases are design which takes care of following:

o Every statement in the program is examined at least once.

o Every path in the program is executed at least once.

o Every logical decision is executed on their true or false side.

o Execute all their loops all their boundaries and within operational boundaries.

o Execute internal data structure and formulae to ensure their validity.

o This type of testing is performed by Developers.

CONTENT BASED IMAGE RETRIEVAL Page 38

Page 39: Final Doc Cbir

White box testing for the system is performed as follows:

Module wise Unit Testing is done.

All the matlab functions are cross-examined and tested.

And if any error occurs an appropriate message is thrown.

Black Box Testing:

o BBT is related with input and output and not related with internal structure of the

program.

o In BBT it is checked if some input is given than whether specific output is produce by the

program or not.

o The various sets of input test cases are prepared and applied on a program corresponding

output are verified.

o This type of testing is done Test Engineers.

Five-five images of each category are tested at threshold 20 and the result is summarized in the

following tables with their average.

In information retrieval contexts, precision and recall are defined in terms of a set of retrieved

documents (e.g. the list of documents produced by a web search engine for a query) and a set of

relevant documents (e.g. the list of all documents on the internet that are relevant for a certain

topic).

Precision:

In the field of information retrieval, precision is the fraction of retrieved documents that are relevant to the search:

CONTENT BASED IMAGE RETRIEVAL Page 39

Page 40: Final Doc Cbir

Recall:

Recall in Information Retrieval is the fraction of the documents that are relevant to the query that are successfully retrieved.

Precision can be seen as a measure of exactness or fidelity, whereas recall is a measure of

completeness.

Fig.5.1 Four Possible Outcomes of the CBIR Experiment

The following tables show the Precision and Recall for each category of the images.

CONTENT BASED IMAGE RETRIEVAL Page 40

Page 41: Final Doc Cbir

Test case 1: With RGB program

Table 5.1.1 Precision & Recall of Bus category

Table 5.1.2 Precision & Recall of Dinosaur category

CONTENT BASED IMAGE RETRIEVAL Page 41

Category BusImage Name

Precision Recall Precision Percentage

Recall Percentage

1.jpg 1.00 0.22 100% 22%3.jpg 1.00 0.08 100% 8%25.jpg 0.69 0.185 69% 8%44.jpg 0.50 0.06 50% 6%39.jpg 0.67 0.12 67% 12%

Average0.772 0.2664 77.2% 26.64%

Category DinosaurImage Name Precision Recall Precision

PercentageRecall Percentage

51.jpg 1.00 0.58 100% 58%54.jpg 1.00 0.44 100% 44%56.jpg 1.00 0.50 100% 50%94.jpg 1.00 0.18 100% 18%95.jpg 1.00 0.12 100% 12%Average 1.00 0.364 100% 36.4%

Category BeachImage Name

Precision Recall Precision Percentage

Recall Percentage

143.jpg 0.5 0.06 50% 6%141.jpg 1.00 0.08 100% 8%131.jpg 0.67 0.08 67% 8%135.jpg 0.75 0.06 75% 6%120.jpg 0.36 0.10 36% 10%Average 0.656 0.076 65.6 7.6

Page 42: Final Doc Cbir

Table 5.1.3 Precision & Recall of Beach category

Table 5.1.4 Precision & Recall of Rose category

CONTENT BASED IMAGE RETRIEVAL Page 42

Category RoseImage Name

Precision Recall Precision Percentage

Recall Percentage

151.jpg 1.00 0.10 100% 10%155.jpg 1.00 0.08 100% 8%157.jpg 0.60 0.06 60% 6%164.jpg 1.00 0.06 100% 6%186.jpg 1.00 0.08 100% 8%Average 0.92 0.076 92% 7.6%

Category HorseImage Name

Precision Recall Precision Percentage

Recall Percentage

203.jpg 1.00 0.20 100% 20%207.jpg 1.00 0..18 100% 18%209.jpg 1.00 0.20 100% 20%212.jpg 1.00 0.06 100% 6%240.jpg 1.00 0.04 100% 4%Average 1.00 0.136 100% 13.6%

Page 43: Final Doc Cbir

Table 5.1.5 Precision & Recall of Horse category

Table 5.1.6 Precision & Recall of Elephant category

Table 5.1.7 Precision & Recall of Mountain category

CONTENT BASED IMAGE RETRIEVAL Page 43

Category ElephantImage Name

Precision Recall Precision Percentage

Recall Percentage

251.jpg 0.45 0.10 45% 10%253.jpg 1.00 0.06 100% 6%258.jpg 0.75 0.06 75% 6%263.jpg 0.5625 0.18 56.25% 18%270.jpg 0.714 0.10 71.4% 10%Average 0.6953 0.10 69.53% 10%

Category MountainImage Name

Precision Recall Precision Percentage

Recall Percentage

301.jpg 1.00 0.04 100% 4%303.jpg 0.60 0.12 60% 12%306.jpg 0.50 0.04 50% 4%320.jpg 0.714 0.10 71.4% 10%335.jpg 1.00 0.04 100% 4%Average 0.7628 0.068 76.28% 6.8%

Category Taj MahalImage Name

Precision Recall Precision Percentage

Recall Percentage

351.jpg 0.40 0.04 40% 4%353.jpg 0.7333 0.22 73.33% 22%355.jpg 0.4444 0.28 44.44% 28%360.jpg 0.76 0.38 76% 38%378.jpg 1.00 0.10 100% 10%Average 0.6675 0.204 66.75% 204%

Page 44: Final Doc Cbir

Table 5.1.8 Precision & Recall of Taj category

Test case 2: With DWT & RGB program

Table 5.2.1 Precision & Recall of Bus category

Category DinosaurImage Name

Precision Recall Precision Percentage

Recall Percentage

51.jpg 1.00 0.56 100% 56%54.jpg 1.00 0.44 100% 44%56.jpg 1.00 0.44 100% 44%94.jpg 1.00 0.18 100% 18%95.jpg 1.00 0.12 100% 12%

CONTENT BASED IMAGE RETRIEVAL Page 44

Category BusImage Name

Precision Recall Precision Percentage

Recall Percentage

1.jpg 1.00 0.22 100% 22%3.jpg 1.00 0.06 100% 6%25.jpg 0.75 0.18 75% 18%44.jpg 1.00 0.06 100% 6%39.jpg 0.66 0.12 66% 12%Average 0.882 0.128 88.2% 12.8%

Page 45: Final Doc Cbir

Average 1.00 0.348 100% 34.8%

Table 5.2.2 Precision & Recall of Dinosaur category

Category BeachImage Name

Precision Recall Precision Percentage

Recall Percentage

143.jpg 1.00 0.06 100% 6%141.jpg 1.00 0.08 100% 8%131.jpg 0.75 0.06 75% 6%135.jpg 1.00 0.06 100% 6%120.jpg 0.307 0.08 30.7% 8%Average 0.8114 0.068 81.14% 6.8%

Table 5.2.3 Precision & Recall of Beach category

Table 5.2.4 Precision & Recall of Rose category

CONTENT BASED IMAGE RETRIEVAL Page 45

Category RoseImage Name

Precision Recall Precision Percentage

Recall Percentage

151.jpg 1.00 0.02 100% 2%155.jpg 1.00 0.08 100% 8%157.jpg 0.75 0.06 75% 6%164.jpg 1.00 0.06 100% 6%186.jpg 0.80 0.08 80% 8%Average 0.91 0.078 91% 7.8%

Page 46: Final Doc Cbir

Table 5.2.5 Precision & Recall of Horse category

Category ElephantImage Name Precision Recall Precision

PercentageRecall Percentage

251.jpg 0.44 0.08 44% 8%253.jpg 1.00 0.06 100% 6%258.jpg 1.00 0.06 100% 6%263.jpg 0.5625 0.18 56.25% 18%270.jpg 1.00 0.01 100% 1%Average 0.8005 0.078 80.05 7.8

Table 5.2.6 Precision & Recall of Elephant category

CONTENT BASED IMAGE RETRIEVAL Page 46

Category HorseImage Name Precision Recall Precision

PercentageRecall Percentage

203.jpg 1.00 0.16 100% 16%207.jpg 1.00 0.16 100% 16%209.jpg 1.00 0.20 100% 20%212.jpg 1.00 0.06 100% 6%240.jpg 1.00 0.04 100% 4%Average 1.00 0.124 100% 12.4%

Page 47: Final Doc Cbir

Table 5.2.7 Precision & Recall of Mountain category

Category Taj MahalImage Name Precision Recall Precision

PercentageRecall Percentage

353.jpg 0.733 0.289 73.3% 28.9%351.jpg 0.50 0.05 50% 5%355.jpg 0.666 0.368 66.6% 36.8%360.jpg 0.76 0.50 76% 50%378.jpg 1.00 0.131 100% 13.1%Average 0.7318 0.2676 73.18% 26.76%

Table 5.2.8 Precision & Recall of Taj Mahal category

CONTENT BASED IMAGE RETRIEVAL Page 47

Category MountainImage Name

Precision Recall Precision Percentage

Recall Percentage

301.jpg 1.00 0.04 100% 4%303.jpg 1.00 0.12 100% 12%306.jpg 1.00 0.04 100% 4%320.jpg 1.00 0.08 100% 8%335.jpg 1.00 0.04 100% 4%Average 1.00 0.064 100% 6.4%

Page 48: Final Doc Cbir

Test case 3: With Gabor+DWT+RGB

program

Table 5.3.1 Precision & Recall of Bus category

CONTENT BASED IMAGE RETRIEVAL Page 48

Category BusImage Name

Precision Recall Precision Percentage

Recall Percentage

1.jpg 1.00 0.22 100% 22%3.jpg 1.00 0.08 100% 8%25.jpg 0.75 0.18 75% 18%44.jpg 1.00 0.06 100% 6%39.jpg 0.67 0.06 67% 6%Average 0.884 0.12 88.4% 12%

Page 49: Final Doc Cbir

Table 5.3.2 Precision & Recall of Dinosaur category

Table 5.3.3 Precision & Recall of Beach category

CONTENT BASED IMAGE RETRIEVAL Page 49

Category Dinosaur

Image Name

Precision Recall Precision Percentage

Recall Percentage

51.jpg 1.00 0.56 100% 56%

54.jpg 1.00 0.44 100% 44%

56.jpg 1.00 0.44 100% 44%

94.jpg 1.00 0.18 100% 18%

95.jpg 1.00 0.12 100% 12%

Average 1.00 0.348 100% 38.4%

Category BeachImage Name

Precision Recall Precision Percentage

Recall Percentage

143.jpg 1.00 0.06 100% 6%141.jpg 1.00 0.08 100% 8%131.jpg 0.75 0.06 75% 6%135.jpg 1.00 0.06 100% 6%120.jpg 0.367 0.08 30.76% 8%Average 0.81152 0.068 81.152% 6.8%

Category RoseImage Name

Precision Recall Precision Percentage

Recall Percentage

151.jpg 1.00 0.10 100% 10%155.jpg 1.00 0.08 100% 8%157.jpg 0.75 0.06 75% 6%164.jpg 1.00 0.06 100% 6%186.jpg 1.00 0.08 100% 8%Average 0.95 0.076 95% 7.6%

Page 50: Final Doc Cbir

Table 5.3.4 Precision & Recall of Rose category

Table 5.3.5 Precision & Recall of Horse category

Category ElephantImage Name

Precision Recall Precision Percentage

Recall Percentage

251.jpg 0.4444 0.08 44.44% 8%253.jpg 1.00 0.06 100% 6%258.jpg 1.00 0.06 100% 6%263.jpg 0.5333 0.16 53.33% 16%270.jpg 1.00 0.10 100% 10%Average 0.7955 0.092 79.55% 9.2%

CONTENT BASED IMAGE RETRIEVAL Page 50

Category HorseImage Name

Precision Recall Precision Percentage

Recall Percentage

203.jpg 1.00 0.16 100% 16%207.jpg 1.00 0.16 100% 16%209.jpg 1.00 0.20 100% 20%212.jpg 1.00 0.06 100% 6%240.jpg 1.00 0.04 100% 4%Average 1.00 0.124 100% 12.4%

Page 51: Final Doc Cbir

Table 5.3.6 Precision & Recall of Elephant category

Table 5.3.7 Precision & Recall of Mountain category

Table 5.3.8 Precision & Recall of Taj Mahal category

CONTENT BASED IMAGE RETRIEVAL Page 51

Category MountainImage Name

Precision Recall Precision Percentage

Recall Percentage

301.jpg 1.00 0.04 100% 4%303.jpg 1.00 0.12 100% 12%306.jpg 1.00 0.04 100% 4%320.jpg 1.00 0.08 100% 8%335.jpg 1.00 0.04 100% 4%Average 1.00 0.068 100% 6.4%

Category Taj MahalImage Name

Precision Recall Precision Percentage

Recall Percentage

353.jpg 0.733 0.289 73.3% 28.9%351.jpg 0.50 0.05 50% 5%355.jpg 0.666 0.368 66.6% 36.8%360.jpg 0.76 0.50 76% 50%378.jpg 1.00 0.131 100% 13.1%Average 0.7318 0.2676 73.18% 26.76%

Page 52: Final Doc Cbir

The following chart shows the average Precision vs. Recall for each category based on the above

table.

Chart 5.2.1 Using RGB program

CONTENT BASED IMAGE RETRIEVAL Page 52

Page 53: Final Doc Cbir

Chart 5.2.2 Using DWT + RGB

Chart 5.2.3 Using GABOR+DWT+RGB

CONTENT BASED IMAGE RETRIEVAL Page 53

Page 54: Final Doc Cbir

After detail analysis of above charts a conclusion can be drawn that the precision value

is more for Gabor Wavelet that the system responded well for Gabor wavelet as compared to

the other two methods.

CONTENT BASED IMAGE RETRIEVAL Page 54

Page 55: Final Doc Cbir

Cost Estimation

Introduction:

Also known as the Economic Feasibility.

For a given set of requirements it is desirable to know how much it will cost to

develop the software to satisfy the given requirements, and how much time does it

take to develop.

These estimates are needed before development is initialized.

The primary reason for cost and schedule estimation is to enable the client or

developer to perform a cost benefit analysis and for project monitoring and control.

Cost in a project is due to the requirements of Hardware, Software, and Human

Resources.

o Hardware resources, like computer time, memory required.

o Software resources include tools and compilers during development.

o The bulk of the cost of software development is due to the human resources

needed.

Factors that affect the cost are:

CONTENT BASED IMAGE RETRIEVAL Page 55

Page 56: Final Doc Cbir

o Size of the project

o Complexity of the project

o Reliability of the project

o Programmer’s ability

o Experience of the developers in this area.

Cost Estimation Using Model:

The cost of the project can be estimated using Constructive Cost Model (COCOMO)

developed by Bochm.

The basic steps in this model are:-

A] Obtain an initial estimate of the development effort from the estimate of thousand of delivered lines of source code (KDLOC). Initial estimate also known as the nominal estimate is

determined by an equation where KDLOC is used to measure size. To determine the initial effort

Ei in Person-Month the equation is:

Ei = a * (KDLOC) b, value of a and b depends on the project type

COCOMO projects are categorized into three types:

i. Organic: Suitable for organization that has considerable experience and requirements

ii. Semidetached: Examples of this type are developing new database management

system.

iii. Embedded: Organization has little experience and stringent requirements.

The value a and b according to Organic System is

a = 3.2 and b = 1.05

The project will fall in the organic category.

The size of the different modules and the overall system are estimated to be:

CONTENT BASED IMAGE RETRIEVAL Page 56

Page 57: Final Doc Cbir

Total Line of Code (LOC) =353

Ei = a * (KDLOC) b = 3.2 * 3.53 * 1.05 = 11.86PM

B]Determine a set of 15 multiplying factors from different attributes of the project.

There are 15 different attributes called cost driver attribute that determine the multiplying

factors.

These factors depends on product, computer, personnel and technology attributes (called

project attributes)

Eg: of the attribute are required software reliability (RELY), product complexity (CPLX),

analyst capability (ACAP) application experience development schedule (SCHD).

Cost Drivers

RatingsVery Low Low Nominal High

Very High

Extra High

Product attributesRequired software reliability 0.75 0.88 1.00 1.15 1.40  Size of application database   0.94 1.00 1.08 1.16  Complexity of the product 0.70 0.85 1.00 1.15 1.30 1.65Hardware attributesRun-time performance constraints     1.00 1.11 1.30 1.66Memory constraints     1.00 1.06 1.21 1.56Volatility of the virtual machine environment   0.87 1.00 1.15 1.30  Required turnabout time   0.87 1.00 1.07 1.15  Personnel attributesAnalyst capability 1.46 1.19 1.00 0.86 0.71  Applications experience 1.29 1.13 1.00 0.91 0.82  Software engineer capability 1.42 1.17 1.00 0.86 0.70  Virtual machine experience 1.21 1.10 1.00 0.90    Programming language experience 1.14 1.07 1.00 0.95    Project attributesUse of software tools 1.24 1.10 1.00 0.91 0.82  Application of software engineering methods 1.24 1.10 1.00 0.91 0.83  Required development schedule 1.23 1.08 1.00 1.04 1.10  

CONTENT BASED IMAGE RETRIEVAL Page 57

Page 58: Final Doc Cbir

The multiplying factors for all 15 cost drivers are multiplied to get the effort adjustment factors

(EAF):

EAF = 1.15 * 1.00 * 1.00 * 1.30 * 1.21 * 1.15 * 1.07 * 1.00 * 1.00 * 1.00 * 1.00 * 1.00 * 1.00

* 1.00 * 1.08

= 2.4040

C] Adjust the effort estimate by multiplying the initial estimate with all the multiplying factors.

The Final effort estimate E, is obtained by multiplying the initial estimate by the EAF.

E = EAF * Ei

Using the EAF the adjusted effort estimate is E = 2.4040 * 11.86= 28.51Person- Month =

29PM (approx.)

We take the assumption each person charges 1000 rupees per day.

Total Estimation: 1000 * 29 = Rs. 29,000.

CONTENT BASED IMAGE RETRIEVAL Page 58

Page 59: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 59

Page 60: Final Doc Cbir

Limitation of the System

Image analysis is very memory-intensive, so the program will run faster and more

effectively on machines with more RAM available.

Doesn’t work on shapes.

Threshold values need to be adjusted for images belonging to different category.

Doesn’t do object recognition.

Future Enhancements

Can be enhanced to include shape parameter.

The project can be enhanced to recognize objects in the images.

The project can be implemented for a huge database.

CONTENT BASED IMAGE RETRIEVAL Page 60

Page 61: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 61

Page 62: Final Doc Cbir

Conclusion

The database selected for CBIR experiments although it includes different categories of images but each category has almost similar images with similar background. In this project database includes 388 images having eight categories. Each of these eight categories includes variety of different images with different colors, shapes, textures and different backgrounds of its own type.

A conclusion can be drawn that Gabor wavelet has provided a better result as compared to other two algorithms. Also even though the database is having variety of images still the system is performing better in terms of precision for all the approaches.

CONTENT BASED IMAGE RETRIEVAL Page 62

Page 63: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 63

Page 64: Final Doc Cbir

Appendix:

List of figure:

Fig 1.1 Multiple ways of displaying Image

Fig 1.2 Examples of Textures

Fig.1.3 Boundary-based & Region-based

Fig.2.1Working of 2D Wavelet Transform

Fig.2.2 Wavelet Decomposition of an image

Fig.2.3 Discrete wavelet transform

Fig.2.4 2-D DWT for Image

Fig.2.5 (A) Original Image

Fig.2.5 (B) 1Level Discrete Wavelet Transform

Fig.2.5(C) 2 Level Discrete Wavelet Transform

Fig.2.6 Demonstration of a Gabor filter applied to Chinese character. Four orientations are

shown on the right 0°, 45°, 90° and 135°. The original character picture and the superposition of

all four orientations are shown on the left.

Fig.3.1 Overview of CBIR System

Fig.3.2 Flow Diagram of the System

Fig 4.1 Iterative Model

Fig.4.2 Gantt chart

Fig.5.1 Four Possible Outcomes of the CBIR Experiment

Fig.6.1 Query Image

Fig.6.2 Fetched Image

Fig.6.3 Query Image

CONTENT BASED IMAGE RETRIEVAL Page 64

Page 65: Final Doc Cbir

Fig.6.4 Fetched Image

List of Charts:

Chart 5.2.1 Using RGB program

Chart 5.2.2 Using DWT + RGB

Chart 5.2.3 Using GABOR+DWT+RGB

List of Tables:

Table 5.1.1 Precision & Recall of Bus category

Table 5.1.2 Precision & Recall of Dinosaur category

Table 5.1.3 Precision & Recall of Beach category

Table 5.1.4 Precision & Recall of Rose category

Table 5.1.5 Precision & Recall of Horse category

Table 5.1.6 Precision & Recall of Elephant category

Table 5.1.7 Precision & Recall of Mountain category

Table 5.1.8 Precision & Recall of Taj category

Table 5.2.1 Precision & Recall of Bus category

Table 5.2.2 Precision & Recall of Dinosaur category

Table 5.2.3 Precision & Recall of Beach category

Table 5.2.4 Precision & Recall of Rose category

Table 5.2.5 Precision & Recall of Horse category

Table 5.2.6 Precision & Recall of Elephant category

Table 5.2.7 Precision & Recall of Mountain category

Table 5.2.8 Precision & Recall of Taj Mahal category

Table 5.3.1 Precision & Recall of Bus category

CONTENT BASED IMAGE RETRIEVAL Page 65

Page 66: Final Doc Cbir

Table 5.3.2 Precision & Recall of Dinosaur category

Table 5.3.3 Precision & Recall of Beach category

Table 5.3.4 Precision & Recall of Rose category

Table 5.3.5 Precision & Recall of Horse category

Table 5.3.6 Precision & Recall of Elephant category

Table 5.3.7 Precision & Recall of Mountain category

Table 5.3.8 Precision & Recall of Taj Mahal category

CONTENT BASED IMAGE RETRIEVAL Page 66

Page 67: Final Doc Cbir

CONTENT BASED IMAGE RETRIEVAL Page 67

Page 68: Final Doc Cbir

Bibliography

Gonsavles R.C. and Woods R.E.: Digital Image Processing, Addison Wesely, 1993. http://www.wikipedia.com/ CBIR Using Kekre’s Transform over Row column Mean and Variance Vectors by Dr.

H. B. Kekre Kavita Sonavane

CONTENT BASED IMAGE RETRIEVAL Page 68