Suppose you are given a 4D image array (I), where size(I,4) equals the number of frames in the image sequence. You also have a cell array (C) of centroids and radii for detected circles in a given frame. So, for instance, C{i} is an M-by-3 array of M detected circles in the ith frame.
What is the best way to render the detected circles while viewing the video, frame by frame?
I should mention that this will be embedded in an app that I am creating for tracking objects. My current approach is as follows:
- I create a patch when the app is instantiated that has no visible faces or vertices.
- When the frame changes, I compute the correct faces and vertices for the corresponding cell in C, and then update the patch using:
set(hpatch,'Faces',f,'Vertices',v)
It works ok, but it is slow if the number of detections is large (1000+ circles in an image). Would it be faster to draw each circle as its own graphics object instead of one patch object? My concern there is that the number of objects will likely change from frame to frame, so the number of graphics objects I will need is variable. Or would it be faster to overwrite the image with the detected objects (i.e. insertShape)?
Best Answer