摄像头对物体进行跟踪kcf算法

本文介绍如何利用KCF(Kernelized Correlation Filter)算法在OpenCV中实现摄像头物体跟踪。作者提供了修改后的runkcftracker.cpp代码,适用于视频和摄像头的实时跟踪场景。
摘要由CSDN通过智能技术生成

KCF作者主页http://www.robots.ox.ac.uk/~joao/circulant/
代码谨是对runtracker.cpp进行了修改,以便支持对视频和摄像头的跟踪,源代码是对图像序列的跟踪。

贴出修改后的runkcftracker.cpp

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

#include "kcftracker.hpp"
using namespace std;
using namespace cv;
bool drawing_box = false;
bool gotBB = false;
Rect box;
//画矩形框
void drawBox(Mat& image, CvRect box, Scalar color, int thick){
   
	rectangle(image, cvPoint(box.x, box.y), cvPoint(box.x + box.width, box.y + box.height), color, thick);
}
//鼠标追踪函数
void mouseHandler(int event, int x, int y, int flags, void *param){
   
	switch (
  • 2
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值