5
$\begingroup$

Highlighting an image with a graph seems to change the styles of the graph vertices:

img = CloudGet[CloudObject[
  "https://www.wolframcloud.com/objects/f28eb939-485b-4899-8ff7-e6c7d64cef60"]]
mg = MorphologicalGraph[
   DeleteSmallComponents[Binarize[RidgeFilter[img, 3.5]], 20.7], 
   VertexSize -> 7, VertexStyle -> Yellow,
   EdgeStyle -> Directive[Red, Thickness[0.01]], ImageSize -> Large];
Row[{mg, HighlightImage[img, {Show@mg}, ImageSize -> Large]}]

enter image description here

Is there any way to prevent that?

$\endgroup$

1 Answer 1

4
$\begingroup$

Your code is fine and the style is preserved, but the edges are actually not completely opaque which makes them darker when the black of the image is in the background. Try something like this

mg = MorphologicalGraph[
   DeleteSmallComponents[Binarize[RidgeFilter[img, 3.5]], 20.7], 
   VertexSize -> 7, 
   VertexStyle -> Directive[Opacity[1, Yellow], 
     EdgeForm[Directive[Thickness[0.002], Opacity[1, Red]]]], 
   EdgeStyle -> Directive[Red, Thickness[0.01]], ImageSize -> Large];
HighlightImage[img, Show@mg, ImageSize -> Large]

Mathematica graphics

$\endgroup$

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.