tri.surf: Fit a delaunay triangulation to an outline of landmarks.

Description Usage Arguments Value Examples

View source: R/tri.surf.R

Description

Fit a delaunay triangulation to an outline of landmarks.

Usage

1
2
3
4
5
6
7
tri.surf(
  tri.object,
  point.map,
  num.passes,
  corresponding.image = NULL,
  flip.delaunay = F
)

Arguments

tri.object

A 2D matrix of landmarks to initialize delaunay triangulation. This should be the configuration you used for unwarping. If you did your unwarping in Colormesh, the target configuration was returned by the function.

point.map

A vector that denotes the correct order of landmarks in tri.object. Landmarks must form a perimeter for delaunay triangulation

num.passes

How many rounds of delaunay triangulation to perform. In each pass, the centroids of the triangles will be calculated and be used as points in the next round of triangulation.

corresponding.image

Supply a corresponding image to the mesh to make sure that the points line up with the image correctly. If an image is not provided, no plot will be produced.

flip.delaunay

Logical value for fliping the Y-axis of the delaunay points. Set delaunay.flip to true if your points appear upside down on the image.

Value

A list of class tri.surf.points. $interior is the position of internal (non-perimeter) points generated from triangulation. $perimeter is the initial points submitted for triangulation. $centroids is the final set of centroids from the triangulation. $final.mesh is the last round of triangulation. $point.map is the point map used to give the order of perimeter landmarks.

Examples

1
2
3
consensus <- tps2array(system.file("extdata", "consensus_LM_coords.TPS", package = "Colormesh"))
test.image <- image_reader(paste0(path.package("Colormesh"),"/extdata/unwarped_images/"), "GPLP_unw_001.jpg")
delaunay.map <- tri.surf(consensus, point.map = c(1,8:17,2, 18:19,3,20:27,4, 28:42,5,43:52,6,53:54,7,55:62), 3, test.image)

J0vid/Colormesh documentation built on Feb. 4, 2022, 1:33 a.m.