I have the following binary image.
I need to divide this cell (the white section) into equal angle portions (of 36 degrees) at the centroid and find the distance from the centroid to the perimeter (edge of the white section) at each portion of angle. With the help of some of the answers I received in a previous post (courtesy of 'Image Analyst') I have the following code so far. ('some code portions have been changed from the original post marked with *')
C = imread('14.jpg'); bw = im2bw(C, graythresh(C)); cc = bwconncomp(bw, 4); celldata = regionprops(cc, 'centroid'); celldata_centroid = [celldata.Centroid]; centroidx = celldata_centroid(:, 1); centroidy = celldata_centroid(:, 2); boundaries = bwboundaries(C); mat_boundaries = cell2mat(boundaries); %* boundaryx = mat_boundaries(:, 2); boundaryy = mat_boundaries(:, 1); allDistances = sqrt((boundaryx - centroidx).^2 + (boundaryy - centroidy).^2); allAngles = atan2d(boundaryy, boundaryx); %* [~, index36] = min(abs(allAngles - 36)); % Find index closest to 36 degrees distance36 = distance(index36); %*
But I'm getting an error at the end saying not enough input arguments for the function 'distance'. Could someone help me out?