资源简介
c++ 实现 ,基于opencv的 视觉跟踪 代码,使用前请按照网上教程正确配置opencv3。
代码片段和文件信息
#include “opencv2/core.hpp“
#include “opencv2/imgproc.hpp“
#include “opencv2/highgui.hpp“
#include “opencv2/videoio.hpp“
#include
#include
#include
#include
#include
#include
#include
//#include
//#pragma comment ( lib “kinect20.lib“ )
using namespace cv;
using namespace std;
int main() {
// can change to BOOSTING MIL KCF (OpenCV 3.1) TLD MEDIANFLOW or GOTURN (OpenCV 3.2)
Ptr tracker = Tracker::create(“KCF“);
VideoCapture video(0);
if (!video.isOpened()) {
cerr << “cannot read video!“ << endl;
return -1;
}
Mat frame;
video.read(frame);
Rect2d box(270 120 180 260);
tracker->init(frame box);
while (video.read(frame)) {
tracker->update(frame box);
rectangle(frame box Scalar(255 0 0) 2 1);
imshow(“Tracking“ frame);
char k = waitKey(1);
if (k == 27) break;
else if (k == ‘f‘)
{
cout<<“!!!“< Rect2d box1(10 10 180 260);
box = box1;
Ptr tracker1 = Tracker::create(“KCF“);
tracker1->init(frame box);
tracker = tracker1;
}
}
}
//#include “opencv2/core.hpp“
//#include “opencv2/imgproc.hpp“
//#include “opencv2/highgui.hpp“
//#include “opencv2/videoio.hpp“
//#include
//#include
//#include
//#include
//#include
//#include
//#include
//#include
//#include
//#pragma comment ( lib “kinect20.lib“ )
//
//using namespace cv;
//using namespace std;
//
//const string fileform = “.jpg“;
//const string perfileReadPath = “Samples“;
//const string perfileBackPath = “Backs“;
//
//string fileName filePath;
//char tempc[256];
//int flagback = 0 k = 0 j = 0;//每一类读取图像个数计数
//
//int main()
//{
// HRESULT hResult; //用于检测操作是否成功
// IKinectSensor *kinect; //创建一个感应器
// GetDefaultKinectSensor(&kinect);
// kinect->Open(); //打开感应器
// IColorframeSource *colorsource;
// IColorframeReader *colorreader;
// iframeDescription *colorde;
// kinect->get_ColorframeSource(&colorsource);
// colorsource->OpenReader(&colorreader);
// colorsource->get_frameDescription(&colorde);
// Rect2d roi;
// Ptr tracker = Tracker::create(“KCF“);
// int width = 0; //长和宽
// int hight = 0;
// colorde->get_Height(&hight);
// colorde->get_Width(&width);
// Mat a(hight width CV_8UC4); //注意:这里必须为4通道的图,Kinect的数据只能以Bgra格式传出
// Mat trac;
// Mat roi1 roi2;
// int backwidth backheight;
// int flag = 0;
//
// cout << “\n\nHot keys: \n“
// “\tESC - quit the program\n“
// “\ts - save the picture you want \n“
// “\tb - save the backup picture you want \n“ << endl;
//
// while(flag==0)
// {
//
// IColorframe*frame;
// hResult = colorreader->AcquireLatestF
- 上一篇:C语言练习指针及答案
- 下一篇:野人和传教士过河问题
相关资源
- vc++6.0配置OpenCV
- 基于OpenCV的图像检索系统(源码)
- test_opencv.cpp
- opencv提取图片中人轮廓
- Python3+Opencv343环境搭建 dll load failed问
- 04_图像编辑器实现.zip
- 基于opencv人眼定位算法C++工程
- 图像连续拼接算法源码
- opencv 2.4.8 官方最新版安装与配置
- C++实现opencv+yolo+tensorflow+deepsort.txt
- Opencv封装成dll供.net调用方法
- 相机标定棋盘
- 自适应图像增强完整OpenCV代码
- 在mfc中picture控件中显示Mat图片
- OpenCv实现两个图片的相似度
- opencv椭圆拟合长短轴比
- Retinex算法,C++,opencv
- 利用opencv实现的条形码检测与识别C
- Opencv2.4.12 SVM手写数字识别
- opencv 正脸+左右侧脸全检测
- 激光雷达数据读取、显示、分割、直
- CvvImage类库
- 基于opencv的C++人眼识别以及眨眼检测
- 在VS2012上基于opencv的C++人眼识别与眨
- 基于暗通道和导向滤波的图像去雾算
- 根据原图和二值图得到分割彩图
- qt界面化实现各种滤波函数
- c#通过dll读取opencv里的mat图片
- linux opencv车牌识别
- opencv多视频同一窗口显示C++程序
评论
共有 条评论