这里显示错误的形象
汽车检测使用RCNN通过实时图像从一个相机,发现车的距离
6视图(30天)
显示旧的评论
我试图找到距离图像中检测到的车和显示它但是我得到这个错误而显示在图像的距离”的列数的位置必须是4的矩形的形状,或3圈的形状。”
我的下面的代码,我被困在这个错误请帮助我
负载(“webcamsSceneReconstruction.mat”);
data =负载(“fasterRCNNVehicleTrainingData.mat”);
trainingData = data.vehicleTrainingData;
trainingData。imageFilename = fullfile (toolboxdir (“愿景”),“visiondata”,trainingData.imageFilename);
%成形层
层= data.layers
选择= trainingOptions (“个”,“InitialLearnRate”1 e-6…
“MaxEpochs”, 1…
“CheckpointPath”,tempdir);
%训练检测器。
探测器= trainFasterRCNNObjectDetector (trainingData层,选项)
%测试快速R-CNN探测器测试图像。
webcamlist
一个=摄像头(2);
framecount = 1;
[高度宽度频道]=大小(快照(a));
而framecount < 5
img =快照(a);
im_Left = img(:, 1:宽/ 2:);
%图;
% b = imshow (im_Left);
im_Right = img(宽/ 2 + 1::宽度:);
%运行探测器。
[bbox,分数,标签]=检测(探测器,im_Left);
[bbox,分数,标签]=检测(探测器,im_Right);
detectedImg1 = insertShape (im_Left,“矩形”,bbox);
detectedImg2 = insertShape (im_Right,“矩形”,bbox);
图
imshow (detectedImg1)
图
imshow (detectedImg2)
leftimage = undistortImage (im_Left stereoParams.CameraParameters1);
rightimage = undistortImage (im_Right stereoParams.CameraParameters2);
center1 = detectedImg1 (1:2) + detectedImg1 (3:4) / 0.005;
center2 = detectedImg2 (1:2) + detectedImg2 (3:4) / 0.005;
point3d =满足(center1 center2 stereoParams);
distanceInMeters =规范(point3d) / 1000;
distanceAsString = sprintf (“% 0.2 f米”,distanceInMeters);
leftimage = insertObjectAnnotation (leftimage,“矩形”、center1 distanceAsString);
rightimage = insertObjectAnnotation (rightimage,“矩形”、center2 distanceAsString);
% leftimage = insertShape (bboxes detectedImg1,“矩形”,“线宽”,3);
% rightimage = insertShape (bboxes detectedImg2,“矩形”,“线宽”,3);
leftimage = insertShape (leftimage,“FilledRectangle”,detectedImg1);
rightimage = insertShape (rightimage,“FilledRectangle”,detectedImg2);
imshowpair (leftimage rightimage,“蒙太奇”);
framecount = framecount + 1;
结束
- 我得到错误显示在图像*