Azzera filtri
Azzera filtri

error message : Index exceeds matrix dimensions

1 visualizzazione (ultimi 30 giorni)
ahmed nasr
ahmed nasr il 24 Dic 2017
Risposto: Image Analyst il 24 Dic 2017
load('callast.mat');
vid = videoinput('macvideo', 1, 'YCbCr422_1280x960');%left
vid2 = videoinput('macvideo', 2, 'YCbCr422_1280x960');%right
I1 = getsnapshot(vid);
I2 = getsnapshot(vid2);
faceDetector = vision.CascadeObjectDetector;
face1 = faceDetector(I1);
face2 = faceDetector(I2);
center1 = face1(1:2) + face1(3:4)/2;
center2 = face2(1:2) + face2(3:4)/2;
point3d = triangulate(center1, center2, stereoParams);
distanceInMeters = norm(point3d)/1000;
distanceAsString = sprintf('%0.2f meters', distanceInMeters);
I1 = insertObjectAnnotation(I1,'rectangle',face1,distanceAsString,'FontSize',18);
I2 = insertObjectAnnotation(I2,'rectangle',face2, distanceAsString,'FontSize',18);
I1 = insertShape(I1,'FilledRectangle',face1);
I2 = insertShape(I2,'FilledRectangle',face2);
imshowpair(I1, I2, 'montage');
i am trying to acquire images from stereo-cameras and detect faces with distance and i keep getting this error ...
Index exceeds matrix dimensions.
Error in lllss (line 20) center1 = face1(1:2) + face1(3:4)/2;

Risposte (1)

Image Analyst
Image Analyst il 24 Dic 2017
Well clearly face1 does not have 4 elements like you assumed. Use normal debugging procedures to find out what it is. It might even be null/empty.

Categorie

Scopri di più su Image Processing and Computer Vision in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by