Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

imager (version 0.14)

threshold: Threshold grayscale image

Description

Thresholding corresponding to setting all values below a threshold to 0, all above to 1. If you call threshold with a string argument of the form "XX

Usage

threshold(im, thr, approx = TRUE)

Arguments

im
the image
thr
a threshold, either numeric, or a string with format "XX%". In the case of the latter, XX will be interpreted as a percentile (set the lower XX% of the pixels to 0, the rest to 1)
approx
Skip pixels when computing quantiles in large images (default TRUE)

Value

  • a thresholded image

Examples

Run this code
im <- load.image(system.file('extdata/Leonardo_Birds.jpg',package='imager'))
grayscale(im) %>% threshold("15%") %>% plot

Run the code above in your browser using DataLab