Face Detection and Tracking:Index in position 1 exceeds array bounds.

1 visualización (últimos 30 días)
Ayberk Dülger
Ayberk Dülger el 2 de Abr. de 2020
Comentada: Stephen23 el 8 de Abr. de 2020
It is the code. And i selected the code that matlab gives error. Why index 1 exceeds array bounds?
clear all; close all; clc;
faceDetector = vision.CascadeObjectDetector();
fileReader = vision.VideoFileReader('3.gif');
videoFrame = step(fileReader);
yuzCerceve = step(faceDetector,videoFrame);
cikisVideo = insertObjectAnnotation(videoFrame,'rectangle',yuzCerceve,'Yüz');
figure,imshow(cikisVideo),title('Yüz tespiti yapildi');
[hue,~,~] = rgb2hsv(videoFrame);
figure,imshow(hue),title('Hue kanal?');
rectangle('Position',yuzCerceve(1,:),'EdgeColor',[1 1 1],'LineWidt',2);
burunTespiti = vision.CascadeObjectDetector('Nose','UseROI',true);
burunCevresi = step(burunTespiti,videoFrame,yuzCerceve(1,:));
tracker = vision.HistogramBasedTracker;
initializeObject(tracker,hue,burunCevresi(1,:));
videoBilgileri = info(fileReader);
videoPlayer = vision.VideoPlayer('Position', [300 300 videoBilgileri.VideoSize+30]);
while ~isDone(fileReader)
videoFrame = step(fileReader);
[hue,~,~] = rgb2hsv(videoFrame);
yuzCevresi = step(tracker,hue);
cikisVideosu = insertObjectAnnotation(videoFrame,'rectangle',yuzCevresi,'Yuz');
step(videoPlayer,cikisVideosu)
end
release(fileReader);
release(videoPlayer);
  1 comentario
Stephen23
Stephen23 el 8 de Abr. de 2020
@Ayberk Dülger : please show us the complete error message. This means all of the red text.

Iniciar sesión para comentar.

Respuestas (1)

Harsha Priya Daggubati
Harsha Priya Daggubati el 6 de Abr. de 2020
Hi,
It would be helpful if you can paste the entire error message you are getting.
This error is usually displayed when the array is empty. I would suggest to put a breakpoint just above this errored line and check the contents of the array.
  2 comentarios
Ayberk Dülger
Ayberk Dülger el 8 de Abr. de 2020
It just gives this error:
Index in position 1 exceeds array bounds.
Harsha Priya Daggubati
Harsha Priya Daggubati el 8 de Abr. de 2020
The line number at which this issue is caused will also be mentioned. I susupect the issue might be at the following line, yuzCerceve might be empty. Use breakpoints to investigate the issue:
burunCevresi = step(burunTespiti,videoFrame,yuzCerceve(1,:));

Iniciar sesión para comentar.

Categorías

Más información sobre Computer Vision Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by