Borrar filtros
Borrar filtros

check clickpoints points to the images and images in a folder is same

2 visualizaciones (últimos 30 días)
Sir, In the above code, the first click point checks the first image in a folder and if I select the next click point, it does not compare with the second click point rather automatically compares with the first image i.e. a1 and the second image in a folder. Please solve my issue as early as possible.
function [pts]=ImageClickCallback4 ( str1,a1,a2,a3,a4,a5,a6,n1)
global ii;
ii=1;
a1=rgb2gray(a1);
a2=rgb2gray(a2);
a3=rgb2gray(a3);
a4=rgb2gray(a4);
a5=rgb2gray(a5);
a6=rgb2gray(a6);
image_folder = 'C:\Users\maruthi1\Documents\MATLAB\User_reg\'
image_folder=strcat(image_folder,str1);
filenames = dir(fullfile(image_folder, '*.jpg')); % read all images with specified extention, its jpg in our case
total_images = numel(filenames);
if(~isequal(total_images,n1))
message = sprintf('Please enter correct number');
helpdlg(message);
end
for n = 1:total_images
full_name= fullfile(image_folder, filenames(n).name); % it will specify images names with full path and extension
our_images = imread(full_name);
our_images=rgb2gray(our_images);
%subplot(3,3,n);
% imshow(our_images) ; % Show all images
end
pts = zeros(2, n1);
% display image
xold = 0;
yold = 0;
k = 0;
hold on;
mp1=340;
% and keep it there while we plot
while 1
[xi, yi, but] = ginput(1); % get a point
if ~isequal(but, 1) % stop if not button 1
break
end
k = k + 1;
pts(1,k) = xi;
pts(2,k) = yi;
% count total number of photos present in that folder
if(xi<mp1)
if(yi<340)
if(corr2(a1,our_images)<0.91)
ii=ii+1;
end
else if((340<yi)&(yi<679))
if(corr2(a2,our_images)<0.91)
ii=ii+1;
disp('hai');
else
disp('nothing')
end
else
if((680<yi)&(yi<1020))
if(corr2(a3,our_images)<0.91)
ii=ii+1;
disp(ii);
disp('hallo');
%drawnow; % Force display to update immediately.
end
end
end
end
else
if(yi<340)
if(corr2(a4,our_images)==1)
ii=ii+1;
end
else
if((340<yi)&(yi<679))
if(corr2(a5,our_images)==1)
ii=ii+1;
end
else
if((680<yi)&(yi<1020))
if(corr2(a6,our_images)==1)
ii=ii+1;
end
end
end
end
end
if isequal(k, n1)
break;
end
xold = xi;
yold = yi;
end
hold off;
if k < size(pts,2)
pts = pts(:, 1:k);
end
if(ii<=n1)
disp(ii)
msgbox('wrong password');
end
end

Respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by