资源简介
读取视频,根据移动检测与行人检测做的一个监控人数的程序,运行环境为Qt+Opencv,在运行前注意配置好环境

代码片段和文件信息
#include “detectcv.h“
DetectCV::DetectCV(int x int y int width int height)
{
//-- 1. 加载级联分类器文件
if( !face_cascade.load( face_cascade_name ) )
{
printf(“--(!)Error loading\n“);
cout << face_cascade_name << endl;
}
screen = QGuiApplication::primaryScreen();
for(int i=0; i < 3; i++)
{
QString filePathName = “full-“;
filePathName += QString::number(i10);
filePathName += “.jpg“;
screen->grabWindow(0 x y width height).save(filePathName “jpg“);
}
}
/** @函数 detectFace */
int DetectCV::detectFace( )
{
vector faces;
Mat frame_gray;
QString path = “full-“ + QString::number(past10) + “.jpg“;
Mat frame = imread(path.toStdString());
cvtColor( frame frame_gray CV_BGR2GRAY );
equalizeHist( frame_gray frame_gray );
//-- 多尺寸检测人脸
face_cascade.detectMultiScale( frame_gray faces 1.1 2 0|CV_HAAR_SCALE_IMAGE Size(30 30) );
for( int i = 0; i < faces.size(); i++ )
{
Point center( faces[i].x + faces[i].width*0.5 faces[i].y + faces[i].height*0.5 );
ellipse( frame center Size( faces[i].width*0.5 faces[i].height*0.5) 0 0 360 Scalar( 255 0 255 ) 4 8 0 );
}
//-- 显示结果图像
imshow( window_name frame );
return faces.size();
}
/** @函数 detectBody */
int DetectCV::detectBody(Mat framevector boundRect)
{
// QString path = “full-“ + QString::number(past10) + “.jpg“;
// Mat frame = imread(path.toStdString());
std::vector bodys;
HOGDescriptor defaultHog;
defaultHog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
//进行检测
defaultHog.detectMultiScale(frame bodys);
//画长方形,框出行人
for(int i = 0; i < bodys.size(); i++)
{
Rect r = bodys[i];
Point center = heightPoint(r);
for(int j = 0; j < boundRect.size(); j++)
{
if(center.x > boundRect[j].x
&& center.x < boundRect[j].x+boundRect[j].width
&& center.y > boundRect[j].y
&& center.y < boundRect[j].y+boundRect[j].height)
{
// if come back
for(int l = 0; l {
if(per_direc[l].bound.x == boundRect[j].x && per_direc[l].bound.y == boundRect[j].y)
{
per_direc[l].preNum++;
per_direc[l].isAppear = true;
// per_direc[l].appearTimes++;
}
}
rectangle(frame r Scalar(0 0 255) 2);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-06-06 17:07 projectCatch\
文件 192 2018-04-13 07:09 projectCatch\main.cpp
文件 24176 2018-04-13 08:39 projectCatch\projectcatch.pro.user
文件 710 2018-05-21 06:14 projectCatch\mainwindow.h
文件 24183 2018-06-01 18:41 projectCatch\projectCatch.pro.user
文件 2750 2018-05-23 04:05 projectCatch\mainwindow.ui
文件 10704 2018-05-31 10:41 projectCatch\detectcv.cpp
文件 1184 2018-05-21 06:37 projectCatch\detectcv.h
文件 59 2018-05-23 07:54 projectCatch\person.cpp
文件 2223 2018-06-06 17:07 projectCatch\mainwindow.cpp
文件 1962 2018-05-16 06:21 projectCatch\projectCatch.pro
文件 371 2018-05-23 07:54 projectCatch\person.h
- 上一篇:有人网络调试助手 串口调试助手二合一
- 下一篇:客户管理模块数据流图
相关资源
- vtk QT做的三维地质可视化系统2of2
- Qt局域网聊天软件
- Qt Creator opengl实现四元数鼠标控制轨迹
- QT局域网聊天系统(基于QT5.修改过)
- qt-电子点菜系统
- C 餐厅叫号系统(QT平)
- QT 实现文件下载
- qt图像处理
- 基于OpenCV的数字识别468815
- 使用opencv去掉二值化图像中黑色面积
- QT,JPEG解码源代码(已完成)
- Qt 播放音频文件
- Qt 读取16进制的data文件
- opencv环境配置
- MQTT+串口(usart)透传
- 易语言QQTEA算法源码
- VC工程转Qt工程文件的工具
- win10 64位下编译的opencv4.5.5库,opencv
- MQTT推送Demo
- 基于Linux、QT的视频监控系统的设计与
- Qt 百度地图 定位
- QT酷炫界面开发指南《QmlBook》
- Ubuntu下操作Excel,qt代码
- Qt图片浏览器 --基于Qt的Graphics View f
- qtnribbon2破解
- Qt软件开发 完整项目代码
- MQTT_3.1protocol_Specific中文版
- 在QT中使用RTP进行视频的采集和传输
- NVIDIAOpticalFlowSDK-79c6cee80a2df9a196f20afd6
- Mini6410 Qt4和Qtopia编程开发指南
评论
共有 条评论