img_centroid | R Documentation |
Compute the coordinates of the centroid of the object based on image moments. The centroid is based on shape if the image is binary and is weighted by the pixel values if it is not (in which case it is usually called the centre of mass).
img_centroid(x)
x |
a greyscale image, of type |
A vector with the x and y coordinates of the centroid.
x <- img_read(system.file("extdata", "plank/16199658.jpg", package="morphr"))
X_binary <- x < 1
X_inverted <- 1 - x
img_centroid(X_binary)
img_centroid(X_inverted)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.