Skip to content

Instantly share code, notes, and snippets.

@smzn

smzn/face

Created Jul 11, 2019
Embed
What would you like to do?
顔認識
camera = webcam; % Connect to the camera
videoFrame = snapshot(camera);
% Create a cascade detector object.
faceDetector = vision.CascadeObjectDetector();
bbox = step(faceDetector, videoFrame);
% Draw the returned bounding box around the detected face.
videoFrame = insertShape(videoFrame, 'Rectangle', bbox);
figure; imshow(videoFrame); title('Detected face');
% Convert the first box into a list of 4 points
% This is needed to be able to visualize the rotation of the object.
bboxPoints = bbox2points(bbox(1, :));
clear camera
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.