Okay, I used Whitebox GAT (http://www.uoguelph.ca/~hydrogeo/Whitebox/) to solve this problem. Here were my steps:
I imported the jpeg image that you uploaded using the Import Image tool, although if you have a tiff file you can use the Import GeoTIFF tool instead.
The imported image is an RGB colour image, so this needs to be stripped into the individual red, green, blue bands, which I did using the Split Colour Composite tool.
The resulting image is a greyscale image and you really need a Boolean image to perform the line thinning operation, so I thresholded the image in the Raster Calculator using this statement:
[bool image] = [blue band image]<128
Importantly, the resulting raster has a zero background and the outline is filled with ones.
I used the line thinning tool to thin lines, resulting in this raster...
You'll find several tools in the Raster/Vector Conversion toolbox. Unfortunately the Raster to Vector Lines tool is experimental at this time, but the Raster to Vector Polygons tool does work nicely. Here's a screenshot of the final vector...
Incidentally, if you're more interested in the area polygons than the lines (see below), then I can do that too. Just let me know and I'll walk you through that process.
I hope that helps you out.
The following is a Python script that you can use to extract vector polygons, as in the final image above. All it really does is call the series of Whitebox plugin tools in a specific order. It's fairly well documented so you should be able to follow the logic. If you need further explanation, just email me offline. The script assumes that the input file is named 'cup' but I've commented the line where you change this. Otherwise, it should be good to run as is. You simply need to open the Whitebox Scripter, ensure that it is set up for Python (actually Jython) as the scripting language, paste the code, save it and run it. You may have to play around with the white-space depending on how well I can format the code in this text box ;)
# Get the working directory
wd = pluginHost.getWorkingDirectory()
# Split the image into its individual RGB components.
# This will create three outputs. We'll proceed with the
# blue component, but assuming it is a greyscale RGB image,
# each should be more or less equivalent.
inputFile = wd + "cup.dep" # THIS IS WHAT I RENAMED THE IMAGE AS, BUT YOU CAN CHANGE IT TO SUIT YOUR NEEDS
outputAlpha = "false"
args = [inputFile, outputAlpha]
pluginHost.runPlugin("SplitColourComposite", args, False, True)
# Threshold one of the image so that 'low' values are
# assigned a 1, and 'high' values are given a 0.
inputFile1 = wd + "cup_Blue.dep"
constant = "128" # assumes an 8-bit image as in the given example data
outputFile = wd + "thresholded.dep"
args = [inputFile1, constant, outputFile]
pluginHost.runPlugin("LessThan", args, False, True)
# Perform line-thinning on the Boolean image
inputFile = wd + "thresholded.dep"
outputFile = wd + "thinned.dep"
args = [inputFile, outputFile]
pluginHost.runPlugin("LineThinning", args, False, True)
# Clump, or group, the thinned image
inputFile = wd + "thinned.dep"
outputFile = wd + "clumped.dep"
includeDiagonals = "false" # this is important
zeroBackground = "false"
args = [inputFile, outputFile, includeDiagonals, zeroBackground]
pluginHost.runPlugin("Clump", args, False, True)
# We'll have lots of little groups that are associated
# with the edges. We need to remove them.
# Calculate the area of each group in the clumped image
inputFile = wd + "clumped.dep"
outputFile = wd + "area.dep"
outputText = "false"
units = "grid cells"
zeroBackground = "true" # this is important
args = [inputFile, outputFile, outputText, units, zeroBackground]
pluginHost.runPlugin("Area", args, False, True)
# Re-assign the 'background' zero values in the area image
# a 'No Data' value. This is important for the next step.
inputFiles = wd + "area.dep"
backgroundValue = "0.0"
args = [inputFiles, backgroundValue]
pluginHost.runPlugin("SetNoData", args, False, True)
# Pass a 3 x 3 maximum filter over the image. The small edge
# groups will be assigned the area values of the larger
# interior groups.
inputFile = wd + "area.dep"
outputFile = wd + "area corrected.dep"
xDim = "3"
yDim = "3"
rounded = "false"
reflectEdges = "true"
args = [inputFile, outputFile, xDim, yDim, rounded, reflectEdges]
pluginHost.runPlugin("FilterMaximum", args, False, True)
# You could optionally run a second clumping operation here
# if you want to assign each polygon a unique ID.
# Lastly convert this raster to a vector polygon file
# and display the vector.
inputFile = wd + "area corrected.dep"
outputFile = wd + "final polygons.shp"
args = [inputFile, outputFile]
pluginHost.runPlugin("RasterToVectorPolygons", args, False)
print "Operation complete!"