I have a picture like this
I can get this graph's vertexes
mor = MorphologicalBinarize[img // ColorNegate] //
DeleteSmallComponents // ColorNegate // MorphologicalComponents;
selectmor =
SelectComponents[
mor, {"AreaRadiusCoverage", "Count"}, # > 0.78 && #2 < 1000 &] //
Image;
mask = Graphics@
Point@ComponentMeasurements[selectmor, "Centroid"][[All, 2]]
Or get its edges
fillimg =
FillingTransform[
MorphologicalBinarize[img // ColorNegate] //
DeleteSmallComponents // Thinning // Pruning,
selectmor // Binarize] // Thinning // Pruning;
lines = ImageLines[fillimg, MaxFeatures -> 200,
Method -> {"Hough", "Segmented" -> True}];
Graphics[{Thick, Red, Line /@ lines}]
This my current work. May be you can realize it by more smart method. My target is not a Image
but a Graph
. So how to rebuild the Graph
by this vertex
and this edge
?
Update:
After the M.R.'s comments (Thanks for your comment), we can use the MorphologicalGraph
to get the embryo of graph.
fillimg // MorphologicalGraph[#, VertexLabels -> "Name"] &
But it have a low precision. So How to refine it?
MorphologicalGraph
in your link.But its precision is very poor when I try to do it.It will introduce many superfluous vertex. $\endgroup$