如何提高标记绘图的速度?

How to improve the speed of marker plotting?

我有一堆图像,我想在其中绘制随时间变化的追踪 + 二维位置标记(即 300 张图像,追踪从位置 (1,1) 到 (300,300) --> 让我们假设用于此目的的直线对角线。

使用 plot 函数可以轻松地在图像上绘制此跟踪图。绘制实际轨迹非常耗时。我能够做到的唯一方法是使用 vision.MarkerInserter 并在循环中使用 step 函数(for 或 while):

markerInserter = vision.MarkerInserter('Shape','Circle','BorderColor','Custom','CustomBorderColor','red', ...'Fill',1,'FillColor','Custom','CustomFillColor',[255],'Size',6,'Opacity',0.88);

frame = step(markerInserter, frame_copia,[int32(centroidsFiltered(i,2)) int32(centroidsFiltered(i,1))]);
imshow(frame,'Border', 'tight'); hold on

plot(centroidsFiltered(:,2),centroidsFiltered(:,1),colour,'LineWidth',0.5)

有没有更快的方法在不使用步骤或 vision.markerinserter 函数的情况下在图像中绘制此跟踪?

而不是使用 MarkerInserter class,只需使用内置的 line 函数来绘制标记