Array indices must be positive integers or logical values in facial detection

조회 수: 1 (최근 30일)
Evan Rose
Evan Rose 2021년 3월 23일
답변: Shashank Gupta 2021년 3월 29일
Good afternoon,
I am not sure why i am getting this error returned when i am using the following code;
faceDetector = 'vision.CascadeObjectDetector';
I = imread('INSERT PICTURE LOCATION HERE');
bboxes = faceDetector(I);
IFaces = insertObjectAnnotation(I,'rectangle',bboxes,'Face');
figure
imshow(IFaces)
title('Detected faces');
I am not sure what this error means as the pixel values i am using are all positive values so I am very confused. What can I do to achieve a successful output?
Thanks.
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2021년 3월 23일
Evan - please copy and paste the full error message to this question so that we can see which line of code is throwing the error.

댓글을 달려면 로그인하십시오.

답변 (1개)

Shashank Gupta
Shashank Gupta 2021년 3월 29일
Hi Evan,
I think you got confused in defining a facedetector. Check out the following code, this might help you.
faceDetector = vision.CascadeObjectDetector(); % Correct way to define this object.
I = imread('INSERT PICTURE LOCATION HERE'); % Read an image.
bboxes = faceDetector(I); % call the function.
IFaces = insertObjectAnnotation(I,'rectangle',bboxes,'Face');
figure
imshow(IFaces)
title('Detected faces');
Also check out this resource page in case you stuck somewhere.
I hope this helps.
Cheers.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by