I have been having a look at this, but I use ImageMagick and OpenCV rather than Matlab, however I am sure you can convert the ideas to Matlab quite readily if that is your preference.
Finding Circles - Well, Hough Transforms make a big mess of this and seem to create a million circles all over the place, so I am thinking that is maybe not a solution. I then got thinking about "depolarising" the image and working in the straight line space it creates. It is quite easily depolarised with a simple ImageMagick -distort
command like this:
convert tubo.tif -distort depolar 0 straight.jpg
That gives you an image like this:

The next thing is to slice the image into vertical strips corresponding to your discretisation
. I didn't see any mention of actual numbers so I went with dividing the image into 10 vertical strips, each one the full height of the straightened image and 10% of its width. I did that in ImageMagick like this:
convert straight.jpg -crop 10%x100% out.jpg
which gives me 10 images called out-0.jpg
, out-1.jpg
... out-9.jpg
Here is one:

I then resized the width of each of the 10 images, down to 50 pixels. I think I would really resize down to 1 pixel wide then it would average the pixels across the strip and give me a single transition point from background to pipe and then back to background. But you cannot easily see a 1 pixel wide image on here, so I went with a width of 50 pixels.
After that, I animated it, so you can see what is going on. I did that like this:
convert -delay 20 -loop 0 out* animated.gif
Which gives this:

So the whole code looks like this:
convert tubo.tif -distort depolar 0 straight.jpg
convert straight.jpg -crop 10%x100% out.jpg
for f in out* ; do
convert $f -resize 50x! $f
done
convert -delay 20 -loop 0 out* animated.gif
There are lots of things to think about still... where to choose the image centre for depolarising, what thresholds to use, whether to use any morphology to close gaps cause during binarisation, whether any contrast enhancement helps or just moves the edges.
Another thing I note is that the inner area of the original image (inside the middle of the pipe) has a mean pixel value of 89 and a standard deviation of 4.5 (meaning it is quite homogeneous) whereas the actual pipe has a mean of 120 and a MUCH higher standard deviation of 25, so this could give some insight into how to threshold - maybe by texture/homogeneity.
By the way, ImageMagick and OpenCV are readily installed on OSX with homebrew
. See my answer here.