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

5 views (last 30 days)
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

Answers (1)

Image Analyst
Image Analyst on 30 Jul 2020

Categories

Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!