|
||||||||
![]() |
||||||||
|
|
||||||||
|
[PG] Parental Guidance Suggested
%program to find the 2d-pcd
clc; clear all; close all; tic % %program to calculate the average matrix A-bar i=imread('C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\ref.png'); for a=1:4 y=imread(['C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\(',num2str(a),').png']); i=imadd(i,y); end i=im2double(i); avgim=i/(a+1); i=im2uint8(i); avgim=im2uint8(avgim); %program to find co variance matrix totim=0; for a=1:4 i=imread(['C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\(',num2str(a),').png']); z=imsubtract(avgim,i); z=im2double(z); q=z'*z; totim=totim+q; end covim=totim/165; % % program to caluclate eigen vectors [eve,eva]=eig(covim); t=sort(eve,2); t1=eve(:,5:18); for a=1:5; i=imread(['C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\ref.png']); i=im2double(i); k=i*t1; w=strcat(['C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\(',num2str(a),').png']); %imwrite(k,w); end disp('program executed succefully'); toc save pca2dvar; %========================================================================== % %program to find result of 2D pca clear all; %close all; %clc; x=input('give the path of the query image'); x=imread(x); n=x; i=imresize(x,[80,100]); i=im2double(i); tic; %v=i*t1; w=strcat('C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\ref.png'); %imwrite(v,w); v= imread('C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\ref.png'); v=im2double(v); % %to find euclidean distance for a=1:57 b=a+1; i=imread(['C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\(',num2str(a),').png']); i=im2double(i); i=abs(i); j=double((2*sum((v-i).^2))); %j=double(2*sum(v,i).^2); sumq=0; for cq=1:1 for rq=1:18 sumq=sumq+j(cq,rq); end end finq=abs(sumq); gf=sqrt(finq); sa(b)=gf; end %%%sorting the distances df=sort(sa,2); for c=1:5 ne(1,(c))=df(1,(c)); end for e=1:5 for d=1:58 if(ne(1,(e))==sa(1,(d))) san(1,(e))=d-1; end end end % % % list of recived images % for f=1:5 k=san(1,(f)); subplot(2,5,f); imshow(['C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\(',num2str(k),').png']); end title('retrieved images'); figure ,imshow(n) title('this is the query image'); %precision and recall values before applying the feed back p=input('enter the no of images dissimilar'); input('precision and recall values before applying feed back are:'); bpre=(5-p)/5; bre=(5-p)/58; disp(bpre); disp(bre); % %feed back loop true=1; noi=0; while(true) l=input('are u satifsied if yes press "yes" else press "no" with in single quotes'); if(strcmp(l,'yes')) true=0; break; else noi=noi+1; disp(san); p=input('enter the no of images dissimilar'); for k=1:p q=input('enter the position the dissimilar images'); i=imread(['C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\(',num2str(k),').png']); i=im2double(i); j=double(2*sum(v-i).^2); sumq=0; for cq=1:1; for rq=1:18 sumq=sumq+j(cq,rq); end end finq=abs(sumq); gf=sqrt(finq); sa(q+1)=gf; end % % %sorting the distances in feed back loop % % %%%sorting the distances df=sort(sa,2); for c=1:5 ne(1,(c))=df(1,(c)); end for e=1:5 for d=1:58 if(ne(1,(e))==sa(1,(d))) san(1,(e))=d-1; end end end % % % list of recived images by applying feed back % for f=1:5 k=san(1,(f)); subplot(2,5,f); imshow(['C:\Program Files\MATLAB\R2006a\work\content based image retrieval\image data base\(',num2str(k),').png']); end title('retieved images'); end end input('the no of iterations to get required the set of retrieved images are:'); disp(noi); % % %precision and recall values after applying % %feedback-------------------------------------------------- input('precision and recall values after applying feedback are:'); apre=(5-p)/5; are=(5-p)/58; disp(are); disp(apre); toc;
[PG] Parental Guidance Suggested
|
||||||||
|
© WP Technology Inc. 2010
User-posted content is subject to its own terms. |