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

조회 수: 3 (최근 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