function [bb,conf] = tldExample(opt)
global tld; % holds results and temporal variables
global tld2;
global tld3;
% INITIALIZATION ----------------------------------------------------------
opt.source = tldInitSource(opt.source); % select data source, camera/directory
figure(2); set(2,'KeyPressFcn', @handleKey); % open figure for display of results
finish = 0; function handleKey(~,~), finish = 1; end % by pressing any key, the process will exit
while 1
source = tldInitFirstFrame(tld,opt.source,opt.model.min_win); % get initial bounding box, return 'empty' if bounding box is too small
if ~isempty(source), opt.source = source; break; end % check size
end
% fprintf('bb2: (%f, %f) (%f, %f)\n', source.bbfixed(1), source.bbfixed(2), source.bbfixed(3), source.bbfixed(4));
% tld2.source.bb = source.bbfixed;
opt.id = 0;
tld = tldInit(opt,[]); % train initial detector and initialize the 'tld' structure
opt2 = opt;
opt2.id = 1;
opt2.source.bb = source.bbfixed1;
tld2 = tldInit(opt2, []);
opt3 = opt;
opt3.id = 2;
opt3.source.bb = source.bbfixed2;
tld3 = tldInit(opt3, []);
tld = tldDisplay(0,tld); % initialize display
fprintf('tld.bb = (%f, %f) (%f, %f)\n', tld.bb(1), tld.bb(2), tld.bb(3), tld.bb(4));
fprintf('tld2.bb = (%f, %f) (%f, %f)\n', tld2.bb(1), tld2.bb(2), tld2.bb(3), tld2.bb(4));
%tld2 = tldDisplay(0, tld2, tld.handle);
% RUN-TIME ----------------------------------------------------------------
for i = 2:length(tld.source.idx) % for every frame
% fprintf('\nFixed point: (%f, %f) (%f, %f)\n', tld2.source.bb(1), tld2.source.bb(2), tld2.source.bb(3), tld2.source.bb(4));
tld = tldProcessFrame(tld, i); % process frame i
tld2 = tldProcessFrame(tld2,i);
tld3 = tldProcessFrame(tld3,i);
tldDisplay(1,tld,tld2,tld3,i); % display results on frame i
% hold on;
% tld2 = tldDisplay(1,tld2,i);
if finish % finish if any key was pressed
if tld.source.camera
stoppreview(tld.source.vid);
closepreview(tld.source.vid);
close(1);
end
close(2);
bb = tld.bb; conf = tld.conf; % return results
return;
end
if tld.plot.save == 1
img = getframe;
imwrite(img.cdata,[tld.output num2str(i,'%05d') '.png']);
end
%{
idx = find(bb_isdef(tld.bb));
bb = (tld.bb(:,i));
bb = bb(:,idx(1));
fprintf('Robot: (%f, %f) (%f, %f)\n', bb(1), bb(2), bb(3), bb(4));
idx = find(bb_isdef(tld2.bb));
bb = (tld2.bb(:,i));
bb = bb(:,idx(1));
fprintf('Fixed point1: (%f, %f) (%f, %f)\n', bb(1), bb(2), bb(3), bb(4));
idx = find(bb_isdef(tld3.bb));
bb = (tld3.bb(:,i));
bb = bb(:,idx(1));
fprintf('Fixed point2: (%f, %f) (%f, %f)\n\n', bb(1), bb(2), bb(3), bb(4));
%}
end
bb = tld.bb; conf = tld.conf; % return results
end

 채택된 답변

Walter Roberson
Walter Roberson 2016년 4월 13일

0 개 추천

You are getting your source variable by calling tldInitFirstFrame, which appears to be a routine from OpenTLD. However, when I examine the source to that, no-where in the source does it refer to "bbfixed" .
If you are using a different version of OpenTLD you need to post the link.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Performance and Memory에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by