Help me to make the Pause button and Stop button.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
This loop process I put into the start button.
while(vid.FramesAcquired<=2000)
data = getsnapshot(vid);
diff_im = imsubtract(data(:,:,1), rgb2gray(data));
diff_im = medfilt2(diff_im, [3 3]);
diff_im = im2bw(diff_im,0.18);
diff_im = bwareaopen(diff_im,300);
bw = bwlabel(diff_im, 8);
stats = regionprops(bw, 'BoundingBox', 'Centroid');
imshow(data)
hold on
for object = 1:length(stats)
bb = stats(object).BoundingBox;
bc = stats(object).Centroid;
rectangle('Position',bb,'EdgeColor','r','LineWidth',2)
plot(bc(1),bc(2), '-m+')
a=text(bc(1)+15,bc(2), strcat('X: ', num2str(round(bc(1))), ' Y: ', num2str(round(bc(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12, 'Color', 'yellow');
end
of the loop 2000 times I want to create a pause button and stop button for the loop process, please script what should I put the pause button and stop button?
2 Kommentare
Image Analyst
am 26 Nov. 2015
hardik, I'm not sure what you're asking. I made a demo in GUIDE and it does work despite saiful not coming back and Accepting the answer. The m-file has the code in it. GUIDE created the basic function for the button and then I went in and added some custom code to do that you and saiful asked for. So please explain your request in more detail, because at this point all I can guess is that you didn't see my answer.
Antworten (1)
Image Analyst
am 29 Jul. 2015
It should be trivial for you to adapt this. See attached. After looking at the demo, let me know if you can't figure out how to pause the loop.
2 Kommentare
Image Analyst
am 1 Aug. 2015
Yes, I'd be happy to try. If you had no problem and this gave you the solution, you can "Accept this answer". Doing that marks the answer as solved and gives the answerer credit for the solution.
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!