Recently I read an interesting paper "Real-time Compressive Tracking" which applied compressive sensing on object tracking to dramatically reduce the calculations and showed remarkable results. Kaihua Zhang (the author) kindly had released the source code(both Matlab and C++ versions) of the algorithm on his webpage.
A python binding
Personally I prefer to test algorithms with python, hence, I have tried to build a python binding of compressive tracking and tested it on my Mac.
Some results are as below:
and the source code can be found from this link.
This section will describe the main steps how I wrapped the C++ version of compressive tracking as the python binding and is not important in the aspect of usage. In case you are interested in the procedures, please keep reading.
compressive_tracker.cpp provides two public methods
init(Mat& _frame, Rect& _objectBox) and
processFrame(Mat& _frame, Rect& _objectBox),
_objectBox are the video frame and object box, respectively.
I added two public methods
init_wrap(vector<vector<uint8> > &_frame, vector<int> &_object_box) and
process_frame_wrap(vector<vector<uint8> > &_frame, vector<int> &_object_box) to wrap the methods
processFrame, which expect
vector array arguments instead of
Next, the cython files
wrap.pyx were created to wrap the C++ class
CompressiveTracker into the Python class
setup.py was added for compilation.
run.py is the testing code which will load the python binding for object tracking.
Frankly speaking, the existences of
process_frame_wrap come from that I don't know how to use cython to directly convert
numpy array into
Rect instances of OpenCv.
I will grateful if someone can show me how to do that : )