资源简介
KCF全称为Kernel Correlation Filter 核相关滤波算法。是在2014年由Joao F. Henriques, Rui Caseiro, Pedro Martins, and Jorge Batista提出来的。本程序是KCF算法的python实现
代码片段和文件信息
import numpy as np
import cv2
from numba import jit
# constant
NUM_SECTOR = 9
FLT_EPSILON = 1e-07
@jit
def func1(dx dy boundary_x boundary_y height width numChannels):
r = np.zeros((height width) np.float32)
alfa = np.zeros((height width 2) np.int)
for j in xrange(1 height-1):
for i in xrange(1 width-1):
c = 0
x = dx[j i c]
y = dy[j i c]
r[j i] = np.sqrt(x*x + y*y)
for ch in xrange(1 numChannels):
tx = dx[j i ch]
ty = dy[j i ch]
magnitude = np.sqrt(tx*tx + ty*ty)
if(magnitude > r[j i]):
r[j i] = magnitude
c = ch
x = tx
y = ty
mmax = boundary_x[0]*x + boundary_y[0]*y
maxi = 0
for kk in xrange(0 NUM_SECTOR):
dotProd = boundary_x[kk]*x + boundary_y[kk]*y
if(dotProd > mmax):
mmax = dotProd
maxi = kk
elif(-dotProd > mmax):
mmax = -dotProd
maxi = kk + NUM_SECTOR
alfa[j i 0] = maxi % NUM_SECTOR
alfa[j i 1] = maxi
return r alfa
@jit
def func2(dx dy boundary_x boundary_y r alfa nearest w k height width sizeX sizeY p stringSize):
mapp = np.zeros((sizeX*sizeY*p) np.float32)
for i in xrange(sizeY):
for j in xrange(sizeX):
for ii in xrange(k):
for jj in xrange(k):
if((i * k + ii > 0) and (i * k + ii < height - 1) and (j * k + jj > 0) and (j * k + jj < width - 1)):
mapp[i*stringSize + j*p + alfa[k*i+iij*k+jj0]] += r[k*i+iij*k+jj] * w[ii0] * w[jj0]
mapp[i*stringSize + j*p + alfa[k*i+iij*k+jj1] + NUM_SECTOR] += r[k*i+iij*k+jj] * w[ii0] * w[jj0]
if((i + nearest[ii] >= 0) and (i + nearest[ii] <= sizeY - 1)):
mapp[(i+nearest[ii])*stringSize + j*p + alfa[k*i+iij*k+jj0]] += r[k*i+iij*k+jj] * w[ii1] * w[jj0]
mapp[(i+nearest[ii])*stringSize + j*p + alfa[k*i+iij*k+jj1] + NUM_SECTOR] += r[k*i+iij*k+jj] * w[ii1] * w[jj0]
if((j + nearest[jj] >= 0) and (j + nearest[jj] <= sizeX - 1)):
mapp[i*stringSize + (j+nearest[jj])*p + alfa[k*i+iij*k+jj0]] += r[k*i+iij*k+jj] * w[ii0] * w[jj1]
mapp[i*stringSize + (j+nearest[jj])*p + alfa[k*i+iij*k+jj1] + NUM_SECTOR] += r[k*i+iij*k+jj] * w[ii0] * w[jj1]
if((i + nearest[ii] >= 0) and (i + nearest[ii] <= sizeY - 1) and (j + nearest[jj] >= 0) and (j + nearest[jj] <= sizeX - 1)):
mapp[(i+nearest[ii])*stringSize + (j+nearest[jj])*p + alfa[k*i+iij*k+jj0]] += r[k*i+iij*k+jj] * w[ii1] * w[jj1]
mapp[(
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-01-06 15:52 KCFpy-master\
文件 1061 2017-01-06 15:52 KCFpy-master\LICENSE
文件 1807 2017-01-06 15:52 KCFpy-master\README.md
文件 12483 2017-01-06 15:52 KCFpy-master\fhog.py
文件 11668 2017-01-06 15:52 KCFpy-master\kcftracker.py
文件 2420 2017-01-06 15:52 KCFpy-master\run.py
相关资源
- python内置K-means聚类算法对鸢尾花数据
- 指定步数节点内容的PROCAST仿真结果导
- python自然语言处理中文停用词
- 最好中国大学近几年排名及python爬虫
- Tensorflow-BiLSTM分类
- 感知机算法Python实现
- python 实现将TXT文件内容逐行存到EXC
- python 打开并计算两幅dicom图像感兴趣
- python 决策树代码
- 银行ATM系统(Python实现)
- pygame实现的贪吃蛇游戏RetroSnaker.py
- Python文件
- QT文件转换成Python的自动化工具*.ui转
- fcntl模块 win
- python爬虫爬取企业详细信息
- Kruskal算法python实现
- 蚁群算法的python代码
- 最小二乘法python代码,不用库函数
- sm3 python encode
- openopc for python 3.x
- 张正友相机标定Python代码
- Python调用QQ微信截图
- python图像裁剪
- 海明校验 python源代码 海明码
- mod_wsgi.so
- Python 强大的图论和网络研究工具 ne
- python从入门到精通视频60集全
- wheel 安装包
- Python程序设计与算法基础教程源代码
- python数据处理csv->图表
评论
共有 条评论