Hi All,
This is a follow up to my previous question posted here that was about skeletonizing a 2D image (notebook is also available here).
This was the input image used. I would like to ask for suggestions on how to obtain the thickness of the edges in this input image.
I tried the following to obtain thickness as edge weights
img = input image
gray = ImagePad[ImageCrop[ColorConvert[img, "Grayscale"], ImageDimensions[img] - 6],10]
bin = Binarize[gray, 0.07]
g = MorphologicalGraph[bin, EdgeWeight -> Automatic];
weights = OptionValue[Options[g, EdgeWeight], EdgeWeight]
But from what I read in a discussion thread, EdgeWeight -> Automatic sets edge lengths as edge weights.
So I tried what has been suggested here
vertices = VertexList[g];
crds = OptionValue[Options[g, VertexCoordinates], VertexCoordinates];
edges = List @@@ EdgeList[g];
GraphPlot[Rule @@@ edges,
VertexCoordinateRules -> Thread[vertices -> crds],
EdgeRenderingFunction -> (With[{w =
Pick[Rescale[weights], edges, (#2 | Reverse[#2])][[1]]},
{Thickness[.02 (.1 + w)],
ColorData["SunsetColors"][.9 w], Line[#1]}] &),
AspectRatio -> 1]
The output doesn't appear to be right,
Any suggestions will be helpful
Many thanks