- 1、本文档共6页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
基于Matlab的摄像头防盗报警系统
基于Matlab的摄像头防盗报警系统
李达
设计情况:
一 实现开启摄像头和截图
h=waitbar(0.1,Please wait, check hardware......);
global vid;
vid = videoinput(winvideo,1);
close(h);
preview(vid);
pause(10);
for(i=1:10)
getpic=getsnapshot(vid);%??
filename=int2str(i);
filename=[filename,.jpg]
imwrite(getpic,filename);
pause(0.5);
end
二 实现播放报警音乐
[y,fs]=wavread(报警.wav);
for (i=1:15)
sound(y,fs);
pause(1.5);
end
三 防盗功能实现
global vid;
vid = videoinput(winvideo,1);
preview(vid);
pause(6);
imagePrevious=getsnapshot(vid);
str0=datestr(now);
str0=strrep(str0,:,_);
str0=strrep(str0, ,_);
str0=strrep(str0,-,_);
str0=strcat(str0,.jpg);
imwrite(imagePrevious,str0);
while (1)
pause(0.5);
imageCurrent=getsnapshot(vid);
imageDifference=abs(imagePrevious-imageCurrent);
imageMax=max(imageDifference(:));
if imageMax200
str1=datestr(now);
str1=strrep(str1,:,_);
str1=strrep(str1, ,_);
str1=strrep(str1,-,_);
str1=strcat(str1,thief.jpg);
imwrite(imageCurrent,str1);
[y,fs]=wavread(报警.wav);
for (i=1:5)
sound(y,fs);
pause(1.5);
end
end
imagePrevious = imageCurrent;
end
四 GUI
两个坐标系,一个显示实时画面,另一个显示开启监控后的初始画面,如发现入侵则显示拍到的入侵者画面
function varargout = our(varargin)
% OUR MATLAB code for our.fig
% OUR, by itself, creates a new OUR or raises the existing
% singleton*.
%
% H = OUR returns the handle to a new OUR or the handle to
% the existing singleton*.
%
% OUR(CALLBACK,hObject,eventData,handles,...) calls the local
% function named CALLBACK in OUR.M with the given input arguments.
%
% OUR(Property,Value,...) creates a new OUR or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before our_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to our_OpeningFcn via varargin.
%
% *See GUI Options on GUIDEs Tools menu. Choose GUI allows only one
% instance to run (singleton).
%
% See also: GUIDE, GUIDATA, GUIHANDLES
%
文档评论(0)