struck 利用结构化SVM来实现视觉跟踪,在深度学习流行起来之前,struck是视觉跟踪领域效果最好的方法。深度学习流行之后,利用泛化的卷积特征能够得到很好的效果。struck的优点在于,它可以使用任意的特征来实现跟踪,因此它可以利用卷积神经网络提取的特征,然后结合结构化SVM来实现视觉跟踪,这样的效果说不定更好。
struck的源码是C++实现的,作者写的很好,思路清晰,代码结构清晰,而且与论文中的相符,没有那么多小trick,结果比较可靠。
下面从它的主函数开始,分析这份源码是如何实现的:
main.cpp
/*
* Struck: Structured Output Tracking with Kernels
*
* Code to accompany the paper:
* Struck: Structured Output Tracking with Kernels
* Sam Hare, Amir Saffari, Philip H. S. Torr
* International Conference on Computer Vision (ICCV), 2011
*
* Copyright (C) 2011 Sam Hare, Oxford Brookes University, Oxford, UK
*
* This file is part of Struck.
*
* Struck is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Struck is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Struck. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "Tracker.h"
#include "Config.h"
#include <iostream>
#include <fstream>
#include <opencv/cv.h>
#include <opencv/highgui.h>
using namespace std;
using namespace cv;
static const int kLiveBoxWidth = 80;
static const int kLiveBoxHeight = 80;
void rectangle(Mat& rMat, const FloatRect& rRect, const Scalar& rColour)
{
IntRect r(rRect);
rectangle(rMat, Point(r.XMin(), r.YMin()), Point(r.XMax(), r.YMax()), rColour);
}
int main(int argc, char* argv[])
{
//这几句话没啥作用,我给注释掉