필터 지우기
필터 지우기

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 CenterFile Exchange에서 Image 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