patLanK_HSV {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_HSV(
  sampleList,
  landList,
  k = 3,
  fixedStartCenter = NULL,
  resampleFactor = NULL,
  crop = FALSE,
  cropOffset = c(0, 0, 0, 0),
  res = 300,
  transformRef = "meanshape",
  transformType = "tps",
  removebgK = NULL,
  adjustCoords = FALSE,
  plot = FALSE,
  focal = FALSE,
  sigma = 3,
  ignoreHSVvalue = FALSE
)

Arguments

sampleList

List of RasterStack objects.

landList

Landmark list as returned by makeList.

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 redRes.

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 computeTransform (default ='tps').

removebgK

Integer indicating the range RGB treshold to remove from image (e.g. 100 removes pixels with average RGB > 100; default = NULL) for k-means analysis. This works only to remove a white background.

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).

ignoreHSVvalue

Whether to ignore the HSV value (~darkness).

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, removebgK = 100, adjustCoords = TRUE, plot = TRUE)

## End(Not run)


[Package patternize version 0.0.5 Index]