How to make a flashing movie? Please suggest any approach without application of any specific toolbox.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Yanjika O
el 4 de Mayo de 2020
Comentada: Geoff Hayes
el 5 de Mayo de 2020
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 comentarios
Respuesta aceptada
Geoff Hayes
el 5 de Mayo de 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 comentarios
Geoff Hayes
el 5 de Mayo de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Support Package for IP Cameras en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!