【OpenCV】动态目标检测(背景/场景)
来源:互联网 发布:淘宝助理图片空间上传 编辑:程序博客网 时间:2024/06/07 05:37
// OpenCV3Contrib.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <opencv2/opencv.hpp> //头文件#include <opencv2/xfeatures2d.hpp>#include <opencv2/core/utility.hpp>#include <opencv2/tracking.hpp>#include <opencv2/videoio.hpp>#include <opencv2/highgui.hpp>#include <iostream>#include <cstring>using namespace cv; //包含cv命名空间using namespace std;int _tmain(int argc, _TCHAR* argv[]){Mat Frame;Mat FrameMat;Mat FrMat;Mat BkMat;// std::string video = argv[1];VideoCapture cap("Duan2.mp4");//VideoCapture cap("Move.mpg");// get bounding boxcap >> Frame;int totalFrameNumber = cap.get(CV_CAP_PROP_FRAME_COUNT);namedWindow("Video", 1);namedWindow("Threshold", 1);namedWindow("Background", 1);namedWindow("Foreground", 1);// perform the tracking processprintf("Start the tracking process, press ESC to quit.\n");for (int nFrmNum = 1; nFrmNum < totalFrameNumber; nFrmNum++) {cout << nFrmNum << endl;// get frame from the videocap >> Frame;if (nFrmNum == 1){cvtColor(Frame, BkMat, CV_BGR2GRAY);cvtColor(Frame, FrMat, CV_BGR2GRAY);}else{cvtColor(Frame, FrameMat, CV_BGR2GRAY);absdiff(FrameMat, BkMat, FrMat);threshold(FrMat, FrameMat, 30, 255, CV_THRESH_BINARY);Mat element = getStructuringElement(MORPH_RECT, Size(3, 3));erode(FrameMat, FrameMat, element);dilate(FrameMat, FrameMat, element);imshow("Video", FrameMat);imshow("Threshold", Frame);imshow("Background", BkMat);imshow("Foreground", FrMat);}if (waitKey(1) == 27)break;}waitKey(0);return 0;}
0 0
- 【OpenCV】动态目标检测(背景/场景)
- 【opencv】动态背景下运动目标检测 SURF配准差分
- 基于opencV的动态背景下运动目标检测及跟踪(修改版)
- 【opencv】动态背景下运动目标检测 FAST+SURF+FLANN配准差分 17/12/13更新图片
- 动态背景下的运动目标检测
- 目标检测——CodeBook背景建模(原理+Opencv实现代码)
- C++利用帧差法背景差分实现运动目标检测(opencv)
- OpenCV实现静止背景下运动目标的检测
- opencv程序十七:运动目标检测之背景减除法
- OpenCV实现静止背景下运动目标的检测
- 【OPENCV】基于背景差法的运动目标检测
- OpenCV实现静止背景下运动目标的检测
- 一种动态背景下的运动小目标检测方法
- opencv学习---运动目标(前景)检测
- openCV目标检测学习笔记(一)
- OpenCV运动目标检测
- opencv 运动目标检测
- 目标检测 OpenCV
- 启动第一个mongodb服务器
- 如何制作嵌入式Linux虚拟机
- Spring框架学习(第三讲)
- Linux环境下模拟鼠标操作
- socket中的函数遇见EINTR的处理
- 【OpenCV】动态目标检测(背景/场景)
- ORACLE 中SCHEMA的概念以及数据库,表空间,数据文件等的区别
- 得到一个field在结构体(struct type)中的偏移量
- 第14周项目1-(4)验证平衡二叉排序树相关算法
- win10 uwp 隐藏实时可视化
- C#委托基础3——泛型委托
- 浅入浅出 Android 安全:第四章 Android 框架层安全
- 安卓自定义圆形imageview
- Git常用命令