Select a specific image in a face recognition algorithm
Mostra commenti meno recenti
I made some modification so i have now a new GUI, buttons and 2 axes.
My current code is something like this:
I have a Load Database button and this is the code used for loading it.
function load_database_Callback(hObject, eventdata, handles)
load_database
My next button is Search
function search_Callback(hObject, eventdata, handles)
w=load_database();
ri=round(400*rand(1,1));
r=w(:,ri)
v=w(:,[1:ri-1 ri+1:end]);
N=10;
O=uint8(ones(1,size(v,2)));
m=uint8(mean(v,2));
vzm=v-uint8(single(m)*single(O));
L=single(vzm)'*single(vzm);
[V,D]=eig(L);
V=single(vzm)*V;
V=V(:,end:-1:end-(N-1));
cv=zeros(size(v,2),N);
for i=1:size(v,2);
cv(i,:)=single(vzm(:,i))'*V;
end
imshow(reshape(r,112,92));
axes(handles.axessearcheigen);
p=r-m;
s=single(p)'*V;
z=[];
for i=1:size(v,2)
z=[z,norm(cv(i,:)-s,2)];
if(rem(i,20)==0),imshow(reshape(v(:,i),112,92)),end;
drawnow;
end
[a,i]=min(z);
imshow(reshape(v(:,i),112,92));
axes(handles.axesfoundeigen);
I modified some code to show the pictures in axes. The code above and the Load and Search buttons work.
This is where i am stuck: I made a Open Image Button so i can open a specific image.

:
This is the code for the Open Image button
function open_image_Callback(hObject, eventdata, handles)
I tried this to open an image and put it in axis, but it does not work
function open_image_Callback(hObject, eventdata, handles)
global filename pathname I
[filename, pathname] = uigetfile('*.pgm');
axes(handles.axessearcheigen)
imgpath=STRCAT(pathname,filename);
I = imread(imgpath);
imagesc(I),axis off,colormap(gray(256))
The big question is: How i make this button to open a specific picture, and then replace somehow the:
ri=round(400*rand(1,1));
or whatever needs to be modified.
TL;DR: I want to open and search a specific picture, not a random one.
Thanks.
Risposte (0)
Categorie
Scopri di più su Semantic Segmentation in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!