-
-
Save smzn/13eb46115a39329c19de34c3acca592a to your computer and use it in GitHub Desktop.
顔認識
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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