-
Notifications
You must be signed in to change notification settings - Fork 0
/
Video.m
29 lines (29 loc) · 841 Bytes
/
Video.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
close all
clear all
%Buscar y abrir el directorio trabajo
ImFolder = uigetdir;
%crear directorio de trabajo
pngFile = dir(strcat(ImFolder, '\*.jpg'));
%Formar arreglo con imagenes
S = [pngFile(:).datenum];
%ordenar los elementos de la matriz
[S,S] = sort(S);
%Guardar arreglo en otra variable
pngFiles = pngFile(S);
%Generar directorio del video
VideoFile = strcat(ImFolder,'\Video');
%Escribir en la carpeta de Video
writeObj = VideoWriter(VideoFile);
%Cuadros por segundos
fps = 60;
%Asignar los frames por segundo a objeto
writeObj.FrameRate = fps;
%Abrir el archivo de video
open(writeObj);
%utilizar im cocñp ára formar el video de imagenes
for t=1:length(pngFiles)
Frame = imread(strcat(ImFolder,'\',pngFiles(t).name));
writeVideo(writeObj,im2frame(Frame));
end
%Cerrar el archivo
close(writeObj);