RNotes | EBImage


This is an attempt to replicate Introduction to EBImage by Andrzej Oles et al, Dec. 3, 2014, using R markdown in RStudio.

1 Reading, displaying and writing images

The package EBImage is loaded by the following command.

library("EBImage")

The function readImage is able to read images from files or URLs. Currently supported image formats are JPEG, PNG and TIFF1. (See the RBioFormats package for support of a much wider range of formats.)

f <- system.file("images", "sample.png", package="EBImage")
img <- readImage(f)

Images can be displayed using the function display. Pixel intensities should range from 0 (black) to 1 (white).

Color images or images with multiple frames can also be read with readImage.

imgc = readImage(system.file("images", "sample-color.png", package="EBImage"))
par(mfrow=c(1,2))
display(img,  title="Figure 1:  img")
display(imgc, title="Figure 1:  imgc")