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);
Best Answer