Graphics and networks – extraction of crack statistics (craquelure in paintings)

The following image shows the pattern of cracks in the surface by Johannes Vermeer The girl with the pearl earring, recorded with a method called "Grazing Incident Illumination" (the light is directed at the painting from a very large angle). There was simple image processing to just uncover the cracks. You will notice that the area of ​​your face has very different crack statistics (density, average crack length, etc.) than outside of your face.

Craquelure in

I would like to develop one Mathematica Tool for extracting image data so that I can compute statistics about such a "craquelé" in paintings like this:

  • Histogram of crack length (distances between crack intersections), d. H. Lengths of each "path" in a diagram
  • Orientations of each crack ($ 0 to pi $)
  • average total density of cracks (number of cracks per unit area)

and so on. Calculating and plotting and histograming such data is not the problem; Extract the raw data.

The first step is to create a mathematical diagram of the image data. Define the image above as craquelureImageand then calculate:

paintingGraph= MorphologicalGraph@
 ColorReplace(craquelureImage, {White -> Black, Black -> White})

This results in a fine diagram with several thousand corner points:

Craquelé graphic

As with any conventional diagram, connectivity (edges), vertices, their position, etc. can be checked using common software functions.

However, this graphic is not suitable for a complete analysis. It contains ways (linear sequences of edges) that are really just a single Edge. So we have to do what graph theorists call "path contraction" – replace each such linear path with a single Edge.

In a separate question on this site @kglr wrote very clever code that does such a path contraction and maintains the spatial position of the uncontracted vertices. This code works well for diagrams generated with traditional code.

However, for an unknown reason, it doesn't work paintingGraph, defined above. It somehow encrypts the positions of vertices or incorrectly assigns edges. I've examined that VertexList, EdgeListand so on of the underlying chart and cannot determine why it is not working. Hence my first problem:

Problem 1: This is how the path contraction code works paintingGraph. I can only guess that one of & # 39; MorphologicalGraph & # 39; created chart is something special that is not obvious.

Assume that the problem is solved and the spatial positions of the corner points are correct …

Problem 2: How do you extract the spatial lengths and orientations of each crack segment from the diagram?

For reasons of material physics, cracks (in paintings, in dry mud, …) always meet at corner points of the third degree. That means they look like T.s (with a certain orientation). Again, for fundamental physical reasons that involve sequential stress relief in the drying ink angle of T.s are almost exact $ 90 ^ circ $. Can we demonstrate that? We can easily extract vertices in the degree graph $ 3 $. Especially with these three cornerstones …

Problem 3: How do we calculate the relative angle of the intersection? T.?