Hog+Camshift的人体跟踪

这几天跑了Opencv中的camshift算法,发现目标需要自己去选,够费劲的。

突然想要,是hog进行人体检测,然后用shift去跟踪是不是效果会好些。

camshift的跟踪还好,主要是hog的检测,opencv中hog检测的误检率还是很高的。

程序我直接拿来了opencv中现成的代码,也就是个简单的demo。大家看看,感觉下效果就可以了

如果需要更精确的效果,程序还需要很多优化,毕竟opencv中的camshift算法紧紧是重心的跟踪迭代。

程序如下:

#include <fstream>
#include <string>
#include <cv.h>
#include <highgui.h>
#include <ml.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include "cvaux.h"
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

using namespace cv;
using namespace std;

Rect r ;
int track_object = 0;

Rect ObjectDectd(IplImage* frame,int object,Rect r);
IplImage* MeanSift(IplImage *frame,Rect r);

int main()
{
	int number = 0;
	CvCapture* capture = 0;
	capture = cvCaptureFromAVI("112218.avi");

	if( !capture )
    {
        fprintf(stderr,"Could not initialize capturing...\n");
        return -1;
    }

	cvNamedWindow( "HogSiftDemo", 1 );

	for(;;)
	{
		cout<<number<<endl;
		number++;
		IplImage* frame = 0;
        frame = cvQueryFrame( capture );
		//frame
  • 0
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值