how can i take ginput from an image until close the figure and after closing figure how can start next image from folder

5 次查看(过去 30 天)
clear all
close all
% h = imshow('1.jpg');
% hp = impixelinfo;
% set(hp,'Position',[5 1 300 20]);
% pixel=[];
% for i=1:10
% [x,y]=ginput(1)
% pixel(i,:)=[x,y];
% end
%%
%DATASET
pixel=[];
folder{1}='D:\MathLab Works\Calltech\Database\Buddha\';
%%
nClass = size(folder,3);
class=0;
k=0;
for clNo = 1:nClass
folderName=folder{clNo};
fnames = dir(strcat(folderName,'*.jpg'));
label=0;
class=class+1;
for imgNo = 1:round(length(fnames))
fname = fnames(imgNo).name
fullpath = strcat(folderName,fname);
img = imread(fullpath);
% f = imagesc; %Some Figure
f=figure
imshow(img);
while size(findobj(f))>0
% 'me' %some action
label=label+1;
hold on
hp = impixelinfo;
set(hp,'Position',[5 1 300 20]);
for i=1:5
[x,y]=ginput(1)
plot(x,y,'*r')
k=k+1;
pixel(k,:)=[class,label,x,y];
end
% pause %some input
end
end
end

回答(1 个)

Image Analyst
Image Analyst 2020-7-30

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by