资源简介
matlab图片合成视频

代码片段和文件信息
function [img_files] = load_video_info(video_path)
%[img_files pos target_sz resize_image ground_truth ...
% video_path] = load_video_info(video_path)
%LOAD_VIDEO_INFO
% Loads all the relevant information for the video in the given path:
% the list of image files (cell array of strings) initial position
% (1x2) target size (1x2) whether to resize the video to half
% (boolean) and the ground truth information for precision calculations
% (Nx2 for N frames). The ordering of coordinates is always [y x].
%
% The path to the video is returned since it may change if the images
% are located in a sub-folder (as is the default for MILTrack‘s videos).
%
% Jo鉶 F. Henriques 2012
% http://www.isr.uc.pt/~henriques/
%% load ground truth from text file (MILTrack‘s format)
% text_files = dir([video_path ‘*_gt.txt‘]);
% assert(~isempty(text_files) ‘No initial position and ground truth (*_gt.txt) to load.‘)
%
% f = fopen([video_path text_files(1).name]);
% ground_truth = textscan(f ‘%f%f%f%f‘); %[x y width height]
% ground_truth = cat(2 ground_truth{:});
% fclose(f);
%% set initial position and size
% target_sz = [ground_truth(14) ground_truth(13)];
% pos = [ground_truth(12) ground_truth(11)] + floor(target_sz/2);
%% interpolate missing annotations and store positions instead of boxes
% try
% ground_truth = interp1(1 : 5 : size(ground_truth1) ...
% ground_truth(1:5:end:) 1:size(ground_truth1));
% ground_truth = ground_truth(:[21]) + ground_truth(:[43]) / 2;
% catch %#ok wrong format or we just don‘t have ground truth data.
% ground_truth = [];
% end
%% list all frames. first try MILTrack‘s format where the initial and
%final frame numbers are stored in a text file. if it doesn‘t work
%try to load all png/jpg files in the folder.
text_files = dir([video_path ‘*_frames.txt‘]);
if ~isempty(text_files)
f = fopen([video_path text_files(1).name]);
frames = textscan(f ‘%f%f‘);
fclose(f);
%see if they are in the ‘imgs‘ subfolder or not
if exist([video_path num2str(frames{1} ‘imgs/img%05i.png‘)] ‘file‘)
video_path = [video_path ‘imgs/‘];
elseif ~exist([video_path num2str(frames{1} ‘img%05i.png‘)] ‘file‘)
error(‘No image files to load.‘)
end
%list the files
img_files = num2str((frames{1} : frames{2})‘ ‘img%05i.png‘);
img_files = cellstr(img_files);
else
%no text file just list all images
img_files = dir([video_path ‘*.png‘]);
if isempty(img_files)
img_files = dir([video_path ‘*.jpg‘]);
assert(~isempty(img_files) ‘No image files to load.‘)
end
img_files = sort({img_files.name});
end
%% if the target is too large use a lower resolution - no need for so
%much detail
% if sqrt(prod(target_sz)) >= 100
% pos = floor(pos / 2);
% target_sz = floor(target_sz / 2);
% resize_image = true;
% else
% resize_image = false;
% end
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3004 2014-03-20 14:26 loadImgSequenceInfo.m
文件 780 2014-03-24 15:39 pic2video.m
----------- --------- ---------- ----- ----
3784 2
- 上一篇:步进频距离像拼接仿真
- 下一篇:不确定度计算
相关资源
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论