I am having an algorithm which is giving me an output in the form of a variable (on my workspace). The Variable(centers) is an n*2 array and is giving me center locatations or x,y coordinates of bunch of different circles on an image. What i wanna do is to use that centers variable and create bounding boxes on each of those coordinates. For creating the bounding box on any x,y cordinate, i am using the following algorithm.
boxHalfWidth = 40;
boxXStart = x-boxHalfWidth;
boxYStart = y-boxHalfWidth;
boxWidth = 2 * boxHalfWidth;
boxHeight = 2 * boxHalfWidth;
rectangle('Position',[boxXStart boxYStart boxWidth boxHeight])
Can anyone please help me, about how do i create a function in which i give the input as centers for each x,y pair and in turn execute the above written algorithm (boundbox) sequentially on each x,y values in that centers array, so that i get bounding boxes on all those x,y pairs.
Please find the attached screenshot of the centers array as well. Any suggestion or help will be greatly appreciated .