# how to obtain the values of a square matrix inside a circular region of image?

2 views (last 30 days)
as825 on 16 Nov 2013
Commented: as825 on 22 Jan 2014
Suppose we find a circular roi in an image. How to obtain the values of a square matrix or square area inside that circle. give that the x and y coordinates of the circle and its radius
as825 on 16 Nov 2013
Greatest area.suppose the value of x and y is some value and the radius of circli is 5 . then how to find the greatest area . The aim is to embed image

Walter Roberson on 16 Nov 2013
d = r/sqrt(2);
xcoords = [x-d x+d x+d x-d x-d];
ycoords = [y-d y-d y+d y+d y-d];
line(xcoords, ycoords)
Now what you need to deal with is the rounding to integer coordinates. Rounding towards the center is the safest way. I would need to think more to figure out if there are circumstances under which it might then be possible to get a slightly larger area by extending one pixel further in one direction.
as825 on 22 Jan 2014
What does the d in the code represents?