3
$\begingroup$

How to calculate a Delaunay mesh nerve? A Delaunay mesh nerve is a collection of triangles that surround a single triangle called the nerve nucleus. The triangles in a Delaunay mesh nerve either have a common edge or a common vertex with the nerve nucleus. Here, nerve nucleus means that triangle which has maximum area in a Delaunay mesh.

Here is the code I developed to find the Delaunay mesh. But, I can't calculate the mesh nerve. Please kindly let me know. Thanks.

c = ImageCorners[img, MaxFeatures -> 200];
dm = DelaunayMesh[c];
$\endgroup$
6
  • $\begingroup$ I am unfamiliar with the concept of the "nerve" of a mesh, and a quick google search did not return anything pertinent. Could you perhaps point to a web site with a definition and a few examples. $\endgroup$
    – MarcoB
    Feb 1, 2016 at 4:22
  • 1
    $\begingroup$ A Delaunay mesh nerve is a collection of triangles that surround a single triangle called the nerve nucleus. The triangles in a Delaunay mesh nerve either have a common edge or a common vertex with the nerve nucleus.Here, Nerve nucleus means that triangle which has maximum area in a Delaunay mesh. $\endgroup$
    – Odrisso
    Feb 1, 2016 at 21:23
  • $\begingroup$ OK thank you for the clarification regarding the definition of the nucleus. Please take a look at my answer below. $\endgroup$
    – MarcoB
    Feb 2, 2016 at 5:52
  • $\begingroup$ Related: (105201) $\endgroup$
    – Mr.Wizard
    Feb 3, 2016 at 14:08
  • $\begingroup$ @Mr.Wizard I would say it's not an exact duplicate. The question you mention asks for the polygon with the most adjacent polygons in a mesh; that polygon does not necessarily have to be the one with the largest area. $\endgroup$
    – MarcoB
    Feb 3, 2016 at 14:30

1 Answer 1

13
$\begingroup$

The approach I would take is the following:

  1. Clear definitions, load a sample image, find corners in the image using the method you indicated in the OP:

    Clear[img, points, dm, cells, nerve, nervenucleus]
    img = ExampleData[{"TestImage", "Aerial2"}];
    points = ImageCorners[img, MaxFeatures -> 200];
    
  2. Generate a Delaunay mesh from those points:

    dm = DelaunayMesh[
           points, PlotTheme -> "Lines",
           MeshCellStyle -> Directive[EdgeForm[GrayLevel[0.3]], Opacity[0]]
         ];
    
    Show[img, dm]
    

    Mathematica graphics

  3. Extract the coordinates for the two-dimensional cells (triangles) that make up the mesh:

    cells = MeshPrimitives[dm, 2];
    
  4. Find the "nucleus", which you defined as the triangle with the largest area in the mesh:

    nucleus = First@MaximalBy[cells, Area];
    Show[img, dm, Graphics[{Opacity[0.4], Red, nucleus}]]
    

    Mathematica graphics

  5. Find the "nerve", that you defined as the set of cells that share a vertex or an edge with the nucleus (note that the nucleus itself is not included in this list thanks to the second part of the condition):

    nerve = Cases[
       cells,
       Polygon[{p1_, p2_, p3_}] /;
        (
         ContainsAny[{p1, p2, p3}, nucleus[[1]] ] && {p1, p2, p3} != nucleus[[1]]
        )
      ];
    
  6. Show all results:

    Show[img, dm, Graphics[{Opacity[0.4], Red, nucleus, Darker@Green, nerve}]]
    

    Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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