How to make a flashing movie? Please suggest any approach without application of any specific toolbox.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I am willing to make a video consists of 2 parts that are flashing and steady. The flashing could be in shape i.e circle or triangle. I created circle and dark with the following:
xCenter = 5;
yCenter = 6;
theta = 0 : 0.01 : 2*pi;
radius = 3;
x = radius * cos(theta) + xCenter;
y = radius * sin(theta) + yCenter;
plot(x, y);
fill(x,y,'k');
axis square;
xlim([0 10]);
ylim([0 12]);
axis equal;
set(gca,'Color','k')
And I want the flashing to continue for 17 seconds and steady for 17 seconds repeating 10 times each.
0 Commenti
Risposta accettata
Geoff Hayes
il 5 Mag 2020
Yanjinsuren - do you really mean to create a movie (say with videowriter) or do you just want to have the circle alternate between black (on the black background) and white as per your requirements? To get you started on those, just keep the handle to the fill object, and change it's colour every one second. Something like
hFill = fill(x,y,'k');
axis square;
xlim([0 10]);
ylim([0 12]);
axis equal;
set(gca,'Color','k')
% use colour array [0 0 0] for black
color = [0 0 0];
set(hFill,'FaceColor',color);
for j = 1:10
for k = 1:17
% alternate between black [0 0 0] and white [1 1 1]
set(hFill,'FaceColor',mod(get(hFill,'FaceColor') + 1, 2));
pause(1.0);
end
pause(17);
end
Start with the above and try adding the video writer as needed.
2 Commenti
Geoff Hayes
il 5 Mag 2020
Just pause for sixty seconds between trials if you want all black:
for k = 1:17
% alternate between black [0 0 0] and white [1 1 1]
set(hFill,'FaceColor',mod(get(hFill,'FaceColor') + 1, 2));
pause(1.0);
end
set(hFill,'FaceColor',[0 0 0]);
pause(60);
end
Più risposte (0)
Vedere anche
Categorie
Scopri di più su MATLAB Support Package for IP Cameras in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!