资源简介
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
- 上一篇:步进频距离像拼接仿真
- 下一篇:不确定度计算
相关资源
- 不确定度计算
- advisor 2002在高版本matlab下运行的补丁
- MATLAB编写计算有限长序列的DFT和IDFT函
- OFDM-BER-BPSK的matlab
- 牛顿迭代求解串联机器人运动学正解
- jpeg压缩的matlab实现
- 永磁同步电机matlab仿真
- ICP实现代码MATLAB
- RLS_算法matlab实现
- rbf函数逼近算法
-
SVPWM的simuli
nk仿真(附带Matlab funct - 蚁群算法matlab完整代码
- 相机标定源代码,c、matlab
- LMS算法及归一化LMS算法的MATLAB代码
- lmd算法MATLAB仿真程序
- matlab预处理共轭梯度法
- meanshift的matlab实现及2维图演示代码
- 利用matlab对瑞利衰落信道仿真
- 均匀球体与长方体重力异常正演模拟
- 小波降噪软硬阈值改进阈值matlab代码
- matlab处理Adams仿真KC结果生产报告的程
- 图像的面积计算
- 三电平逆变器
- matlab数据预测模型算法.rar
- 惯导IMU初始姿态解算粗对准MATLAB
- emd分解matlab程序172943
- 小波神经网络MATLAB代码.zip
- 现代控制系统第十二版配套matlab
- 三周期极小曲面建模代码
- 直方图均衡化Matlab源代码
评论
共有 条评论