Simon Barthelmé (GIPSA-lab, CNRS)
R is a bit lacking in the area of image processing, where Matlab is still king. Imager aims to make image processing work in R easier. It is based on CImg, a C++ library by David Tschumperlé. CImg provides an easy-to-use and consistent API for image processing, which imager largely replicates. CImg supports images in up to four dimensions, which makes it suitable for basic video processing/hyperspectral imaging as well.
At this stage imager contains over 100 functions, and covers all the classics:
imager aims to be fast (doing things in C++ as much as possible), but also R-friendly, and defines many convenience functions that make it easy to work with native R datatypes and functions.
Imager is now on CRAN, so
should to the trick. If you prefer the latest development version, see our Github page.
OS X users need to install XQuartz: https://www.xquartz.org/. You’ll also need ImageMagick and ffmpeg if you want to work with videos, or import and save images in formats other than BMP, TIFF, PNG and JPEG. On Linux these should be available from standard repositories (ie. “sudo apt-get install ffmpeg” should work). On OS X they are available via brew: “brew install imagemagick ffmpeg”.
There’s a tutorial included in the package: hit
or click here.
The tutorial covers basic image manipulation, plotting use base graphics and ggplot2, getting image data in and out, and an example of multiscale blob detection.
The next step is to learn about pixsets, which are used to represent sets of pixels (e.g., the foreground in an image).
The vignette includes an example of image segmentation.
You might find CImg’s doc useful as well.
See here for Frequently Asked Questions.
how to write fast functional code: a loop-free Canny edge detector
Where do I find the bucket tool in imager?
Image splitting, simplification and recursive data structures.
Shuffle the columns of an image, and put it back together by solving a TSP.
How to parallelise computations
An (incomplete) tutorial on image statistics
A tutorial on morphology and detrending
Importing image data from other R packages
Bugs and miscellaneous problems can be reported on the issues page on Github.