Learn R Programming

mlpack (version 4.5.1)

image_converter: Image Converter

Description

A utility to load an image or set of images into a single dataset that can then be used by other mlpack methods and utilities. This can also unpack an image dataset into individual files, for instance after mlpack methods have been used.

Usage

image_converter(
  input,
  channels = NA,
  dataset = NA,
  height = NA,
  quality = NA,
  save = FALSE,
  verbose = getOption("mlpack.verbose", FALSE),
  width = NA
)

Value

A list with several components:

output

Matrix to save images data to, Onlyneeded if you are specifying 'save' option (numeric matrix).

Arguments

input

Image filenames which have to be loaded/saved (character vector).

channels

Number of channels in the image. Default value "0" (integer).

dataset

Input matrix to save as images (numeric matrix).

height

Height of the images. Default value "0" (integer).

quality

Compression of the image if saved as jpg (0-100). Default value "90" (integer).

save

Save a dataset as images. Default value "FALSE" (logical).

verbose

Display informational messages and the full list of parameters and timers at the end of execution. Default value "getOption("mlpack.verbose", FALSE)" (logical).

width

Width of the image. Default value "0" (integer).

Author

mlpack developers

Details

This utility takes an image or an array of images and loads them to a matrix. You can optionally specify the height "height" width "width" and channel "channels" of the images that needs to be loaded; otherwise, these parameters will be automatically detected from the image. There are other options too, that can be specified such as "quality".

You can also provide a dataset and save them as images using "dataset" and "save" as an parameter.

Examples

Run this code
#  An example to load an image : 

if (FALSE) {
output <- image_converter(input=X, height=256, width=256, channels=3)
Y <- output$output
}

#  An example to save an image is :

if (FALSE) {
image_converter(input=X, height=256, width=256, channels=3, dataset=Y,
  save=TRUE)
}

Run the code above in your browser using DataLab