uoip/KCFcpp-py-wrapper 使用说明: c++ 的kcf 通过cython 被python 调用

相关解释:https://docs.opencv.org/3.4.1/d0/d0a/classcv_1_1Tracker.html#a549159bd0553e6a8de356f3866df1f18

 retval, boundingBox=cv.Tracker.update(image)

I write a python wrapper for KCFcpp, some of the code are modified from http://nicellama.blogspot.com/2015/06/cython-wrapper-between-opencv-mat-in-c.html .

 

Requirements

  • Python 2.7
  • NumPy
  • Cython
  • OpenCV (both C++ and Python interfaces)

 

Build

python setup.py build_ext --inplace

or

python setup.py install

先用python 的setup.py 打包,这里可以看以前python的视频

Usage

python run.py
python run.py 1
python run.py test.avi

 

References

  1. Cython: A Guide for Python Programmers by Kurt Smith
  2. Cython wrapper between opencv Mat in C++ and numpy http://nicellama.blogspot.com/2015/06/cython-wrapper-between-opencv-mat-in-c.html

 


ORIGINAL README:

 

C++ KCF Tracker

This package includes a C++ class with several tracking methods based on the Kernelized Correlation Filter (KCF) [1, 2].
It also includes an executable to interface with the VOT benchmark.

[1] J. F. Henriques, R. Caseiro, P. Martins, J. Batista,
"High-Speed Tracking with Kernelized Correlation Filters", TPAMI 2015.

[2] J. F. Henriques, R. Caseiro, P. Martins, J. Batista,
"Exploiting the Circulant Structure of Tracking-by-detection with Kernels", ECCV 2012.

Authors: Joao Faro, Christian Bailer, Joao F. Henriques
Contacts: joaopfaro@gmail.com, Christian.Bailer@dfki.de, henriques@isr.uc.pt
Institute of Systems and Robotics - University of Coimbra / Department of Augmented Vision DFKI

 

Algorithms (in this folder)

"KCFC++", command: ./KCF
Description: KCF on HOG features, ported to C++ OpenCV. The original Matlab tracker placed 3rd in VOT 2014.

说明:KCF on HOG特性,移植到c++ OpenCV。最初的Matlab跟踪器在VOT 2014年排名第三。

"KCFLabC++", command: ./KCF lab
Description: KCF on HOG and Lab features, ported to C++ OpenCV. The Lab features are computed by quantizing CIE-Lab colors into 15 centroids, obtained from natural images by k-means.

“KCFLabC++”,命令:./KCF lab

说明:KCF on HOG和Lab特性,移植到c++ OpenCV。lab特征的计算是将 CIE-Lab颜色量化为15个质心,通过k-means从自然图像中获得。

Lab模式弥补了 RGB与CMYK两种彩色模式的不足,是Photoshop用来从一种色彩模式向另一种色彩模式转换时使用的一种内部色彩模式。Lab模式也是由三个通道组成,第一个通道是明度,即“L”。a通道的颜色是从红色到深绿;b通道则是从蓝色到黄色 [1] 

Lab经常用做CIE 1976 (L, a, b)色彩空间的非正式缩写(也叫做CIELAB,它的坐标实际上是L, a和b)。

The CSK tracker [2] is also implemented as a bonus, simply by using raw grayscale as features (the filter becomes single-channel).

CSK跟踪器[2]也被实现为一个额外的功能,简单地使用原始灰度作为特性(过滤器变成单通道)。

 

Compilation instructions

There are no external dependencies other than OpenCV 3.0.0. Tested on a freshly installed Ubuntu 14.04.

除了OpenCV 3.0.0之外,没有其他外部依赖项。在新安装的Ubuntu 14.04上进行测试。

  1. cmake CMakeLists.txt
  2. make

 

Running instructions

The runtracker.cpp is prepared to be used with the VOT toolkit.

The executable "KCF" should be called as:

./KCF [OPTION_1] [OPTION_2] [...]

 

Options available:

gray - Use raw gray level features as in [1].
hog - Use HOG features as in [2].
lab - Use Lab colorspace features.

This option will also enable HOG features by default.
默认情况下,此选项还将启用HOG特性。
singlescale - Performs single-scale detection, using a variable-size window.
使用可变大小的窗口执行单尺度检测。
fixed_window - Keep the window size fixed when in single-scale mode (multi-scale always used a fixed window).
show - Show the results in a window.
fixed_window——在单尺度模式下保持窗口大小不变(多尺度总是使用一个固定的窗口)。显示-在窗口中显示结果。

 

To include it in your project, without the VOT toolkit you just need to:

在没有VOT工具包的情况下,您只需要:

// Create the KCFTracker object with one of the available options
KCFTracker tracker(HOG, FIXEDWINDOW, MULTISCALE, LAB);

// Give the first frame and the position of the object to the tracker
tracker.init( Rect(xMin, yMin, width, height), frame );

// Get the position of the object for the new frame
result = tracker.update(frame);
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

计算机视觉-Archer

图像分割没有团队的同学可加群

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值