MATLAB: Finding average radius of a binarized image of a circle

geometryimage processingImage Processing Toolbox

I have several images of XY projections of a computer reconstructed sphere, all of which have been binarized for easier calculations and look like the image below
I know I can import the image as an array of 0's and 1's, but I was wondering if there was an easy way to calculate the radius with a given angle theta if the center point of the image is known. My end goal is simply to find the average radius of the whole circle, but I am slightly confused as to how angles and radii would work when an image is made up of discreet pixels.

Best Answer

If you just want the equivalent circular diameter, you can ask regionprops().
props = regionprops(mask, 'EquivDiameter');
ECD = props.EquivDiameter; % Equivalent Circular Diameter - diameter of a circle with the same number of pixels as your blob.
If you want radius as a function of angle, then that's more complicated and involves using regionprops to find the centroid, bwboundaries() to find the outline, atan2d() to find the angle, and sqrt() to find the distance (radius) at that angle.