【人脸识别】基于matlab GUI人数统计【含Matlab源码 2121期】

⛄一、人数统计简介(附课程作业报告)

1 课题背景
本课题为基于matlab的人数统计系统。近年来,很多行业对人流信息有极大的需求,如汽车公交站,地铁站台,商场出入口等。通过人数统计系统可以方便、可靠、实时地对各种场所的人流进行统计,而不对公众造成任何影响。结合其他图像分析技术,系统可以清楚快捷地掌握客流动态,提供数据支持,使决策者及时做出对策。利用图像处理来完成人数统计系统的主要优点就是图像信号非常直观,便于人为的理解。可以看出,图像的人数统计无论是在商业信息采集还是公共安全监控方面具有重要意义,图像的人数统计识别算法的研究无论在理论上还是在实际应用领域都有着诱人的发展前景。
2 课题分析
本文采用基于matlab GUI形态学人数统计,老师点名效率得到很大提升。
3 社会需求分析
(1)对同学来说:脱离高中魔鬼式的学习,迈入高校的殿堂,许多在校大学生作息时间紊乱,课堂到课情况不理想。出现缺课、旷课情况,严重影响到学业成绩。更有少数学生利用上课时间出去游玩,发生意外。让学生养成一个好的作息习惯,规范学生的考勤,是很多高校最想做到的事情之。因此,快速、有效的出勤统计对大学生的学习以及学习至关重要。
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:689fc680-20d4-43dc-bd51-eeb6ea71ee0f

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:4a328aa7-f6a4-4a09-a4e9-c150b4a30b9c

4 为了说明开发本项目—教室人员统计系统的必要性,我们对传统的考察出勤人数方式进行了分析。
(a)花名册顺序点名
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:8a689fd8-8b12-4178-ba2c-9d56bc601d69

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:e83b17d8-6a7e-4eb5-abd2-cdcdd5ba61b6

优点:每一名学生都要答到,教师可以有更多的机会认识每一位同学,比较真实的反应了学生的到课情况。
缺点:如果学生的人数比较多,会浪费学生和老师很多的宝贵时间,并且,存在其他同学帮忙答到的情况。
(b)花名册随机点名
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:0584cb86-4bf3-446c-8f86-04261dc1383a

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:b4d59fb2-6803-45c1-992a-2dc82c29ec6f

优点:随机点名法节省了大量的时间,给那些点名未到的同学施加适当的压力,班级旷课的同学基本.上都是”老面孔”,这种方法可以让那些同学不敢再旷课。
缺点:第一次点名仍然要花费大量的时间,随机点名法存在很多”运气”成份,可能会有一些同学经常没来.上课,但没有被发现。
©固定座位
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:ae1ed634-8e1b-477b-a771-fa70dc1a2978

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:1b9f39fb-e423-42e2-b450-371837e8686a

优点:老师在上课的时候,可以清楚地看到学生的出勤情况。学生座位靠近讲台,可以提高学生的上课注意力。
缺点:高校学生上课要经常更换教室,固定座位的做法,随着教室的变动会带来很多不便。
(d)分组统计
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:64acd3fe-5f28-4c0a-bcd1-25347b1b7932

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:11841b94-1a09-495c-ab14-18d4e960b390

优点:节省了老师的时间,便于进行以小组为单位的讨论和学习。
缺点:可能会存在小组长包庇组员的情况,教师无法确定学生的真实出勤率。
4 为了了解大学生对本项目—教室人员统计系统的接受度,我们使用问卷星对大一至大四的在读本科生进行了问卷调查。以下为调查结果分析:
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:15668cda-179e-408a-bce8-d12f1e6dbc11

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:68a42b5e-2ecc-42af-a8cf-c7274bf22c95

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:972e3c0b-e565-4863-8e9e-9ba406b319f3

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:f2e827d4-31af-4f2d-a081-2d3af6d7f43f

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:282d9721-cd0e-4899-8caf-b02e1e3caabd

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:f5744218-299a-427d-ba0e-ee11c7c5df29

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:ebe2ecf3-752a-483e-9ca6-a6f92e09cb5e

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:6d70d504-f350-4a7b-a905-9405a4677bcb

5 计算机视觉系统工具箱简介
计算机视觉系统工具箱(Computer Vision System Toolbox,CVST)是Matlab2012b版本自带工具箱。该工具箱不仅包括用于特征提取、运动检测、目标检测、目标跟踪、立体视觉、视频处理、视频分析的算法,还包括视频文件输入输出,视频显示,绘图以及合成。这些功能以Matlab函数、Matlab系统对象、Simulink块的形式提供。对于快速原型和嵌入式系统设计,该工具箱支持定点算法和C代码产生。
计算机视觉系统工具箱的人脸检测算法主要基于Viola-Jones的人脸检测,通过内置的类和函数进行人脸甚至是鼻子、嘴以及眼睛的自动检测。Viola-Jones人脸检测是Paul viola 和 Michael J Jones共同提出的一种人脸检测算法,该算法原理简单,耗费资源小,在提出后被广泛用于人脸检测。Viola-Jones人脸检测主要包含Haar-like特征、积分图、AdaBoost迭代算法和级联分类器等内容,实现人脸检测的主要步骤是:①利用Haar-like矩形特征表征人脸,使用”积分图”对图像中的矩形特征进行快速计算。②利用AdaBoost算法从数量巨大的Haar-like特征中训练出人脸检测所需要的分类器。③将训练得到的强分类器进行级联,利用级联的强分类器构成最终的分类器。
计算机视觉系统工具箱只需要用简单的命令即可实现人脸检测。调用工具箱中的vision.CascadeObjectDetector即可运行。不仅运行速度较快,且人脸检测准确度很高。经过自行改进,可进行批处理。

6 方案设计
6.1框架设计
该项目要完成的功能是:根据所给的图片,实现自动人脸检测,人数统计,要求含有GUI界面,且算法能够准确的实现人数的统计,拥有较快的运算速度,具有较好的实时性。

6.2界面设计
首先,将页面背景设置为灰白色,在中心及偏左页面设置两个坐标系axes1以及axes2,用以显示后来选中的图片和人脸识别后已框出人脸的图片。在坐标系右边从上到下依次拖拽设置pushbutton1、pushbutton2、edit1、text1、pushbutton2。其中,pushbutton1上编辑’打开教室图片’字样,用以完成打开图片功能;edit1上编辑’统计结果’字样;text4中显示’统计结果’的结果;pushbutton2上编辑’统计人数’,通过点击此按钮实现统计人数的功能;最后一个pushbutton3上编辑’完成’字样,完成关闭功能。坐标轴上方还设置一个text2,编辑’欢迎使用教室人数统计系统’作为标题。至此完成页面的界面设计。

【人脸识别】基于matlab GUI人数统计【含Matlab源码 2121期】

6.3功能设计
对于pushbutton1按钮,即点击’打开教室图片’,是使用uigetfile函数标准化打开选择文件对话框,此时会弹出此电脑的文件界面,选择一张带有人的图片后,点击确认即可在axes1上显示该选中图片,且在此图片上方设置标题’教室照片’,完成选中图片功能。其次点击’统计人数’按钮,在代码中取得打开图片的相关数据,将彩色图像转化为灰度图像等等处理,设置路径将此转化处理后的图像显示在axes2,此外还可找到图片中的人脸,绘制边框圈出来,统计出边框的个数反映在text1中,且在此图像上方设置标题’框出人脸区域’。至此完成此设计的全部功能。下图为该项目的功能流程图:

【人脸识别】基于matlab GUI人数统计【含Matlab源码 2121期】
图1 功能流程图

; ⛄二、部分源代码

function varargout = Mainrenshutongji(varargin)
% MAINRENSHUTONGJI MATLAB code for Mainrenshutongji.fig
% MAINRENSHUTONGJI, by itself, creates a new MAINRENSHUTONGJI or raises the existing
% singleton*.

%
% H = MAINRENSHUTONGJI returns the handle to a new MAINRENSHUTONGJI or the handle to
% the existing singleton*.

%
% MAINRENSHUTONGJI(‘CALLBACK’,hObject,eventData,handles,…) calls the local
% function named CALLBACK in MAINRENSHUTONGJI.M with the given input arguments.

%
% MAINRENSHUTONGJI(‘Property’,’Value’,…) creates a new MAINRENSHUTONGJI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Mainrenshutongji_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Mainrenshutongji_OpeningFcn via varargin.

%
% *See GUI Options on GUIDE’s Tools menu. Choose “GUI allows only one
% instance to run (singleton)”.

%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help Mainrenshutongji

% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …

‘gui_Singleton’, gui_Singleton, …

‘gui_OpeningFcn’, @Mainrenshutongji_OpeningFcn, …

‘gui_OutputFcn’, @Mainrenshutongji_OutputFcn, …

‘gui_LayoutFcn’, [] , …

‘gui_Callback’, []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code – DO NOT EDIT

% — Executes just before Mainrenshutongji is made visible.

function Mainrenshutongji_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.

% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Mainrenshutongji (see VARARGIN)

% Choose default command line output for Mainrenshutongji
handles.output = hObject;
handles.step1=[];
handles.step2=[];
handles.step3=[];
handles.step4=[];
% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Mainrenshutongji wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% — Outputs from this function are returned to the command line.

function varargout = Mainrenshutongji_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% — Executes on button press in pushbutton1.

function pushbutton1_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% — Executes on button press in pushbutton2.

function pushbutton2_Callback(hObject, eventdata, handles)
global I
[x,y,c]=ginput(2);
if c==1
BB=imcrop(I,[min(x(1),x(2)),min(y(1),y(2)),abs(x(2)-x(1)),abs(y(2)-y(1))]);
BB=imresize(BB,[252 202]);
axes(handles.axes2); %你的截图放在GUI中的axes2中
imshow(BB)
end

⛄三、运行结果

【人脸识别】基于matlab GUI人数统计【含Matlab源码 2121期】
【人脸识别】基于matlab GUI人数统计【含Matlab源码 2121期】

; ⛄四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1]戴骊融,陈万米,郭盛.基于肤色模型和SURF算法的人脸识别研究[J].工业控制计算机. 2014,27(02)

3 备注
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:d2e668dd-f79f-4b5a-ab81-e1f79997ed71

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:48df8dd7-bb41-419d-a4c2-f5b5c085a5c6

Original: https://blog.csdn.net/TIQCmatlab/article/details/126858538
Author: 海神之光
Title: 【人脸识别】基于matlab GUI人数统计【含Matlab源码 2121期】

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/561174/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球