フィルターのクリア

error message : Index exceeds matrix dimensions

1 回表示 (過去 30 日間)
ahmed nasr
ahmed nasr 2017 年 12 月 24 日
回答済み: Image Analyst 2017 年 12 月 24 日
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;

回答 (1 件)

Image Analyst
Image Analyst 2017 年 12 月 24 日
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.

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by