0% found this document useful (0 votes)
181 views

Final Report CBIR Using GUI

project report

Uploaded by

saniya
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
181 views

Final Report CBIR Using GUI

project report

Uploaded by

saniya
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 45

A

PROJECT REPORT
ON
CBIR using GUI

BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION ENGINEERING

Submitted By:
Name: VANDANA MEENA
Id: 2012UEC1246

Industrial Guide
Mr.T.S.Rawat
Sc-E, DTRL lab
DRDO, Delhi

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING


MALAVIYA NATIONAL INSTITUTE OF TECHNOLOGY, JAIPUR
CONTENTS

Certificate of Completion
Acknowledgement
Abstract
About DRDO
About DTRL

Chapter 1 Introduction
1.1Purpose...........................................1
1.2Objective..2
1.3Benefit2
1.4Overview of report....................................2

Chapter 2 Texture
2.1 Textural features...3
2.2 Texture .4

Chapter 3 Wavelet Transform


3.1 What is wavelet transform06
3.2Wavelet families07
3.3 Wavelet transformation.08
3.4 Haar wavelet transform................................09
3.5 Example of haar wavelet transform..10

Chapter 4 CBIR
4.1 What is CBIR13
4.2 CBIR systems13
4.3 Applications of CBIR..14
4.4 CBIR process14
4.5 Euclidean distance .15

Chapter 5 Software Requirement Specification


5.1 Introduction .......................................16
5.2 Problem Motivation....................................17
5.3 Problem Statement....17
5.4 Proposed Solution.17
5.5 Hardware Requirement....................................17
5.6 Software Requirement..17
5.7 Test Data........................................17

Chapter 6 GUI based CBIR system


6.1 How it works..18

Screenshots .21

Appendix
Matlab code for gui based CBIR .26
Matlab code forHaar wavelet feature extraction...30

References32
CERTIFICATE OF COMPLETION

This is to certify that the work contained in the project entitled GUI based CBIR system
carried out by Vandana Meena, student of BACHELOR OF TECHNOLOGY (ECE) 7th SEM,
(ID:2012UEC1246) of Malaviya National Institute of Technology(MNIT) , Jaipur. This
project has been carried out under my supervision . It is a bonafide work done by her
under my guidance.

Mr. T. S. Rawat

Sc-E, DTRL Lab

DRDO, Delhi
ACKNOWLEDGEMENT
I thank my respected guide, Mr. T. S. Rawat, Scientist E-grade, DTRL, DRDO, Ministry of
Defence, Delhi for his guidance and supervision through all the phases of the
development of this project. He encouraged me to gather the professional knowledge
and material for the completion of this project. I thank him for his invaluable and fine
suggestions to give shape and finesse to the work done.

I am thankful to all the teachers, supporting staff for their appreciation and constructive
criticism which has further enhanced the quality of this project. Finally, my family
deserves particular credit and thanks for their patience and encouragement in getting
this project to completion.

I sincerely hope that users will find this project useful. Whatever intellectual effort may
be reflected from this report is the direct result of the informative and stimulating
discussions that I have had in the course of the semester.

Vandana Meena

2012UEC1246

B.Tech (ECE 7th SEM)

MNIT Jaipur
ABSTRACT

The purpose of this project is to describe the research and development on evaluation
of texture based features in image retrieval. This project is based on Wavelet Transform
(Haar Wavelet) approach which provides effective and efficient way to extract features
of an image. These features are used to implement image retrieval technique. The major
steps are feature extraction, image retrieval based on the content of images.

Firstly, Content Based Image Retrieval (CBIR) is done using the image feature set
extracted from Haar Wavelet applied on the image at various levels of decomposition.
Here the database image features are extracted by applying Haar Wavelet on the colored
images. In this we calculate the Energy of the image for image retrieval.

Then, the distances between the features of the query image and the database images is
calculated by using Euclidean Distance. Also the concept of Log Transform is used to
solve the problem of rotation and scaling invariance. Then the images are presented to
the user having the least distances of feature distances.

This concept is used to implement the image retrieval technique i.e CBIR. In CBIR, each
image that is stored in the database has its features extracted and compared to the
features of the query image by using Euclidean distance .
ABOUT DRDO
Defence Research & Development Organization (DRDO)

DRDO works under Department of Defence Research and Development of Ministry of


Defence. DRDO dedicatedly working towards enhancing self-reliance in Defence Systems
and undertakes design & development leading to production of world class weapon
systems and equipment in accordance with the expressed needs and the qualitative
requirements laid down by the three services.

DRDO is working in various areas of military technology which include aeronautics,


armaments, combat vehicles, electronics, instrumentation engineering systems, missiles,
materials, naval systems, advanced computing, simulation and life sciences. DRDO while
striving to meet the Cutting edge weapons technology requirements provides ample
spinoff benefits to the society at large thereby contributing to the nation buliding.

History

Defence Research and Development Organisation (DRDO) was established in 1958 by


amalgamating the Defence Science Organisation and some of the technical development
establishments. A separate Department of Defence Research and Development was
formed in 1980 which later on administered DRDO and its 50
laboratories/establishments.

Most of the time the Defence Research Development Organisation was treated as if it
was a vendor and the Army Headquarters or the Air Headquarters were the customers.
Because the Army and the Air Force themselves did not have any design or construction
responsibility, they tended to treat the designer or Indian industry at par with their
corresponding designer in the world market..DRDO started its first major project in
surface-to-air missiles (SAM) known as Project Indigo in 1960s. Indigo was discontinued
in later years without achieving full success.

Project Indigo led to Project Devil, along with Project Valiant, to develop short-range
SAM and ICBM in the 1970s. Project Devil itself led to the later development of the
Prithvi missile under the Integrated Guided Missile Development Programme (IGMDP) in
the 1980s. IGMDP was an Indian Ministry of Defenceprogramme between the early
1980s and 2007 for the development of a comprehensive range of missiles, including the
Agni missile, Prithvi ballistic missile, Akash missile, Trishul missile and Nag Missile.

In 2010, then defence minister A K Antony ordered the restructuring of the Defence
Research and Development Organisation (DRDO) to give a major boost to defence
research in the country and to ensure effective participation of the private sector in
defence technology. The key measures to make DRDO effective in its functioning include
the establishment of a Defence Technology Commission with the defence minister as its
chairman..DRDO has achieved many successes since its establishment in developing
other major systems and critical technologies such as aircraft avionics, UAVs, small arms,
artillery systems, EW Systems, tanks and armoured vehicles, sonar systems, command
and control systems and missile systems.

Vision

Make India prosperous by establishing world-class science and technology base and
provide our Defence Services decisive edge by equipping them with internationally
competitive systems and solutions.

Mission

Design, develop and lead to production state-of-the-art sensors, weapon systems,


platforms and allied equipment for our Defence Services. Provide technological solutions
to the Defence Services to optimise combat effectiveness and to promote well-being of
the troops. Develop infrastructure and committed quality manpower and build strong
technology base.

Core Competence
Department of Defence Research and Development (R&D) is working for indigenous
development of weapons, sensors & platforms required by the three wings of the Armed
Forces. To fulfill this mandate, Department of Defence Research and Development
(R&D), is closely working with academic institutions, Research and Development (R&D)
Centres and production agencies of Science and Technology (S&T) Ministries/Deptts in
Public & Civil Sector including Defence Public Sector Undertakings & Ordnance Factories.

List of laboratories at DRDO complex ,Metcalfe House ,New Delhi

Defence Institute of Physiology & Allied Sciences (DIPAS), Delhi

Defence Institute of Psychological Research (DIPR), Delhi

Defence Laboratory (DLJ), Jodhpur

Defence Research & Development Establishment (DRDE), Gwalior

Defence Scientific Information & Documentation Centre (DESIDOC), Delhi

Defence Terrain Research Laboratory (DTRL), Delhi

Institute of Nuclear Medicine & Allied Sciences (INMAS), Delhi

Institute of Systems Studies & Analyses (ISSA), Delhi

Laser Science & Technology Centre (LASTEC), Delhi

Scientific Analysis Group (SAG), Delhi

Solid State Physics Laboratory (SSPL), Delhi

ABOUT DEFENCE TERRAIN RESEARCH LABORATORY


Vision and Mission
To become a technological leader in producing high resolution terrain intelligence
products for defence applications.

Develop expertise and technologies for terrain database management. Create and
update thematic maps and terrain intelligence reports for the users.

History

Initiation of terrain evaluation activities in DRDO began with the creation of Terrain
Evaluation Cell (TEC) on 19th February 1964.

In recognition of significance of terrain intelligence, TEC was accorded the status of a


full fledged laboratory on 10th December 1981 and was renamed as Defence Terrain
Research Laboratory.

DTRL was notified as self accounting unit on 17th September 1988.

Areas of Work

Development of a reliable systems for assessment of terrain characteristics through


modern techniques of terrain evaluation for military potential

Trafficabilitystudies and preparation of mobility maps and going routes.

Generation of terrain briefs for its military potential R & D in Landslide Assessment
Management

Disaster assessment and prevention studies.

Terrain parameter extraction using Soft Computing techniques &Image Processing

Geographic Information System (GIS) based development of Decision Support Systems.

Extraction of terrain parameters from satellite/aerial images, and maps.Generation of


task-specific terrain maps.

Artificial Life based models of combat in Complex Terrain Application of Recommender


Systems to land combat
Products

Land use Maps , Landslide Hazard Zonation (LHZ) Maps.

Ground Water Study & Off-road mobility Study and Terrain briefs

Facilities Available

Multigen Software for 3D visualization and 3D modeling of Terrain.

VSAT based Image Reception Terminal to download satellite data..

Mapping instruments for carrying out terrain related studies.

GIS and Image processing tools for generating thematic and derivative terrain maps.

Photogrammetry System for height estimation of terrain.

1. INTRODUCTION

CBIR or Content Based Image Retrieval is the retrieval of images based on visual features
such as colour, texture and shape. Reasons for its development are that in many large
image databases, traditional methods of image indexing have proven to be insufficient,
laborious, and extremely time consuming. These old methods of image indexing, ranging
from storing an image in the database and associating it with a keyword or number, to
associating it with a categorized description, have become obsolete.

In CBIR, each image that is stored in the database has its features extracted and
compared to the features of the query image. It involves two steps

Feature Extraction: The first step in the process is extracting image features to a
distinguishable extent.
Matching: The second step involves matching these features to yield a result that is
visually similar.

1.1 PURPOSE
GLCM proves to be a very good discriminator in studying different images , but GLCM
takes too much time therefore, we use Wavelet Transform (Haar Wavelet).
Texture feature extraction is a key function in various image processing applications,
remote sensing and content-based image retrieval.
Image databases are becoming larger and more widespread, and there is a growing need
for effective and efficient image retrieval (IR) systems.
We need a system which can effectively retrieve the desired image even if the database
is not annotated.
The idea of searching those collections one by one to match manually with what the
user wants (users query) is a nightmare. This is where Content-Based Image Retrieval
(CBIR) comes in to solve the problem.
The information content among different images for a given object is used to select the
set of images that capture the characteristics of object in the image.

1.2 OBJECTIVE
The aim of this project is to implement Wavelet (Haar) features and use this as
similarity/dissimilarity measure on a given database and retrieve similar image from our
image retrieval system. Using this we develop an application in MATLAB with MS Excel
database connectivity
1.3 BENEFIT
The project help in extraction of the textural features of a query image and compare
them to those of the database images. Thus, using matching and comparison, the
textural features of the query image given by the user are compared or matched to the
corresponding features of images in the database and shown to the user as result. Thus,
similar images can be efficiently retrieved and provided to the user.

1.4 OVERVIEW OF REPORT


This report is divided into three main sections. The first section deals with a general
introduction to CBIR. The second section provides theoretical information about the
concepts used and topics mentioned in the project. The third deals with the technical
part which is a full explanation of the algorithms used, and how they work.

2. TEXTURE

2.1 TEXTURAL FEATURES


Texture is one of the significant features of an image that has been used in various fields
such as medical image analysis, image retrieval and security systems etc. In general way,
we can say that textures are the complex visual patterns that may contain the sub-
pattern having some characteristics of an object given by size, shape, density and color.
Texture features can be extracted through several methods like spatial domain and
spectral domain.

Fig 2.1Textural Feature Extraction Approaches

2.2 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
Roughness

Fig 2.2 Types of textures (Brodatz Database)


Fig 2.3 Classification of textures
3. WAVELET TRANSFORM

3.1 WHAT IS WAVELET TRANSFORM??


A wavelet is a wave-like oscillation that is localized in the sense that it grows from zero,
reaches a maximum amplitude, and then decreases back to zero amplitude again. It thus
has a location where it maximizes, a characteristic oscillation period, and also a scale
over which it amplifies and declines. Wavelet analysis developed in the largely
mathematical literature in the 1980's and began to be used commonly in geophysics in
the 1990's.

Wavelets can be used in signal analysis, image processing and data compression. They
are useful for sorting out scale information, while still maintaining some degree of time
or space locality. Wavelets are used to compress and store fingerprint information by the
FBI. Because the wavelet and scaling functions are obtained by scaling and translating
one or two "mother functions", time-scale wavelets are particularly appropriate for
analyzing fields .

Fig 3.1 Time Domain, Frequency Domain and Time Frequency (wavelet) Domain

Wavelet provides time frequency representation simultaneously.


It provides variable resolution as follows At high frequency wavelet transform gives
good time resolution and poor frequency resolution and At low frequency wavelet
transform gives good frequency resolution and poor time resolution.

There are five types of wavelets:

1) Continuous Wavelet Transform

2) Discrete Wavelet Transform

3) Fast wavelet transform (FWT)

4) Wavelet packets

5) Complex wavelet Transform

3.2 WAVELET FAMILIES

Fig 3.2 Different wavelet families


3.3 WAVELET TRANSFORMATION
Wavelet transforms provide a multi-resolution approach to texture analysis and
classification. The computation of the wavelet transforms of a two-dimensional signal
involves recursive filtering and sub-sampling. At each level, the signal is decomposed
into four frequency sub-bands, LL, LH, HL, and HH, where L denotes low frequency and H
denotes high frequency.

LL

LL LH
HL HH
Fig 3.3 Level 1 of the 2D wavelet transform

3.4 HAAR WAVELET TRANSFORM

Haar transforms was developed by Alfred Haar in 1909. Haar transforms are possibly the
simplest wavelet basis consisting of square shaped functions []. It represents the
functions in an ortho normal function basis as in Fourier analysis. The Haar transform,
transforms signals from the space domain to a local frequency domain. A Haar wavelet
decomposes an image using both low-pass filtering and high-pass filtering, working first
on image columns and then on image rows.
If a data set, contains N elements, there will be N/2 averages and N/2 wavelet coefficient
values. The averages are stored in the first half of the N element array, and the
coefficients are stored in the second half of the N element array. The averages become
the input for the next step in the wavelet calculation.
The Haar equations to calculate an average and a wavelet coefficient from an odd and
even element in the data set are

X i+ X i+ 1
ai =
2

X i X i+ 1
c i=
2

Steps for a 1D Haar transform:


1. Find the average of each pair of elements using Equation 1. (N/2 averages)
2. Find the difference between each pair of elements and divide it by 2. (N/2
coefficients)
3. Fill the first half of the array with averages.
4. Fill the second half of the array with coefficients.
5. Repeat the process on an average part of the array until a single average and a single
coefficient are calculated.

Steps for a 2DHaar transform:


1. Compute 1D Haar wavelet decomposition of each row of the original pixel values.
2. Compute 1D Haar wavelet decomposition of each column of the row-transformed
pixels.
Red, green and blue values are extracted from the images. Then we apply the 2D Haar
transform to each color matrix.

3.5 EXAMPLE OF HAAR WAVELET


Suppose we are given a 1D "image" with a resolution of 4 pixels:

[9 7 3 5]

The Haar wavelet transform is the following:

[ 6 2 1 -1]
L0 D1 D2 D3

Start by averaging the pixels together (pairwise) to get a new lower resolution image:

[9 7 3 5][8 4] (averaged&subsampled)
To recover the original four pixels from the two averaged pixels, store some detail
coefficients

ResAovlDeutiratogneilscoefficients

4 [84]
2 [9713-5]

Repeating this process on the averages (i.e., low resolution image) gives the full decomposition:
ResAovlDeuertiatoganeilscoefficients

2 [9 [723] 5]
4 [8 [41] -1]
4 [6][

Haar Decomposition [6 2 1 -1]


We can reconstruct the original image by adding or subtracting the detail coefficients
from the lower-resolution versions

2 1 -1
[6 2 1 -1] [8 4] [9 7 3 5]
Fig 3.4.1 2D Haar Transformation

Fig 3.4.2 2D Haar transformation (a) original image (b) different parts of 2D Haar
transformation
4. CONTENT BASED IMAGE RETRIEVAL

4.1 WHAT IS CBIR


CBIR or Content Based Image Retrieval is the retrieval of images based on visual
features such as color, texture and shape. Reasons for its development are that in many
large image databases, traditional methods of image indexing have proven to be
insufficient, laborious, and extremely time consuming. These old methods of image
indexing, ranging from storing an image in the database and associating it with a
keyword or number, to associating it with a categorized description, have become
obsolete.
In CBIR, each image that is stored in the database has its features extracted and
compared to the features of the query image. It involves two steps :
Feature Extraction: The first step in the process is extracting image features to a
distinguishable extent.
Matching: The second step involves matching these features to yield a result that is
visually similar.

Fig 4.1Block Diagram showing CBIR


Content-based image retrieval (CBIR)is an image search technique where images are
selected from an image database by using a reference image rather than metadata, such
as keywords, tags and descriptions associated with that image.Here, input for the search
is an image, and the output is similar images from the database.

4.2 CBIR SYSTEMS


Several CBIR systems currently exist, and are being constantly developed. Examples are
QBIC or Query By Image Content was developed by IBM, Almaden Research Centre, to
allow users to graphically pose and refine queries based on multiple visual properties
such as color, texture and shape It supports queries based on input images, user-
constructed sketches, and selected color and texture patterns
VIR Image Engineby Virage Inc., like QBIC, enables image retrieval based on primitive
attributes such as colour, texture and structure. It examines the pixels in the image and
performs an analysis process, deriving image characterization features.
VisualSEEK and WebSEEK were developed by the Department of Electrical Engineering,
Columbia University. Both these systems support color and spatial location matching as
well as texture matching.
NeTra was developed by the Department of Electrical and Computer Engineering,
University of California. It supports color, shape, spatial layout and texture matching, as
well as image segmentation.
MARS or Multimedia Analysis and Retrieval System was developed by the Beckman
Institute for Advanced Science and Technology, University of Illinois. It supports color,
spatial layout, texture and shape matching.

4.3 APPLICATIONS OF CBIR


Crime prevention: Automatic face recognition systems, used by police forces.
Security Check: Finger print or retina scanning for access privileges.
Medical Diagnosis: Using CBIR in a medical database of medical images to aid diagnosis
by identifying similar past cases.
Intellectual Property: Trademark image registration, where a new candidate mark is
compared with existing marks to ensure no risk of confusing property ownership

4.4 CBIR PROCESS


Most CBIR systems work in the same way.

A feature vector is extracted from each image in the database and the set of all feature
vectors is organized as a database index.

When similar images are searched with a query image, a feature vector is extracted from
the query image and is matched against the feature vectors in the index.

Differences between the various systems lie in the features they extract and the
algorithms used to extract those features.

4.5 EUCLIDEAN DISTANCE


Distance measurement between feature vectors of query image and database

The texture based features are extracted from the database images and stored in a
feature database. Similarly, the texture based features are extracted from the query
image and the query image features are compared with the database image features
using the distance measure.

Images having the least distance with query image are displayed as the result.

Euclidean Distance The Euclidean distance is the straight-line distance between two
pixels. Euclidean distance is used to match extracted features of query image with the
feature database and then finds the images where features are matching with feature
database images after matching it sorts out images which are having shortest distance
from the query image and gives us the relevant images.

If Vp and Vq are 2D feature vectors of database image and query image respectively .
Then the distance metrics are defined as follows

n
ED= ( V pi V qi ) .(V pi V qi )
i=1
5. SYSTEM REQUIREMENT SPECIFICATION

5.1 INTRODUCTION
The SRS is a technical specification of requirements for the software products. The goal
of software requirement definition is to completely and consistently specify the
technical requirements for the software product in a concise and unambiguous manner.

Thus, the purpose of this document is to describe the external requirements for the
evaluation of texture based features in image retrieval.

The scope of this SRS document encompasses the following: -

It serves as a good reference to study, analyze and understand the need for the
development of image retrieval techniques for images and dimensionality reduction for
hyperspectral images.

It acts as a verification tool for the final specification.

The functionalities derived from the requirement analysis and mentioned in this
document are further refined in the design phase.

5.2 PROBLEM MOTIVATION


Image databases and collections can be enormous in size, containing hundreds,
thousands or even millions of images. The conventional method of image retrieval is
searching for a keyword that would match the descriptive keyword assigned to the
image by a human categorizer. Currently under development, even though several
systems exist, is the retrieval of images based on their content, called Content Based
Image Retrieval, CBIR. While computationally expensive, the results are far more
accurate than conventional image indexing. Hence, there exists a tradeoff between
accuracy and computational cost. This tradeoff decreases as more efficient algorithms
are utilized and increased computational power becomes inexpensive.
5.3 PROBLEM STATEMENT
The problem involves entering an image as a query into a software application that is
designed to employ CBIR techniques in extracting visual properties, and matching them.
This is done to retrieve images in the database that are visually similar to the query
image.

5.4 PROPOSED SOLUTION


The solution initially proposed was to extract the primitive features of a query image and
compare them to those of database images. The image feature under consideration is
texture. Thus, using matching and comparison algorithms, the texture feature of one
image is compared to the corresponding features of another image. This comparison is
performed using texture distance metric. In the end, these metric is performed, so as to
retrieve database images that are similar to the queryimage . The similarity between
features is calculated usingEucledian Distance

5.5 HARDWARE REQUIREMENT


Parameters Value
RAM Minimum 2GB

Minimum space Depending on the number of images to be stored.


on hard disk

5.6 SOFTWARE REQUIREMENT


Front End: MATLAB 2009 and above installed on the PC

Back End : MS Excel 2010 above installed on the PC

5.7 TEST DATA


A database containing images of varying texture properties must be taken up for
experimentation. For e.g.: Brodatz Texture Album can be a good choice for analyzing
texture features.
6. GUI BASED CBIR SYSTEM

The Graphical User Interface based CBIR system is developed.

The following steps shows how it works.

6.1 HOW IT WORKS


1) CALCULATE DATABASE FEATURES

It calculates the values of features of all the images present in the database and stores
them as a MS Excel file in the system. These features are further used to calculate the
distance between the images in the database and the query image.

2) SELECT QUERY IMAGE

This option helps the user to select the query image whose similar images he/she has
to find.

3) SEARCH SIMILAR IMAGES

It calculates the features of the query image and then displays the similar images
according to the least distances w.r.t database images features.
User opens the window.

Selects the query image from the brodatz database folder Rock.
Then user selects the option SEARCH SIMILAR IMAGES.

Results are displayed at the new screen where the similar images are placed according to the
least distance between the features. Note that the first image from the left side is the
same as the query image.
SCREENSHOTS
Example1
Brodatz database folder Ground

Example 2
Brodatz database folder Concrete

Example 3
Brodatz database folder Wood

Example 4
Brodatz database folder Brick

Example 5
Brodatz database folder Asphalt
APPENDIX
CODE FOR GUI BASED CBIR
my.m

functionvarargout = my(varargin)

% ------------------------------------------------------------
% DEMO Application M-file for Demo.fig
% DEMO, by itself, creates a new DEMO or raises the existing
% singleton*.
%
% H = DEMO returns the handle to a new DEMO or the handle to
% the existing singleton*.
%
% DEMO('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in DEMO.M with the given input arguments.
%
% DEMO('Property','Value',...) creates a new DEMO or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Demo_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Demo_OpeningFcn via varargin.
%
% *See GUI Options - GUI allows only one instance to run (singleton).
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help Demo

% Last Modified by GUIDE v2.5 21-Oct-2002 03:11:52


% ------------------------------------------------------------

% ------------------------------------------------------------
% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @my_OpeningFcn, ...
'gui_OutputFcn', @my_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
ifnargin&&ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

ifnargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
functionmy_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Demo (see VARARGIN)

% Choose default command line output for Demo...

handles.output = hObject;
% Initialize the options...
guidata(hObject, handles);
% Outputs from this function are returned to the command line.
functionvarargout = my_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure

varargout{1} = handles.output;
% Some code to input the selected image to the database...
function pushbutton1_Callback(hObject, eventdata, handles)
% Executes on selection of 'Input To Database'.
% hObject handle to CloseMenuItem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

imageNames=dir('C:\Shape Analysis\New Folder


(2)\database1\database\database\asphalt(512png)\*.png');
for k=1:length(imageNames)
imgname=strcat('C:\ShapeAnalysis\NewFolder(2)\database1\database\database\asphal
t(512png)\',image
Names(k).name);
% i=[1 2 3;4 5 6;7 8 9];

G=imread(imgname);
% imshow(G);
p=haar_2d(G);
d= xlswrite(strcat('C:\Shape Analysis\New Folder
(2)\Raunak\due2\imageenergy',num2str(k)),p,'sheet1');
end
% Executes on button press in select query image
function pushbutton2_Callback(hObject, eventdata, handles)
[fn,pn]=uigetfile({'*.bmp';'*.jpg';'*.png';'*.gif';'*.*'},'pick an image');
i=imread([pn,fn]);
% axes(handles.i_display);
imshow(i);
% imageSc(i);
% set(handles.i_display,'visible','off');
s=haar_2d(i);
set(handles.edit1,'string',s);
% guidata(hobject,handles);
%Executes on selection of 'Search Database' from the menubar.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to CloseMenuItem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Some code to search the database for the selected image...

imageNames=dir('C:\Shape Analysis\New Folder


(2)\database1\database\database\asphalt(512png)\*.png');
n=numel(imageNames);
x=zeros(10);
g=zeros(1,n);
p=1;
q=str2num(char(get(handles.edit1,'string')));
for j=1:length(imageNames)
y=xlsread(strcat('C:\Shape Analysis\New Folder (2)\
Raunak\due\imageenergy',num2str(j)));
d1 = sum((q-y).^2).^0.5;
d2= xlswrite(strcat('C:\Shape Analysis\New Folder (2)\
Raunak\due\distance',num2str(j)),p,'sheet1');
g(1,j)=d1

if g(1,j)<=20000
v=j;
% x(p)=j
% p=p+1;
imgname=strcat('C:\Shape Analysis\New Folder
(2)\database1\database\database\asphalt(512png)\',imageNames(v).name);
ii=imread(imgname);
figure(2)
subplot(2,5,p);
subimage(ii);
p=p+1;
end

end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text


% str2double(get(hObject,'String')) returns contents of edit1 as a double

% --- Executes during object creation, after setting all properties.


function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.


% See ISPC and COMPUTER.
ifispc&&isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

CODE FOR HAAR WAVELET FEATURE EXTRACTION

haar_2d.m
function [p]=haar_2d(u)

[ m, n ] = size ( u );

v = u;

s = ( 2.0 );

w = zeros ( m, n );
k = 1;
while ( k * 2 <= m )
k = k * 2;
end
while ( 1 < k )

k = floor ( k / 2 );

w( 1: k,:) = ( v(1:2:2*k-1,:) + v(2:2:2*k,:) ) / s;


w(k+1:k+k,:) = ( v(1:2:2*k-1,:) - v(2:2:2*k,:) ) / s;

v(1:2*k,:) = w(1:2*k,:);

end
k = 1;
while ( k * 2 <= n )
k = k * 2;
end

while ( 1 < k )

k = floor ( k / 2 );

w(:, 1: k) = ( v(:,1:2:2*k-1) + v(:,2:2:2*k) ) / s;


w(:,k+1:k+k) = ( v(:,1:2:2*k-1) - v(:,2:2:2*k) ) / s;

v(:,1:2*k) = w(:,1:2*k);

end
v1=v(:,:,1);
v1=v1.^2;
v1=double(v1);

[m1 n1]=size(v1);
p1=0;
fori=1:m1
for j=1:n1
k1 = v1(i,j);
p1 = p1 + k1;
end

end
p=p1;

REFERENCES
Amina Khatra, Content based Image Retrieval using Texture Contents,
International Journal of Scientific Engineering and Research (IJSER)ISSN (Online): 2347-
3878 Volume 1 Issue 4, December 2013.

Wasim Khan, Shiv Kumar, Neetesh Gupta, Nilofar Khan, Signature Based Approach For
Image Retrieval Using Color Histogram And Wavelet Transform International Journal of
Soft Computing and Engineering (IJSCE) ISSN: 2231-2307 (Online), Volume-1, Issue-1,
March 2011.

Ana B.benitez, Mandis beige ,Shih-Fu Chang, Columbia University , Using Relevance
Feedback In Content based image metasearch 59IEEE INTERNETCOMPUTING1089-
7801/98/$10.001998IEEE http://computer.org/internet/ July August 1998.

Ch.Kavitha, Dr.B.Prabhakara Rao, Dr.A.Govardhan,Image Retrieval Based On Color and


Texture Features of the Image Sub-blocks, International Journal of Computer
Applications (0975 8887) Volume 15 No.7, February 2011

P.S.Hiremath, S. Shivashankar, JagadeeshPujari,WAVELET BASED FEATURES FOR COLOR


TEXTURE CLASSIFICATION WITH APPLICATION TO CBIR ,IJCSNS International Journal of
Computer Science and Network Security, VOL.6 No.9A, September 2006

KalyanasundaramK ,Sanoj. C.S.Content based Image Retrieval using Wavelet based


Multi-resolution AnalysisInternational Journal of Computer Applications (0975 8887)
Volume 40 No.6, February 2012

Md. Iqbal Hasan Sarker and Md. ShahedIqbal , Content-based Image Retrieval Using
HaarWavelet Transform and Color Moment,Smart Computing Review, vol. 3 , no. 3 , June
2013

Michael EziashiOsadebey, INTEGRATED CONTENT-BASED IMAGE RETRIEVAL USING


TEXTURE, SHAPE AND SPATIAL INFORMATION ,February 2006 ,Master Thesis Report in
Media Signal Processing ,Department of Applied Physics and Electronics, Umea
University, Umea Sweden
Dr.H.B.KekreSudeep, D. Thepade,AkshayMaloo, Query by Image Content using Color-
Texture Features Extracted from Haar Wavelet Pyramid , IJCA Special Issue on
Computer Aided Soft Computing Techniques for Imaging and Biomedical Applications
CASCT, 2010

K.ValliMadhavi, R.Tamilkodi, R.BalaDinakar, K.JayaSudha, An Innovative Technique for


Content Based Image Retrieval Using Color and Texture Features ,International Journal
of Innovative Research in Computer and Communication Engineering Vol. 1, Issue 5, July
2013

Mohankumar , Madhavan , Content Based Image Retrieval Using 2-D Discrete Wavelet
with Texture Feature with Different Classifiers IOSR Journal of Electronics and
Communication Engineering (IOSR-JECE) e-ISSN: 2278-2834,p- ISSN: 2278-8735.Volume 9,
Issue 2, Ver. IV (Mar - Apr. 2014), PP 01-07 www.iosrjournals.org

Md. Shahed Iqbal, Md. Iqbal Hasan Sarker, Mohammad Ibrahim Khan, Content-Based
Image Retrieval using Haar Wavelet Transform,NCICIT 2013: 1st National Conference on
Intelligent Computing and Information Technology, November 21, CUET, Chittagong-4349,
Bangladesh

Parulpreetsingh , Kulvinder Singh Mann, An Approach of Image Retrieval Using Content


Based Retrieval System, International Journal of Advanced Research in Computer Science
and Software Engineering Volume 3, Issue 2, February 2013

S.Selvarajah and S.R.Kodituwakku, Analysis and Comparison of Textural Features for


Content Based Image Retrieval ,International Journal of Latest Trends in Computing (E-
ISSN: 2045-5364)108 Volume 2, Issue 1, March 2011

You might also like