How i can loop a video until a button is pushed or a condition is given?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have my code already set down. but i am having problems with telling Matlab how I can continues executing the code until the user closes the video, or Give it a condition for stopping.
vid=videoinput('winvideo',1);
figure(3);preview(vid);
set(vid,'ReturnedColorspace','rgb')
img = getsnapshot(vid);
figure (2); imagesc(img);
red = img(:,:,1); % Canal Rojo
green = img(:,:,2); % Canal Verde
blue = img(:,:,3); % Canal Azul
a = zeros(size(img, 1), size(img, 2));
just_red = cat(3, red, a, a);
just_green = cat(3, a, green, a);
just_blue = cat(3, a, a, blue);
I= just_red - just_green;
I2=im2bw(I, graythresh(I));
I3= bwareaopen(I2, 100);
se=strel('disk',6);
I4=imclose(I3,se);
Ic=imfill(I4,'holes');
I tried with a toggle button, but i a newbie, and i know nothing about programming.
Thanks, Alex
1 Kommentar
Stephen23
am 26 Jul. 2015
Bearbeitet: Stephen23
am 26 Jul. 2015
This time I formatted your code for you, but in future you can do this yourself by simply selecting the code and then pressing the {} Code button that you will find above the textbox. And please do not put empty lines between every line of your code: this is a waste of your time and ours.
Antworten (1)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!