img_read: Read a greyscale image

View source: R/img_read.R

img_readR Documentation

Read a greyscale image

Description

Read a greyscale image

Usage

img_read(file, invert = FALSE)

Arguments

file

path to the input image file.

invert

when TRUE, invert the input image (useful for further processing functions such as img_moments() that reaquire light-on-dark input images to make sense.)

Value

A imager::cimg() object, which is a four-dimensional numeric array having x,y,z,c coordinates, where x,y are image pixel dimensions, z is depth (for a sequence of images), and c is colour channels (1 for greyscale images, 3 for RGB images, 4 for RGBA images).

Examples

path <- system.file("extdata", "blob.jpg", package="morphr")
img_read(path) %>% img_show()
img_read(path, invert=TRUE) %>% img_show()
# or shorter
img_read(path, i=TRUE) %>% img_show()

jiho/morphr documentation built on May 11, 2024, 9:32 p.m.