Why are you doing edge detection???? I see no need for that. If the edges are about where you put them, then try thresholding and getting the area and divide by the width:
mask = grayImage < someValue;
mask = imfill(mask, 'holes');
diameter = nnz(mask) / size(mask, 2);
It's trickier if you want the inner, instead of outer, dark thing.