patRegHSV: Aligns images using 'niftyreg' utilities for automated image...

View source: R/patRegHSV.R

patRegHSVR Documentation

Aligns images using niftyreg utilities for automated image registration and extracts colors using a predefined HSV values and cutoff value.

Description

Aligns images using niftyreg utilities for automated image registration and extracts colors using a predefined HSV values and cutoff value.

Usage

patRegHSV(
  sampleList,
  target,
  HSV,
  resampleFactor = NULL,
  useBlockPercentage = 75,
  colOffset = 0.1,
  crop = c(0, 0, 0, 0),
  removebgR = NULL,
  maskOutline = NULL,
  plot = FALSE,
  focal = FALSE,
  sigma = 3,
  iterations = 0,
  ignoreHSVvalue = FALSE,
  patternsToFile = NULL
)

Arguments

sampleList

List of RasterStack objects.

target

Image imported as RasterStack used as target for registration.

HSV

Values for color pattern extraction specified as HSV vector.

resampleFactor

Integer for downsampling used by redRes (default = NULL).

useBlockPercentage

Block percentage as used in niftyreg (default = 75).

colOffset

Color offset for color pattern extraction (default = 0.10).

crop

Vector c(xmin, xmax, ymin, ymax) that specifies the pixel coordinates to crop the original image.

removebgR

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

maskOutline

When outline is specified, everything outside of the outline will be masked for the color extraction (default = NULL).

plot

Whether to plot transformed color patterns while processing (default = FALSE). Transformed color patterns can be plot on top of each other ('stack') or next to the original image for each sample ('compare').

focal

Whether to perform Gaussian blurring (default = FALSE).

sigma

Size of sigma for Gaussian blurring (default = 3).

iterations

Number of iterations for recalculating average color (default = 0). If set, the RGB value for pattern extraction will be iteratively recalculated to be the average of the extracted area. This may improve extraction of distinct color pattern, but fail for more gradually distributed (in color space) patterns.

ignoreHSVvalue

Whether to ignore the HSV value (~darkness).

patternsToFile

Name of directory to which the color pattern of each individual will be outputted (default = NULL).

Value

List of raster objects.

Examples

## Not run: 
IDlist <- c('BC0077','BC0071','BC0050','BC0049','BC0004')
prepath <- system.file("extdata",  package = 'patternize')
extension <- '.jpg'

imageList <- makeList(IDlist, 'image', prepath, extension)

target <- imageList[[1]]

HSV <- c(0.025,1,0.45)

# Note that this example only aligns one image with the target,
# remove [2] to run a full examples.
rasterList_regHSV <- patRegRGB(imageList[2], target, HSV,
colOffset= 0.15, crop = c(100,400,40,250), removebgR = 100, plot = 'stack')

## End(Not run)


StevenVB12/patternize documentation built on Nov. 2, 2023, 8:01 p.m.