patLanK {patternize} | R Documentation |
Aligns images usings transformations obtained from fixed landmarks and extracts colors using k-means clustering.
Description
Aligns images usings transformations obtained from fixed landmarks and extracts colors using k-means clustering.
Usage
patLanK(
sampleList,
landList,
k = 3,
fixedStartCenter = NULL,
resampleFactor = NULL,
crop = FALSE,
cropOffset = c(0, 0, 0, 0),
res = 300,
transformRef = "meanshape",
transformType = "tps",
removebg = NULL,
removebgColOffset = 0.1,
adjustCoords = FALSE,
plot = FALSE,
focal = FALSE,
sigma = 3
)
Arguments
sampleList |
List of RasterStack objects. |
landList |
Landmark list as returned by |
k |
Integere for defining number of k-means clusters (default = 3). |
fixedStartCenter |
Specify a dataframe with start centers for k-means clustering. |
resampleFactor |
Integer for downsampling used by |
crop |
Whether to use the landmarks range to crop the image. This can significantly speed up the analysis (default = FALSE). |
cropOffset |
Vector c(xmin, xmax, ymin, ymax) that specifies the number of pixels you want the cropping to be offset from the landmarks (in case the landmarks do not surround the entire color pattern). The values specified should present the percentage of the maximum landmark value along the x and y axis. |
res |
Resolution for color pattern raster (default = 300). This should be reduced if the number of pixels in the image is lower than th raster. |
transformRef |
ID of reference sample for shape to which color patterns will be transformed to. Can be 'meanshape' for transforming to mean shape of Procrustes analysis. |
transformType |
Transformation type as used by |
removebg |
Integer or RGB vector indicating the range of RGB threshold to remove from image (e.g. 100 removes pixels with average RGB > 100; default = NULL). |
removebgColOffset |
Color offset for color background extraction (default = 0.10). |
adjustCoords |
Adjust landmark coordinates in case they are reversed compared to pixel coordinates (default = FALSE). |
plot |
Whether to plot transformed color patterns while processing (default = FALSE). |
focal |
Whether to perform Gaussian blurring (default = FALSE). |
sigma |
Size of sigma for Gaussian blurring (default = 3). |
Value
List of summed raster for each k-means cluster objects.
Examples
## Not run:
IDlist <- c('BC0077','BC0071','BC0050','BC0049','BC0004')
prepath <- system.file("extdata", package = 'patternize')
extension <- '_landmarks_LFW.txt'
landmarkList <- makeList(IDlist, 'landmark', prepath, extension)
extension <- '.jpg'
imageList <- makeList(IDlist, 'image', prepath, extension)
# Note that this example only aligns two images with the target,
# remove [1:2] to run a full examples.
rasterList_lanK <- patLanK(imageList[1:2], landmarkList[1:2], k = 4, crop = TRUE,
res = 100, removebg = 100, adjustCoords = TRUE, plot = TRUE)
## End(Not run)