3
$\begingroup$

I am using MorphologicalGraph on two images, which are visually indistinguishable, but the resulting graphs are different.

Clear["`*"];
im = ...;
MorphologicalGraph[Binarize@ColorNegate@im, VertexLabels -> Automatic]

The picture im is this:

enter image description here

The same picture is inconsistent with the node diagram obtained by running the code twice:

enter image description here

To be more specific: the first run of the code above uses this image:

enter image description here

The second run of the code uses this image:

enter image description here

Is there no difference in appearance, or are they different in nature?

$\endgroup$

1 Answer 1

5
$\begingroup$
  • At first we make the three pictures become more thick by RegionDilation.
img1 = Import["https://i.sstatic.net/5nOoGjHO.png"];
img2 = Import["https://i.sstatic.net/7A12xNXe.png"];
img3 = Import["https://i.sstatic.net/CF1onQrk.png"];
f = ColorNegate@
    Graphics@RegionDilation[ImageMesh@Binarize@ColorNegate@#, 10] &;
results = f /@ {img1, img2, img3}
MorphologicalGraph /@ results

enter image description here

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.