Detecting faces in video file. Error in using data type
이전 댓글 표시
I have the following question. I'm working with matlab 2016. I want to detect faces in a video file, using the Viola-Jones algorithm. When I try to enter a video file in & lt;step> the statement, I get the following error:
Error using
vision.CascadeObjectDetector/validateInputsImpl
(line 330)
Expected input number 2 to be
one of these types:
uint8, uint16, double, single,int16
Instead its type was
vision.VideoFileReader.
Error in VJ1_video (line 12)
bboxes = step(faceDetector, videoFReader);
I understand that somehow the type of VideoFileReader should be converted to one of the types: uint8, uint16, double, single, int16. But I do not understand how this can be done. Tell me please. Here is my program code:
clear all;
%Load the video using a video reader object
videoFReader = vision.VideoFileReader('D:\465.avi');
%Create a detector object.
faceDetector = vision.CascadeObjectDetector;
%Detect faces.
bboxes = step(faceDetector, videoFReader);
%Annotate detected faces
IFaces = insertObjectAnnotation(videoFReader, 'rectangle', bboxes, 'Лицо');
%Create a video player object to play the video file.
videoPlayer = vision.VideoPlayer;
%Use a while loop to read and play the video frames.
while ~isDone(videoFReader)
videoFrame = videoFReader();
videoPlayer(videoFrame);
end
%Release the objects.
release(videoPlayer);
release(videoFReader);
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Object Detection에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!