Code covered by the BSD License  

Highlights from
Content Based Image Retrieval

4.0

4.0 | 6 ratings Rate this file 269 Downloads (last 30 days) File Size: 14.5 MB File ID: #42008
image thumbnail

Content Based Image Retrieval

by

 

30 May 2013 (Updated )

Simple content based image retrieval for demonstration purposes. Either using knn or classification

| Watch this File

File Information
Description

This a simple demonstration of a content based image retrieval using 2 techniques.
1. Using knn for image retrieval
2. Using svm for image retrieval.

Notice: Please follow these steps in order to avoid common mistakes.

1. Go to the following link http://wang.ist.psu.edu/docs/related/
and download the 100 test images zip file

2. Extract the images from the zip file to the ImageRetrieval/images folder and overwrite any existing images that previously existed in that directory

3. In order to make any queries you'll be asked to load the dataset firt. No worries the directory contains the full dataset.mat file which you can load and then fire up your queries.

You can also download the source code from github: https://github.com/kirk86/ImageRetrieval

Required Products Bioinformatics Toolbox
Data Acquisition Toolbox
Datafeed Toolbox
Fuzzy Logic Toolbox
Image Acquisition Toolbox
Image Processing Toolbox
Optimization Toolbox
Signal Processing Toolbox
Statistics Toolbox
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (18)
18 Nov 2014 hassan mahmood

hi everyone:
in the "function correlogram(photo, Cm, K)", "for k = 1:K"
is used as loop.
where K is passed from
distances = [1 3 5 7];
through
colorAutoCorrelogram = correlogram(rgb, map, distances)
I have read through huang paper, but couldn't get it.

1- the FOR loop is run only once for k=1 only, k=1 neighbor 8 pixels
why we pass K=[1 3 5 7] to the correlogram function?
2- why we are multiplying the values by distances?
colorAutoCorrelogram(:, :, 1) = colorAutoCorrelogram(:, :, 1)*distances(1);
colorAutoCorrelogram(:, :, 2) = colorAutoCorrelogram(:, :, 2)*distances(2);
colorAutoCorrelogram(:, :, 3) = colorAutoCorrelogram(:, :, 3)*distances(3);
colorAutoCorrelogram(:, :, 4) = colorAutoCorrelogram(:, :, 4)*distances(4);

we are not checking 3 5 7 neighbors? should we do it?
thanks for your time

16 Nov 2014 Chez

@Pham Nhung, go to the github link provided in the description above in the "File Information" section. You will find there the reference you are looking for. Check for "reference.pdf" which explains how the dataset was obtained!

03 Nov 2014 Pham Nhung

Sorry I do not understand what dataset represents and how you obtain it from the set of images.Can anyone explain to me?

31 Oct 2014 Xing Di

Reference to non-existent field 'popupmenu_DistanceFunctions'.

Error in cbires>btnExecuteQuery_Callback (line 211)
metric = get(handles.popupmenu_DistanceFunctions, 'Value');

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in cbires (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in
@(hObject,eventdata)cbires('btnExecuteQuery_Callback',hObject,eventdata,guidata(hObject))


Error while evaluating uicontrol Callback

18 Sep 2014 liu zhiyuan

this is the detail information of error!

Reference to non-existent field 'popupmenu_DistanceFunctions'.

Error in cbires>btnExecuteQuery_Callback (line 197)
metric = get(handles.popupmenu_DistanceFunctions, 'Value');

Error in gui_mainfcn (line 96)
feval(varargin{:});

Error in cbires (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in
@(hObject,eventdata)cbires('btnExecuteQuery_Callback',hObject,eventdata,guidata(hObject))


Error while evaluating uicontrol Callback

04 Sep 2014 zhendong zhang  
07 Jul 2014 DGSN

WIL BE TESTED

30 Jun 2014 Chez

@Drumzhead,

Dear Drumzhead,

each of the 6 features you're referring to is on its own a variable length array or a feature vector if you prefer. What that means is that for instance if we take the first feature of the 6 you mentioned which is "hsvHist" and we print its values you can see that it is not a variable or a feature corresponding to one particular value, rather it's a vector of 64 or 128 values. The same holds for the rest of the 6 features you're referring to.

Hope that helps!

13 Jun 2014 Drumzhead Chongpratheep

Dear Chez,

I have gone through your code for feature vector extraction and notice that there're about 6 features composing one feature vector as the code below.

File Name: cbir.m / Line: 446
% construct the dataset
set = [hsvHist autoCorrelogram color_moments meanAmplitude msEnergy wavelet_moments];

However, when I open .mat file, it contains 190 columns of value for each vector (excluding the last column allocated the No. of image).

Could you please clarify what is 190 columns of value represent for?

Thanks

18 May 2014 Chez

@Sun-hwa,

You have to be aware that the svm button will not work unless you configure it to work with your dataset. What do I mean is that you will have to find out how many classes you have in your dataset and configure the svm.m file accordingly.

For instance if your dataset has 10 classes total then you will have to configure either the names of the images to fall under the wang’s dataset schema or you’ll have to modify the code in svm.m file.

Notice that the wang dataset has 10 classes with 100 images each:
For instance images 0 through 99 belong to class 1
Images 100 through 199 belong to class 2
Images 200 through 299 belong to class 3
.
.
.
Etc.

So modify your dataset names of images accordingly or as I said above modify the svm.m file at the section where it creates the labels for each class.

Hope that helps.

11 May 2014 Sun-hwa

I have a team project about 'Reconizing Flowers.'
While I was looking for some algorithms, I found your program about CBIR.

I have some questions about the program.

Actually, we were going to make a dataset of 'Flowers'. Successfully, we made an flower data set and we activated 'Query' function.
But, there was an error when we tried to excute 'SVM'.

I think we don't know exaclty about how to use this program.

So, Can i get an overall manual of this program if you have that?

26 Apr 2014 Vishwajeet

??? Error using ==> plus
Matrix dimensions must agree.

Error in ==> L1 at 23
manhattan(k) = sum( abs(dataset(k, :) - queryImageFeatureVector) ./ ( 1 + dataset(k, :) +
queryImageFeatureVector ) );

Error in ==> cbires>btnExecuteQuery_Callback at 213
L1(numOfReturnedImgs, handles.queryImageFeature, handles.imageDataset.dataset);

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> cbires at 42
gui_mainfcn(gui_State, varargin{:});

Error in ==>
@(hObject,eventdata)cbires('btnExecuteQuery_Callback',hObject,eventdata,guidata(hObject))

??? Error while evaluating uicontrol Callback

03 Dec 2013 anbarasa pandian

Hi Friends
...
i want CBIR techniques source code... Please send me this e-mail id: <<anbuaec@gmail.com>>...
i am doing project in CBIR using Hyperpectral image...

02 Dec 2013 Chez

@christopher, make sure your matlab version supports dwt2 function, and may I ask what kind of image are you inputting???

12 Nov 2013 christopher

the program has an error whenever I try to input an image for query and does not see the image at all

Undefined function 'dwt2' for input arguments of type
'double'.

Error in waveletTransform (line 9)
coeff_1 = dwt2(imgGray', 'coif1');

Error in cbires>btn_BrowseImage_Callback (line 103)
wavelet_moments = waveletTransform(queryImage);

Error in gui_mainfcn (line 96)
feval(varargin{:});

Error in cbires (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in
@(hObject,eventdata)cbires('btn_BrowseImage_Callback',hObject,eventdata,guidata(hObject))

04 Oct 2013 Hassan Saad

SVM Button not working with me

Attempted to access
img_names(121); index out of
bounds because
numel(img_names)=120.

06 Sep 2013 Chez

@Prasad, if you're using an older matlab version than version 8. Try to change the line 243 to: [var1, var2, cmat] = svm(numOfReturnedImgs, handles.imageDataset.dataset, handles.queryImageFeature, metric);

03 Sep 2013 Prasad Kalane

following error comes when I run cbires file...

??? Error: File: cbires.m Line: 243 Column: 3
Expression or statement is incorrect--possibly unbalanced (, {, or [.

Updates
29 Aug 2013

I have provided and additional link to my github account where anyone can download the source code of this project!

Contact us