load_image: Load image from file or URL

View source: R/load_image.R

load_imageR Documentation

Load image from file or URL

Description

load_image is a vectorized method for reading bitmaps (jpegs, pngs and bmps) into memory as arrays of pixel values. It optionally supports parallel processing (via future and future.apply) and progress reporting.

Usage

load_image(file, quiet = FALSE)

Arguments

file

A vector of file paths or URLs which identify bitmapped images in the JPEG, PNG, TIFF, or BMP file formats. If file is length-one, it can be the path to a directory containing images. Elements of file which are URLs must begin with "http", "https", "ftp" or "ftps".

quiet

A logical scalar. Should the function execute quietly, or should it return status updates throughout the function (default)?

Details

load_image only supports 3-channel (RGB) or 1-channel (greyscale) images; 4-channel (RGBA) images will have their alpha channel silently dropped and 2-channel (greyscale with alpha) images will have only their alpha channel preserved, while images with 5 or more channels will return as NA.

Because the memory requirements of storing image representations in memory so large, it is usually not feasible to read in more than several hundred images at a time with load_image. For these cases, use create_signature directly on the input file paths. By default this will read images with load_image 100 at a time before generating the unique colour signatures used for image matching.

Value

A matchr_image vector of the same length as the input vector.

Examples

## Not run: 
load_image(test_urls)

## End(Not run)

UPGo-McGill/matchr documentation built on July 19, 2023, 1:02 p.m.