Skip to contents

Applies a function to the extracted numeric matrix of values behind an image and returns the result. Only useable for single-channel images.

Usage

img_apply(image, fun, censor_bbox = NULL, format = "xywh", ...)

Arguments

image

character or magick-image. Image to extract information from.

fun

function reference. The function to be applied.

censor_bbox

list or numeric vector. Region(s) to be censored and converted to NA in the image data matrix before applying fun. Can be used to exclude sections of images such as camera company logos and camera strips when calculating averages from outputs of functions such as img_difference() and img_luminosity().

format

character. Format of provided bounding box(es). See bbox_convert().

...

Additional arguments passed to fun. If using censor_bbox, many functions will require the use of na.rm = TRUE here.

Value

varies based on function applied.