MATLAB: Creating a circle in a matrix that the position within the matrix can change

binary imagecircleImage Processing ToolboxMATLABobject tracking

Hi I'm making a barbell tracking system which searches for a specific white circle in a binary image. to help ID the correct circle I have applied radius filters but need to create a search area to be sure I'm identifying the right circle.
As the barbell moves through frames of the video I want the search area to move with it. I can do this by defining the circle centroid as == a set coordinate value (bar location of the previous frame). so when a point it marked and the next frame is analysed, the search area circle moves with the bar (with a delay of 1 frame).
I'd like to know how to: 1.) create a binary circle in a matrix 2.) assign the center location of this circle to a coordinate within the matrix
Apologies if this is incoherent this is my first question on MATLAB answers. I appreciate the help!
Joe

Best Answer

See my Image Segmentation Tutorial to see how you can find the centroid of bright circles in your video frames. https://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
Also see my attached demo for reading and analyzing video frames. It computes the mean colors for each frame but you can adapt it to find bright blobs and find their centroids or outlines.
To display boundaries (outlines) of the detected bright regions, use bwboundaries() and plot(), as shown in the Image Segmentation Tutorial.
Finally, to display perfect circles you can use the viscircles() function in the Image Processing Toolbox.