Search code examples
matlabplottraceimshow

How to improve the speed of marker plotting?


I have a bunch of images where I want to plot a tracing + a marker of 2D positions over time (i.e. 300 images with a tracing going from position (1,1) to (300,300) --> let's assume a straight diagonal line for this purpose.

Plotting this tracing over the image is easily accomplished using the plot function. Plotting the actual tracing is very time consuming. The only way I am able to do it is using vision.MarkerInserter and using the step function within a loop (for or 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)

Is there any faster way of plotting this tracing in the image without using the step or the vision.markerinserter functions?


Solution

  • instead of using the MarkerInserter class, simply use the built-in line function to plot the markers