Calculating displacement for a circular disc

I have to calculate the difference in diameter of two concentric circles. The image is obtained from an experiment and the data looks like this.

The length required is the value of l as marked in this figure.

For the calculation, it is required to calculate the value of l at each point and then calculate the average l over the entire 2*Pi angle. This averaging is necessary for the calculation. To calculate the average value of l averaged over the entire 2*Pi angle, I have first cleared the image and then obtained the binarized image as shown.

However, I cannot calculate the value of the length l. Since I am new to Mathematica help will be highly appreciated.

The key idea to make this simpler is to apply a polar transform:

img = Import["https://i.sstatic.net/Y6oab.gif"];

center = 0.5 ImageDimensions[img];
maxR = 200;
polarToCart = center + {Cos[#[[1]]], Sin[#[[1]]]}*#[[2]] &;

polar = ImageTransformation[Binarize[img], polarToCart, {360, maxR},
PlotRange -> {{0, 2 \[Pi]}, {0, maxR}}, DataRange -> Full]


Now you can just process any column in this image to find the radii at different angles. The simplest thing that can work is to just count the white pixels:

ListLinePlot[Total /@ Transpose[ImageData[polar]]]


Depending on your data, you might want to count the longest run of white pixels instead (using Split) or you might want to take a distance transform before applying the polar transform.

• very beautiful solution! Commented Feb 20, 2015 at 11:18

This is not an area I am familiar with but for fun here is approximation of the average thickness of annular region. This uses a lot version 10 functionality.

Importing the image:

img = Import["https://i.sstatic.net/7BQEI.jpg"]


Using coordinate tools to calibrate image (cal is collected end points of ruler):

cal = {{1000., 9.333333333333314}, {898.6666666666666,
7.333333333333314}};
cf[x_] := 25 x/EuclideanDistance @@ cal


Applying EdgeDetect to a cropped version of image:

Finding a circle that separate bounding circles:

Manipulate[
Show[ListPlot[PixelValuePositions[crop, 1]],
Graphics[Circle[{c1, c2}, r]]], {c1, 100, 300}, {c2, 100, 300}, {r,
50, 200}]


Fitting circles and determining different in radii:

reg = PixelValuePositions[crop, 1];
ir = ImplicitRegion[(x - 200)^2 + (y - 160)^2 < 103^2, {x, y}];
inner = Pick[reg, RegionMember[ir, #] & /@ reg, True];
outer = Pick[reg, RegionMember[ir, #] & /@ reg, False];
lfi = LinearModelFit[{#1, #2, #2^2 + #1^2} & @@@ inner, {x, y}, {x,
y}];
func[x_, y_] := lfi["BestFitParameters"].{1, x, y} - y^2 - x^2;
lfo = LinearModelFit[{#1, #2, #1^2 + #2^2} & @@@ outer, {x, y}, {x,
y}];
funco[x_, y_] := lfo["BestFitParameters"].{1, x, y} - y^2 - x^2;
cni = RegionCentroid[i = ImplicitRegion[func[x, y] == 0, {x, y}]]
cno = RegionCentroid[o = ImplicitRegion[funco[x, y] == 0, {x, y}]]


This yielded inner circle centre, outer circle centre and different in radi (in microns):

Looking at models:

lfi["ParameterTable"]
lfo["ParameterTable"]


and visualizing:

Show[Graphics[{Red, Thick, Dashed, Circle[cni, radi], Green,
Circle[cno, rado]}], ListPlot[{inner, outer}], Frame -> True]


The model assumes a circle. I look forward to better answers and corrections of likely misconceptions I have wrt image analysis.