Final Report CBIR Using GUI
Final Report CBIR Using GUI
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
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 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
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
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
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)
History
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
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.
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.
Areas of Work
Generation of terrain briefs for its military potential R & D in Landslide Assessment
Management
Ground Water Study & Off-road mobility Study and Terrain briefs
Facilities Available
GIS and Image processing tools for generating thematic and derivative terrain maps.
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.
2. TEXTURE
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.
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
4) Wavelet packets
LL
LL LH
HL HH
Fig 3.3 Level 1 of the 2D 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
[9 7 3 5]
[ 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][
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
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.
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.
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.
The functionalities derived from the requirement analysis and mentioned in this
document are further refined in the design phase.
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.
This option helps the user to select the query image whose similar images he/she has
to find.
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
% ------------------------------------------------------------
% 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)
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)
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)
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)
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)
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 );
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 );
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.
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
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