請看看這段代碼並幫助我。我正在做一些錯誤的Matlab命令。該代碼給出警告,然後崩潰。錯誤在第二行。Matlab代碼崩潰並給出錯誤:矩陣的連接維度不一致
while ~isDone(videoSource)
frame = readFrame(videoSource);
mask = detectObjects(frame,Fgdetector);
[areas, centroids, bboxes]= step(blobAnalyser,mask);
% tracing boundires around the detected obbjects
% BW = im2bw(I, graythresh(I));
[B,L] = bwboundaries(mask,'noholes');
imshow(label2rgb(L, @jet, [.5 .5 .5]))
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2)
%for star skeleton
x = boundary(:,2);
y = boundary(:,1);
indexes = convhull(x, y);
hold on;
% plot(x(indexes), y(indexes), 'm-', 'LineWidth', 2);
line([x(indexes(k)), centroids], [y(indexes(k)),centroids ], 'Color', 'r', 'LineWidth', 2);
end
哪條線路出現錯誤?在該行中檢查您要連接的每個變量的大小。 – Navan
這條線:[(x(索引(k)),質心],[y(索引(k)),質心],'顏色','r','LineWidth',2); – BlueBee
它沒有崩潰。由於用戶錯誤,它正常退出。 –