Getting Started with imagerExtara

Shota Ochi


imagerExtra provides several advanced functions for image processing.

I will introduce the functions briefly.

imagerExtara is based on imager.

See the vignettes of imager if you aren’t familiar with imager.


Most of the functions of imagerExtra are for grayscale image.

See the vignette Treating Color Image with imagerExtra if you want to treat color image with imagerExtra

Let’s prepare a grayscale image.

If you want to treat color image, see the vignette “treating color image with imagerExtra”.

g <- grayscale(boats)

Piecewise Affine Histogram Equalization

Piecewise Affine Equalization (PAE) enhances contrast of image.

PAE has three parameters: N, smin, and smax.

However, we should not change smin. See Jose-Luis Lisani, et al., IPOL, 2 (2012), pp. 243-265. for detail.

That’s why PAE has two parameters in practice.

the parameter N

N controls how the input gray level will be mapped in the output image.

We don’t have a priori choice for N. You will tune N mainly.

PAE acts as Histogram Equalization if N is large.

the parameter smax

smax controls the upper limit of contrast stretching.

If you want to prevent excessive enhancement of contrast, you should make smax low.

Simplest Color Balance

Simplest Color Balance (SCB) enhances contrast of image.

SCB assumes that objectives in image have moderate pixel values.

That’s why SCB saturates a percentage sleft % of the pixels on the left side of the histogram, and a percentage sright % of the pixels on the right side of the histogram.

See Nicolas Limare, et al., IPOL, 1 (2011), pp. 297-315. for detail.

the parameters sleft and sright

sleft is a saturation percentage of the pixels on the left side of the histogram.

sright is a saturation percentage of the pixels on the right side of the histogram.

the parameter range

SCB applies affine transformation after saturating pixels.

range defines the output range.

Default of range is [0,255]. You may prefer [0,1].

Screened Poisson Equation

Screend Poisson Equalization (SPE) enhances contrast of image.

The distinction of SPE is that SPE corrects the inhomogeneous background of image.

See Jean-Michel Morel, et al., IPOL, 4 (2014), pp. 16-29. for detail.

Note that the performance of this function is bad because the implementation of 2D DCT is not efficient.

the parameter lamda

lamda controls how strong corrects inhomogeneous background of image.

SPE corrects inhomogeneous background strongly if lamda is large.

the parameters s and range

SPE uses Simplest Color Balance. s and range are the parameters for Simplest Color Balance.

s is used as both sleft and sright.

DCT denoising

DCT denoising is a simple and effective denoising algorithm using local DCT thresholding.

See Guoshen Yu, and Guillermo Sapiro, IPOL, 1 (2011), pp. 292-296. for detail.

the parameter sdn

sdn is a standrd deviation of noise of image.

The noise is strongly denoised if sdn is large.

the parameter flag_dct16x16

flag_dct16x16 determiens window size of local patches. DCT denoising uses 8x8 windows or 16x16 window.

Larger window size does not bring significant improvement when noise level is low.

Larger window size outperforms significantly smaller window size when noise level is low.

Iterative Triclass Thresholding

Iterative triclass thresholding is an iterative thresholding technique.

We need to set a rule to stop iteration.

We have two options. * set preset threshold (stopval) * set repeat number (repeatnum)

See [the intoroduction] if you want to know about iterative triclass thresholding.

the parameter stopval and repeatnum

stopval determines a preset threshold to stop iteration.

repeatnum determines how many times we repeat.