tri.surf | R Documentation |
Fit a delaunay triangulation to an outline of landmarks.
tri.surf(
tri.object,
point.map,
num.passes,
corresponding.image = NULL,
flip.delaunay = F
)
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. |
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.