Sie sind auf Seite 1von 1

function [] = enterinclass(no)

% clear all;
% close all;
% clc;
% Create a cascade detector object.
faceDetector = vision.CascadeObjectDetector();
% Read a video frame and run the face detector.
videoFileReader = imaq.VideoDevice('winvideo', 2, 'RGB24_640x480','ROI',[1 1
640 480]);
videoFrame
= step(videoFileReader);
bbox
= step(faceDetector, videoFrame);
%continuous checking and outputing image if a human face is not found in
%the videoframe input.
while(1)
size(bbox,1)
if(size(bbox,1)==1)
while(size(bbox,1)<1)
videoFrame= step(videoFileReader);
bbox= step(faceDetector, videoFrame);
end

object.
4);

% Convert the first box to a polygon.


% This is needed to be able to visualize the rotation of the
x = bbox(1, 1); y = bbox(1, 2); w = bbox(1, 3); h = bbox(1,
bboxPolygon = [x, y, x+w, y, x+w, y+h, x, y+h];
% Draw the returned bounding box around the detected face.
videoFrame = insertShape(videoFrame, 'Polygon', bboxPolygon);
figure(1); imshow(videoFrame); title('Detected face');
c= [bbox(1,1) bbox(1,2) bbox(1,3) bbox(1,4)];

Das könnte Ihnen auch gefallen