function results=vivid_trackers (seq, res_path bSaveImage, trackerIdx)
Fstart=seq. StartFrame;
S_frames=seq. S_frames;
Im=imread (s_frames {1});
% if the size (im, 3)==1
% results. The info='Gray! Needs color input ';
% results. The res=[];
% return;
% end
If the size (im, 3)==1
ImRGB (:, :, 1)=im;
ImRGB (:, :, 2)=im;
ImRGB (:, :, 3)=im;
Im=uint8 (imRGB);
End
% the get size
Nrows=size (im, 1);
Ncols=size (im, 2);
% the display image
If bSaveImage
Imshow (im)
End
% the get object mask;
ObjMask=zeros (nrows, ncols) * 255;
ObjMask=uint8 (objMask);
% the get object bounding box
R=seq. Init_rect;
Left=r (1);
Top=r (2);
Right=r (1) + r (3) - 1;
Bottom=r (2) + r (4) - 1;
ObjMask (top, bottom, left, right)=255;
ObjBox=[left, right, top, bottom);
% figure (1);
If bSaveImage
ObjBox drawboxmm (objBox (1), (2), objBox (3), objBox (4), 'b', 3);
End
% the use object mask or not
MaskFlag=0;
% tracker selection
% trackerIdx=3;
Tracker_name=[];
% the initialize the tracker on the first frame
The switch trackerIdx
Case 1
If maskFlag==1
InitModel=tkTemplateMatch_Init (im, objBox objMask);
The else
InitModel=tkTemplateMatch_Init (im, objBox);
End
Case 2
If maskFlag==1
InitModel=tkMeanShift_Init (im, objBox objMask);
The else
InitModel=tkMeanShift_Init (im, objBox);
End
Case 3
If maskFlag==1
InitModel=tkVarianceRatio_Init (im, objBox objMask);
The else
InitModel=tkVarianceRatio_Init (im, objBox);
End
Case 4
If maskFlag==1
InitModel=tkPeakDifference_Init (im, objBox objMask);
The else
InitModel=tkPeakDifference_Init (im, objBox);
End
Case 5
If maskFlag==1
InitModel=tkRatioShift_Init (im, objBox objMask);
The else
InitModel=tkRatioShift_Init (im, objBox);
End
End
Now go to % next frame...
Nextframe fstart=+ 1;
Res=zeros (seq. Len, 4);
Res (1, :)=seq. Init_rect;
TotalTime=0;
For t=2: seq. Len
% the read the next frame
Im=imread (s_frames {t});
If the size (im, 3)==1
ImRGB (:, :, 1)=im;
ImRGB (:, :, 2)=im;
ImRGB (:, :, 3)=im;
Im=uint8 (imRGB);
End
% fprintf (' # % d \ n 't);
% the display image
% figure (1); CLF.
% imagesc (im)
% % axis equal;
If bSaveImage
Imshow (im)
End
Tic
The switch trackerIdx
Case 1
[rstBox, objMask]=tkTemplateMatch_Next (initModel, im, objBox);
Case 2
[rstBox, objMask]=tkMeanShift_Next (initModel, im, objBox);
Case 3
[rstBox, objMask]=tkVarianceRatio_Next (initModel, im, objBox);
Case 4
[rstBox, objMask]=tkPeakDifference_Next (initModel, im, objBox);
Case 5
[rstBox, objMask]=tkRatioShift_Next (initModel, im, objBox);
End
TotalTime=totalTime + toc;
W=rstBox (2) - rstBox (1) + 1;
% h=rstBox (4) - rstBox (3) + 1;
If w & lt; Seq. Init_rect (3)
If rstBox (1) + seq. Init_rect & lt; (3) - 1=size (im, 2)
=rstBox rstBox (2) (1) + seq. Init_rect (3) - 1;
The else
=rstBox rstBox (1) (2) - seq. Init_rect (3) + 1;
End
End
If h & lt; Seq. Init_rect (4)
If rstBox (3) + seq. Init_rect & lt; (4) - 1=size (im, 1)
RstBox (4)=rstBox (3) + seq. Init_rect (4) - 1;
The else
=rstBox rstBox (3) (4) - seq. Init_rect (4) + 1;
End
End
%
% if w & lt; 5
% rstBox (2)=rstBox (1) + 4;
% end
%
% if h & lt; 5
% rstBox (4)=rstBox (3) + 4;
% end
ObjBox=rstBox;
Res (t)=[objBox (1), objBox (3), objBox (2) - objBox (1) + 1, objBox (4) - objBox (3) + 1);
% inner bounding box (containing object)
% figure (1);
If bSaveImage
ObjBox drawboxmm (objBox (1), (2), objBox (3), objBox (4), 'r', 4);
The text (10, 15, [' # 'num2str (t)],' Color ', 'y', 'FontWeight', 'bold', 'FontSize, 24).
Imwrite (frame2im (getframe (GCF)), sprintf (' % % s/4 d. The JPG, res_path, t));
End
% the display mask
% figure (3); CLF.
% imagesc (objMask)
End % loop back and continue
The type='the rect';
Results. The res=res;
The FPS=(seq. Len - 1)/totalTime;
Disp ([' FPS: 'num2str (the FPS)])
Problem: run to 58 line switch function, no matter what situation will automatically jump back to the main function of the switch function in the function called no. M file, but there are. DLL files, the problem I don't know what where, specific folders and files as shown in figure: