📄 camera.m
字号:
function Camera(hObject, eventdata, handles)
global R G B s
s=1;
x=0;
rel1=0;
rel=0;
vfm('show',0);
%**************Aquisi玢o de imagem*************************
A=vfm('grab',1);
while (s==1)
pause(0.01);
B=vfm('grab',1);
% Cb=A(:,:,3);
% Cr=A(:,:,1);
% Cg=A(:,:,2);
axes(handles.axes1);
%subplot(2,2,1);
image(A);
axis off;
axes(handles.axes2);
image(B);
axis off;
axes(handles.axes3);
%diferen鏰 entre duas imagens consecutivas
C=B-A;
image(C);
axis off;
A=B;
% tic
%somat髍io dos elementos da diferen鏰 entre duas imagens consecutivas
D=sum(C);
E=sum(D);
F=sum(E);
% toc
% *****************detectar movimento*********************
set(handles.textMovDetec,'string','N鉶');
if F>350000%480x640/2500000%3200000
% x=x+1;
set(handles.textMovDetec,'string','Sim');
% tic;
else set(handles.textMovDetec,'string','N鉶');
end
%*******************detectar cor****************************
%laranja 210/150/190
%vermelho caneta 255/110/160
% R=200;
% G=20;
% B=40;
k=0;
si=0;
sj=0;
filtR=50; %pode ser constante
filtG=30; % // // //
filtB=50; % // // //
% for i=1:240
% for j=1:320
% if (A(i,j,1)>=R-filtR & A(i,j,1)<=R+filtR &...
% A(i,j,2)>=G-filtG & A(i,j,2)<=G+filtG &...
% A(i,j,3)>=B-filtB & A(i,j,3)<=B+filtB)
% si=si+i;
% sj=sj+j;
% k=k+1;
% end
% end
% end
% si=si/k;
% sj=sj/k;
% hold on;
% plot(sj,si,'*'); %Testar
% axis off;
%
% hold off;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -