As I promised, here is some useful notes about developing a complete image retrieval engine by using color and texture:
1. Image Gallery
Using a free database which have 1000 middle-sized image in 10 different categories
2. Feature Extraction
- Color: 3 * 64-bin Histogram in HSV Color mode (64-bin Histogram for each H, S and V dimention).
- Texture: Calculating Co-occurrence matrix for each image and extracting “Contrast, Correlation, Energy and Homogeneity” of texture. Results shows that the respective importance of these feature are: Correlation, Homogeneity, Contrast and Energy.
Some unique blocking methods are used to extract both features in the way that the main parts of image have higher impression and importance.
3. Clustering
I’ve used k-means algorithm to partition my feature space into 7 clusters, respect to 7 feature vectors previously mentioned. But the main criterion for decision is Histogram clusters.
I am not satisfied by using this method, so I am finding a better way to cluster my feature space. I found some articles which are concerned about this issue:
Thomas Deselaers, et al. “Clustering visually similar images to improve image search engines”, …
Ioan Cleju, et al. “Clustering by principal curve with Tree Structue”, …
Xin Zheng, et al. “Locality Preserving Clustering for Image Databse”, …
4. Similarity analogy
I’ve used level 1 of Minkowsky distance for histogram analogy and level 3 for texture-related features.
(For Minkowsky distance formula refer to: Long F. ; Zhang H. and Dagan Feng D., Fundamentals of content-based image retrieval, in Multimedia Information Retrieval and Management – echnological Fundamentals and Applications,” Springer-Verlag, pp. 1-26, 2003)
I’ve used reverse of calculated distance to find the similarity rank of each images. These ranks should be added together to calculate final rank of each images. At this point, IT SHOULD NOT BE FORGOTTEN TO NORMALIZE EACH RANK. Since each feature has different importance, different coefficient correspond to its importance should be multiplied into its calculated rank.
To know how to reach a normalized rank, I refer you to read this paper:
Li X. ; Chen S.C. ; M.L. Shyu and Furht B., “Image retrieval by Color, Texture, and Spatial Information,” in 8th International Conference on Distributed Multimedia Systems (DMS’2002), San Francisco Bay, California, USA, 2002, pp. 152-159.
5. Final Result
To find the similar images from database to a user-defined image, first of all, FV (=feature vector) should be extracted, using the same way as other images in database. Since I use 256-element histogram vector to partition image databse, the histogram part of FV have been used to find the respective cluster. After this step, the comparable images will be limited to the images belong to the respective cluster. Now, by using similatrity measure and finding the specific ranks and them add them in that special way, the similarity ranks will be assigned to every comparable images. The last thing to do is to sort this rates in descending order and show n-first high rank images to user.
Note that Each phase is capable to be improved.
hey can u please mail me ur MAtlab codes on CBIR
I need them
Thanks and Regards
Ridhi
There is a link to a complete project in link bar. If it is urgent refer to it. My own is not completed unfortunately.
Please send me the matlab code on CBIR using color.
Regards
Hi Please send me the matlab code on CBIR using color. i need it very urgently.
Regards
Hi Please send me the matlab code on CBIR using color. i need it very much
Hi Zahra,, I am an Iranian student who is working on CBIR project , I would really appreciate if you could send me your source code ,, Thanks
Unfortunately the code is not ready. I will put it as soon as possible.
Hi everyone, I have a question regarding to CBIR Complete project, I’d like to test the application with some other images with a different size, how it would be possible? The images in this application has a dimension of 256*256 and 65 kb size, How can i make it to be flexible to get any size of image?
Hi, I think your system should not be sensitive to image size, everything should be relative.
for example histogram may be normalized by dividing all bins into whole no of pixels; by using such methods your system can be independent of image size.
thanks for the fast reply, just wondering where you are now? I’m testing the complete CBIR system, the one that its link is in this forum, anyway i’m using some blood cell images for this system, so after adding the images to the folder and running the application, the INPUT and SEARCH button are not enabled, so I try to change the size of the image in photoshop , but could not make it to 65 kb, i have gone through the code and having the folloing error: “Index exceeds matrix dimensions.”, i debug the code and i got this error from rgb2hsv.m file, i do appreciate if you can help me out as i’m new in matlab,
thanks
unfortunately i didn’t test that system, but recommend you to develop your own instead of using that one. ‘cos none of professional systems are dependent to the size.
If you wanna test a cbir system, this one is more appropriate:
http://labs.systemone.at/retrievr
i’m using some of the code and for me to undrestand the code, i need to test as i’m new in matlab,,
at the moment i need some code to do the feature extraction based on the color and do the retrieval as well,
There is long way to reach a complete cbir. Wish you to be lucky.
Thanks,
Can u provide me the code for texture feature extraction.
Calculating Co-occurrence matrix for each image and extracting “Contrast, Correlation, Energy and Homogeneity” of texture.
Its very urgent.
Hi,
Can anyone provide me the code for SHAPE feature extraction,
Really appreciate it,
Hey can I wanna do project on CBIR based on color. can any1 suggest me which Algoritm should i use n wher ll i find it..
I am looking for working in shape based image retrieval, I have referred many papers but every paper does mention its own approach besides the basic approaches like Fourier, Zernike, grid descriptors, Curvature scale space.
After referring so many papers, I do not where and how to proceed ?????????Should I start with developing a software and implemting these methods and comparing them with new proposed methods? Please guide me.
Urgent
what is the significance of matlab in content based image retrieval
Please send me the matlab code on CBIR using color. Thank’s.
Pl.send me the matlab code on CBIR using color and texture.
plz send me cbir matlab code
plz send me matlab code for cbir
hello
Can u provide me the code for texture feature extraction
Pl.send me the matlab code on CBIR using color and texture and shape pls with algorithm
with my best regurd wishes
Hi anyone have an idea of texture and shape feature extraction using matlab.
Hi can u send me the matlab code for cbir using texture color shape with algorithm its very urgent.
hi
anyone send me matlab code for shape feture extraction of image..
i’m waiting for u’r reply…
Hi
I need so much a matlab code for cbir, for a university project.
If you could send it to me please, I’ll be very greateful.
Thank you very much.
Hi
I am a student and i need a matlab code for shape based image retrieval for my university project. If anyone can provide me with that i will be very grateful.
Thank you very much
Dear guys, im need help for my CBIR project.Mine is using wavelet transform.I really hope if anyone can guide me.Thank you
Hi
I am a student studying in PESIT college, Bangalore.
Me and my friends r doing our end sem project on CBIR.
I would really appreciate if u could send me any code related to cbir ,as we have to show it next week.
Thank you
hi
can any one pls provide the code for cbir system…pls
thank you
hi..
can u pls giv implementation details for image retrieval system such as CBIR…
thank u ….
hi.
plz send me a program on how to apply a grid of 256*256 cells to an image. its very urgent.
hii zhara
I am student who is working on CBIR project , I would really appreciate if you could send me your source code ,
Thanks
hi zhara,
I am a student doing my sem project on CBIR, can you please send me your CBIR code(matlab) to my mail.
THANKS
hi zhara,
I am a student doing my sem project on CBIR, can you please send me your CBIR code(matlab) to my mail.
my id is: lekha2yashwanth@yahoo.co.in
THANKS
halo,zhara.
im ravuikanth doin ma projct on cbir request u to give som guide lines of the project…
waitn for ur reply
tc
Hi,
This is anil .I am doing M.Tech(Scientific computing) at BIT,INDIA.I am developing an WAVELET BASED IMAGE SEARCH ENGINE (WCBIR) BASED ON SHAPE FEATURES FOR IMAGE COPY RIGHT PROTECTION.
During coding i am facing some problems like storing the results in a text file and tagging for each image during matching of images .
So please give me some idea about code regarding SHAPE BASED IMAGE RETRIEVAL USING WAVELETS.
So I need a matlab code for shape based image retrieval for my university project. If anyone can provide me with that i will be very grateful.
so please send me code to my mail id.
Thank you very much
p.v.anil kumar,
mobile:9431903805
email:anil.mtechcs@gmail.com
Can u provide me the code for texture feature extraction.
Calculating Co-occurrence matrix for each image and extracting “Contrast, Correlation, Energy and Homogeneity” of texture.
Its very urgent.
hi zhara and every one,
I am a student doing my sem project on CBIR, i have the code and it is executing for only one half. i will be thank full to u if u can correct this code and send to my mail address.
the code of my project is as follows
here is my cbir code
function TOP
global GParm
GParm.figure = figure(’Color’,[0.7 0.9 0.7], …
‘MenuBar’,'none’, …
‘Colormap’,gray(256), …
‘Name’,'AQUAMARINE-CBIR INTERFACE1′, …
‘Visible’,'on’, ‘Resize’,'off’, …
‘NumberTitle’,'off’, …
‘ShareColor’,'off’, …
‘RendererMode’,'manual’,'Renderer’,'painters’, …
‘Units’,'pixels’, …
‘Position’,[5 35 1020 710], …
‘WindowStyle’,'normal’, …
‘Pointer’,'arrow’);
posbox = [280 480 430 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘background’,([0.7 0.9 .7]),…
‘Style’,'text’, …
‘Units’,'pixel’, …
‘String’,'AUTOMATED CONTENT BASED IMAGE RETREIVAL FOR AQUMERINE LEARNING ‘, ‘fontsize’,13,…
‘Position’,posbox);
posbox = [345 390 430 25] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘background’,([0.7 0.9 0.7]),…
‘Style’,'text’, …
‘Units’,'pixel’, …
‘String’,'By — batch-4 (407 408 412 416)’,'fontsize’,12, …
‘Position’,posbox);
posbox = [330 350 290 35] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘background’,([0.7 0.9 0.7]),…
‘Style’,'text’, …
‘Units’,'pixel’, …
‘String’,'Under Guidence of — Binny Madam’,'fontsize’,12, …
‘Position’,posbox);
posbox = [150 277 130 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘Style’,'Pushbutton’, …
‘BusyAction’,'queue’,'Interruptible’,'off’, …
‘Units’,'pixel’, …
‘String’,'Train Database’, …
‘Position’,posbox, …
‘Callback’,'td;’ …
);
posbox = [150 200 130 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘Style’,'Pushbutton’, …
‘BusyAction’,'queue’,'Interruptible’,'off’, …
‘Units’,'pixel’, …
‘String’,'Test-Query’, …
‘Position’,posbox, …
‘Callback’,'gui;’ …
);
posbox = [550 130 130 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘Style’,'Pushbutton’, …
‘BusyAction’,'queue’,'Interruptible’,'off’, …
‘Units’,'pixel’, …
‘String’,'Exit’, …
‘Position’,posbox, …
‘Callback’,'close1;’ …
);
function td
global GParm
GParm.figure = figure(’Color’,[0.7 0.9 0.7], …% black color
‘MenuBar’,'none’, …
‘Colormap’,gray(256), …
‘Name’,'AQUAMARINE-CBIR INTERFACE’, … % figure window name
‘Visible’,'on’, ‘Resize’,'off’, … % initially not drawn
‘NumberTitle’,'off’, …
‘ShareColor’,'off’, …
‘RendererMode’,'manual’,'Renderer’,'painters’, …
‘Units’,'pixels’, …
‘Position’,[125 100 799 580], …
‘WindowStyle’,'normal’, …
‘Pointer’,'arrow’);
posbox = [150 425 130 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘Style’,'Pushbutton’, …
‘BusyAction’,'queue’,'Interruptible’,'off’, …
‘Units’,'pixel’, …
‘String’,'Test-Query’, …
‘Position’,posbox, …
‘Callback’,'gui;’ …
);
posbox = [550 130 130 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘Style’,'Pushbutton’, …
‘BusyAction’,'queue’,'Interruptible’,'off’, …
‘Units’,'pixel’, …
‘String’,'Back’, …
‘Position’,posbox, …
‘Callback’,'TOP;’ …
);
function td1
as=waitbar(0,’Reading Database Images…’);
for i=0:.001:1
waitbar(i);
end
close(as);
as=waitbar(0,’Training Database Images…’);
for j=0:.0001:1
waitbar(j);
end
close(as);
function gui()
global GParm
GParm.figure = figure(’Color’,[0.7 0.9 0.7], …% black color
‘MenuBar’,'none’, …
‘Colormap’,gray(256), …
‘Name’,'AQUAMARINE-CBIR INTERFACE2′, … % figure window name
‘Visible’,'on’, ‘Resize’,'off’, … % initially not drawn
‘NumberTitle’,'off’, …
‘ShareColor’,'off’, …
‘RendererMode’,'manual’,'Renderer’,'painters’, …
‘Units’,'pixels’, …
‘Position’,[125 100 799 580], …
‘WindowStyle’,'normal’, …
‘Pointer’,'arrow’);
posbox = [50 430 130 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘Style’,'Pushbutton’, …
‘BusyAction’,'queue’,'Interruptible’,'off’, …
‘Units’,'pixel’, …
‘String’,'Query-Image’, …
‘Position’,posbox, …
‘Callback’,’s=in1;’ …
);
posbox = [50 365 130 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘Style’,'Pushbutton’, …
‘BusyAction’,'queue’,'Interruptible’,'off’, …
‘Units’,'pixel’, …
‘String’,'Extract-Feature’, …
‘Position’,posbox, …
‘Callback’,'fextr(s)’ …
);
posbox = [50 307 130 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘Style’,'Pushbutton’, …
‘BusyAction’,'queue’,'Interruptible’,'off’, …
‘Units’,'pixel’, …
‘String’,'Classify’, …
‘Position’,posbox, …
‘Callback’,'z=classify;’ …
);
posbox = [50 250 130 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘Style’,'Pushbutton’, …
‘BusyAction’,'queue’,'Interruptible’,'off’, …
‘Units’,'pixel’, …
‘String’,'Recognize’, …
‘Position’,posbox, …
‘Callback’,'rec(z,s);’ …
);
posbox = [665 25 130 45] ;
GParm.close = uicontrol( …
‘Parent’,GParm.figure, …
‘Style’,'Pushbutton’, …
‘BusyAction’,'queue’,'Interruptible’,'off’, …
‘Units’,'pixel’, …
‘String’,'Back’, …
‘Position’,posbox, …
‘Callback’,'TOP;’ …
);
function s=in1;
[fname,path] = uigetfile(’*.bmp’,'Query selection window:’,100,100) ;
[s1,map]=imread(fname);
s=imresize(s1,[20,20]);
s2=imresize(s1,[200,200]);
figure(’position’,[490 380 280 100]);
imshow(s2,map);
title(’ORIGNAL QUERY IMAGE’);
s1=s;
rt=size(s);
save s2
save map;
function fextr(as)
global Tr
asq=waitbar(0.2,’Extracting Feature’);
red =as(:,:);
green =as(:,:);
blue =as(:,:);
D_R = det(double(red));
D_G = det(double(green));
D_B = det(double(blue));
Tr=[D_R D_G D_B];
waitbar(0.4)
a=as(:,:);
at=edge(a,’prewitt’);
st=strel(’diamond’,2);
I=imdilate(at,st);
waitbar(0.5)
[T0]=tr0(I);
waitbar(0.6)
[T45]=tr45(I);
waitbar(0.7)
[T90]=tr90(I);
waitbar(0.8)
[T135]=tr135(I);
waitbar(0.9)
T01=[Tr T0];
T451=[Tr T45];
T901=[Tr T90];
T1351=[Tr T135];
waitbar(1)
save T01;
save T451;
save T901;
save T1351;
close(asq);
function [T0]=tr0(I)
global T0;
[as00]=z_deg(I);
as02=(as00)^2;
asm0=sum(sum(as02));
Mx = 0;%Initializing Mx
My = 0;%Initializing My
[m,n]=size(asm0);
for i = 1:m
for j = 1:n
Mx = Mx + i*asm0(i,j);
My = My + j*asm0(i,j);
end
end
contrast = 0;%contrast (1 – FEATURE)
energy = 0;% energy (2 – FEATURE)
entropy = 0;%Entropy (3 – FEATURE)
LocalHom= 0;% Local Homogeneity (4 – FEATURE)
ClusterShade = 0;%Cluster Shade (5 – FEATURE)
ClusterProminence = 0;% Cluster prominence (6 – FEATURE)
for i = 1:m
for j = 1:n
contrast = contrast + (i-j)*(i-j)*asm0(i,j);
energy = energy + asm0(i,j)^2;
LocalHom = LocalHom + (1/(1+(i-j)*(i-j)))* asm0(i,j);
ClusterShade = ClusterShade + (i – Mx + j – My)^3 * asm0(i,j);
ClusterProminence = ClusterProminence + (i – Mx + j – My)^4 * asm0(i,j);
temp = asm0(i,j);
temp1 = temp;
if ( temp1 == 0)
temp1 = 1;
end
entropy = entropy + temp * log(temp1);
end
end
entropy = – entropy;
MaxPro =max(asm0(:));% Maximum Probability (7 – FEATURE)
T0 = [asm0,contrast, energy, entropy, LocalHom, ClusterShade, ClusterProminence, MaxPro];
Return
function [yemp]=z_deg(im);
[s1,s2]=size(im);
yemp=zeros(20,20);
for i=1:s1
for k=1:s2-1
t=zeros(1,2);
T=zeros(1,2);
t=im(i,k:k+1);
count=0;
for P=1:s1
for j=1:s2-1
if im(P,j:j+1)==t
count=count+1;
end
end
end
T(1)=t(2);
T(2)=t(1);
count1=0;
for P1=1:s1
for P2=1:s2-1
if im(P1,P2:P2+1)==T
count1=count1+1;
end
end
end
t_count=count+count1;
yemp(t(1),t(2))=t_count;
yemp(t(2),t(1))=t_count;
end
end
function [T45]=tr45(I)
global T45;
[as45]=fty(I);
as42=(as45)^2;
asm4=sum(sum(as42));
Mx = 0;%Initializing Mx
My = 0;%Initializing My
[m,n]=size(asm4);
for i = 1:m
for j = 1:n
Mx = Mx + i*asm4(i,j);
My = My + j*asm4(i,j);
end
end
contrast = 0;%contrast (1 – FEATURE)
energy = 0;% energy (2 – FEATURE)
entropy = 0;%Entropy (3 – FEATURE)
LocalHom= 0;% Local Homogeneity (4 – FEATURE)
ClusterShade = 0;%Cluster Shade (5 – FEATURE)
ClusterProminence = 0;% Cluster prominence (6 – FEATURE)
for i = 1:m
for j = 1:n
contrast = contrast + (i-j)*(i-j)*asm4(i,j);
energy = energy + asm4(i,j)^2;
LocalHom = LocalHom + (1/(1+(i-j)*(i-j)))* asm4(i,j);
ClusterShade = ClusterShade + (i – Mx + j – My)^3 * asm4(i,j);
ClusterProminence = ClusterProminence + (i – Mx + j – My)^4 * asm4(i,j);
temp = asm4(i,j);
temp1 = temp;
if ( temp1 == 0)
temp1 = 1;
end
entropy = entropy + temp * log(temp1);
end
end
entropy = – entropy;
MaxPro =max(asm4(:));% Maximum Probability (7 – FEATURE)
T45 =[asm4,contrast, energy, entropy, LocalHom, ClusterShade, ClusterProminence, MaxPro];
Return
function [yemp1]=fty(im);
[s1,s2]=size(im);
yemp1=zeros(20,20);
for i=2:s1
for k=1:s2-1
t=zeros(2,1);
t1=zeros(2,1);
T=zeros(2,1);
t=logical(t);
t(1,1)=im(i,k);
t(2,1)=im(i-1,k+1);
count=0;
for P=2:s1
for j=1:s2-1
t1(1,1)=im(P,j);
t1(2,1)=im(P-1,j+1);
if t1 == t
count=count+1;
end
end
end
T(1)=t(2);
T(2)=t(1);
count1=0;
for P1=2:s1
for P2=1:s2-1
t1(1,1)=im(P1,P2);
t1(2,1)=im(P1-1,P2+1);
if t1 == T
count1=count1+1;
end
end
end
t_count=count+count1;
yemp1(t(1),t(2))=t_count;
yemp1(t(2),t(1))=t_count;
end
end
function [T90]=tr90(I)
global T90
[as90]=nty(I);
as92=(as90)^2;
asm9=sum(sum(as92));
Mx = 0;%Initializing Mx
My = 0;%Initializing My
[m,n]=size(asm9);
for i = 1:m
for j = 1:n
Mx = Mx + i*asm9(i,j);
My = My + j*asm9(i,j);
end
end
contrast = 0;%contrast (1 – FEATURE)
energy = 0;% energy (2 – FEATURE)
entropy = 0;%Entropy (3 – FEATURE)
LocalHom= 0;% Local Homogeneity (4 – FEATURE)
ClusterShade = 0;%Cluster Shade (5 – FEATURE)
ClusterProminence = 0;% Cluster prominence (6 – FEATURE)
for i = 1:m
for j = 1:n
contrast = contrast + (i-j)*(i-j)*asm9(i,j);
energy = energy + asm9(i,j)^2;
LocalHom = LocalHom + (1/(1+(i-j)*(i-j)))* asm9(i,j);
ClusterShade = ClusterShade + (i – Mx + j – My)^3 * asm9(i,j);
ClusterProminence = ClusterProminence + (i – Mx + j – My)^4 * asm9(i,j);
temp = asm9(i,j);
temp1 = temp;
if ( temp1 == 0)
temp1 = 1;
end
entropy = entropy + temp * log(temp1);
end
end
entropy = – entropy;
MaxPro =max(asm9(:));% Maximum Probability (7 – FEATURE)
T90 =[asm9,contrast, energy, entropy, LocalHom, ClusterShade, ClusterProminence, MaxPro];
Return
function [yemp1]=nty(im);
[s1,s2]=size(im);
yemp1=zeros(20,20);
for i=2:s1
for k=1:s2-1
t=zeros(2,1);
T=zeros(2,1);
t=im(k+1:-1:k,i);
count=0;
for P=1:s1
for j=1:s2-1
if im(j+1:-1:j,P)==t
count=count+1;
end
end
end
T(1)=t(2);
T(2)=t(1);
count1=0;
for P1=1:s1
for P2=1:s2-1
if im(P2+1:-1:P2,P1)==T
count1=count1+1;
end
end
end
t_count=count+count1;
yemp1(t(1),t(2))=t_count;
yemp1(t(2),t(1))=t_count;
end
end
function [T135]=tr135(I)
global T135
[as135]=oth(I);
as32=(as135)^2;
asm3=sum(sum(as32));
Mx = 0;%Initializing Mx
My = 0;%Initializing My
[m,n]=size(asm3);
for i = 1:m
for j = 1:n
Mx = Mx + i*asm3(i,j);
My = My + j*asm3(i,j);
end
end
contrast = 0;%contrast (1 – FEATURE)
energy = 0;% energy (2 – FEATURE)
entropy = 0;%Entropy (3 – FEATURE)
LocalHom= 0;% Local Homogeneity (4 – FEATURE)
ClusterShade = 0;%Cluster Shade (5 – FEATURE)
ClusterProminence = 0;% Cluster prominence (6 – FEATURE)
for i = 1:m
for j = 1:n
contrast = contrast + (i-j)*(i-j)*asm3(i,j);
energy = energy + asm3(i,j)^2;
LocalHom = LocalHom + (1/(1+(i-j)*(i-j)))* asm3(i,j);
ClusterShade = ClusterShade + (i – Mx + j – My)^3 * asm3(i,j);
ClusterProminence = ClusterProminence + (i – Mx + j – My)^4 * asm3(i,j);
temp = asm3(i,j);
temp1 = temp;
if ( temp1 == 0)
temp1 = 1;
end
entropy = entropy + temp * log(temp1);
end
end
entropy = – entropy;
MaxPro =max(asm3(:));% Maximum Probability (7 – FEATURE)
T135= [asm3,contrast, energy, entropy, LocalHom, ClusterShade, ClusterProminence, MaxPro];
Return
function [yemp1]=oth(im);
[s1,s2]=size(im);
yemp1=zeros(20,20);
for i=2:s1
for k=2:s2
t=zeros(2,1);
t1=zeros(2,1);
T=zeros(2,1);
t=logical(t);
t(1,1)=im(i,k);
t(2,1)=im(i-1,k-1);
count=0;
for P=2:s1
for j=2:s2
t1(1,1)=im(P,j);
t1(2,1)=im(P-1,j-1);
if t1 == t
count=count+1;
end
end
end
T(1)=t(2);
T(2)=t(1);
count1=0;
for P1=2:s1
for P2=2:s2
t1(1,1)=im(P1,P2);
t1(2,1)=im(P1-1,P2-1);
if t1 == T
count1=count1+1;
end
end
end
t_count=count+count1;
yemp1(t(1),t(2))=t_count;
yemp1(t(2),t(1))=t_count;
end
end
function dist = classify;
load T01;
load T451;
load T901;
load T1351;
load in;
load map;
load T00;
load T400;
load T900;
load T300;
T=T00;
T4=T400;
T9=T900;
T3=T300;
s=length(T);
t_db=cell(s);
t_q = T01+T451+T901+T1351;
for i=1:s
if isempty(T{i})~=1
t_db{i} = T{i}+T4{i}+T9{i}+T3{i};
T_DB_F{i}=sum(t_db{i});
end
end
t_q_f=sum(t_q);
s=length(T_DB_F);
for j=1:s
if isempty(T_DB_F{j})~=1
% dist{j}=abs(abs(T_DB_F{j})-abs(t_q_f));
dist{j}=abs(T_DB_F{j})-abs(t_q_f);
end
end
thr=1.9;
for j=1:s
if dist{j} 10
for y=1:tr
if z{y}==0
r{10}=kk{y};
end
end
end
for j=1:10
subplot(5,2,j),imshow(r{j},map);
end
for i=1:s
if z{i}==0;
figure(’Name’,'RETRIVED IMAGE’,…
‘NumberTitle’,'off’, …
‘MenuBar’,'none’, …
‘position’,[110 140 10 10]);
imshow(in{i},map);
title(’Recognized Image’);
figure(’Name’,'IMAGE DETAIL’,…
‘NumberTitle’,'off’, …
‘MenuBar’,'none’, …
‘position’,[430 140 10 10]);
imshow(dtl{i});
title(’Details’);
end
end
function close1
close all;
clc
clear all;
delete *.asv;
function TrainDB
a{1,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\A1.bmp’);
a{2,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\A2.bmp’);
a{3,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\A3.bmp’);
a{4,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\B1.bmp’);
a{5,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\B2.bmp’);
a{6,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\B3.bmp’);
a{7,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\B4.bmp’);
a{8,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\D1.bmp’);
a{9,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\D2.bmp’);
a{10,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\E1.bmp’);
a{11,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\E2.bmp’);
dtl{1,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\A1D.bmp’);
dtl{2,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\A2D.bmp’);
dtl{3,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\A3D.bmp’);
dtl{4,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\B1D.bmp’);
dtl{5,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\B2D.bmp’);
dtl{6,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\B3D.bmp’);
dtl{7,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\B4D.bmp’);
dtl{8,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\D1D.bmp’);
dtl{9,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\D2D.bmp’);
dtl{10,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\E1D.bmp’);
dtl{11,1}=imread(’C:\MATLAB6p5\work\fish\FDB1\E2D.bmp’);
s=size(a);
for i=1:s(1)
I=a{i,1};
as=imresize(I,[20,20]);
as1=imresize(I,[200,200]);
in{i,1}=as1;
red =as(:,:);
green =as(:,:);
blue =as(:,:);
D_R = det(double(red));
D_G = det(double(green));
D_B = det(double(blue));
Tr=[D_R D_G D_B];
a34=as;
at1=edge(a34,’prewitt’);
st=strel(’diamond’,2);
I=imdilate(at1,st);
[T0]=tr0(I);
[T45]=tr45(I);
[T90]=tr90(I);
[T135]=tr135(I);
T00{i,1}=[Tr T0];
T400{i,1}=[Tr T45];
T900{i,1}=[Tr T90];
T300{i,1}=[Tr T135];
end
save a;
save dtl;
save in;
save T00;
save T400;
save T900;
save T300;
please any one run this code and help me .
please send the corrected code to my mail
psvrrr@gmail.com
hi
i am also working on CBIR for the project. i have to compare the input image with the images in the database.
can u send me the code.please its very urgent
regards,
priyanka
Hi
I am a B.Tech student and i need a matlab code for content(color,shape,texture) based image retrieval for my university project. If anyone can provide me with that i will be very grateful.pls i need it very urgently…
Thank you very much
Hi
I am a B.Tech student and i need a matlab code for content(color,shape,texture) based image retrieval for my university project. If anyone can provide me with that i will be very grateful.pls i need it very urgently…
Thank you very much
my mail id is pradyu_vaikunt@yahoo.co.in
Can u give me ur source code via E-mail?
Thanks in advance,
devilboyiq@gmail.com