ROpenCVLite - Install OpenCV with R

R-CMD-check Codecov test coverage CRAN status CRANLOGS downloads


ROpenCVLite is a utility package that installs OpenCV within R for use by other packages. This package is not a wrapper around OpenCV (it does not provide access to OpenCV functions in R), not is it a computer vision package for R. All it does is compiling and installing OpenCV within your R installation so that other packages can easily find it and compile against it.

Quick start guides

  1. Installing ROpenCVLite
  2. Using ROpenCVLite
  3. Function documentation


What is OpenCV?

OpenCV is one of the most - if not the most - popular and efficient open-source computer vision library available today. If you want to develop fast video processing software or implement real time computer vision algorithms, you pretty much have to use OpenCV nowadays.

Why is ROpenCVLite necessary?

There are no computer vision package available for R currently. There are some very good image processing packages (see imager for instance) but none of them can handle fast processing of large videos.

The goal of ROpenCVLite is to promote the development of efficient computer vision packages for R based on OpenCV. ROpenCVLite facilitates the installation of OpenCV in a convenient location for other packages to find it and compile against it.

Couldn’t you just ship OpenCV’s binaries with your package?

Yes, but… it is fairly difficult to ship binary files compiled against OpenCV that will work for sure on someone else’s computer. It is not OpenCV’s fault; it is because there are so many video formats and standards for peripherals out there that nobody can be certain what interfaces and libraries will be available on anyone’s computer to grab images from videos and camera streams. The least worst solution for developers is therefore to make sure that there is a copy of OpenCV on each user’s computer that has been compiled taking into account the specificities of said computer.


OpenCV is notoriously difficult to compile and install from scratch, especially for people without experience with low level languages. This is where ROpenCVLite come into play. This package tries as much as possible to cleanly compile OpenCV and to install it in a standardized location that all R package developers can easily find.

Why “Lite”? Are you keeping something from us?

ROpenCVLite compiles and installs the core modules of the OpenCV library but does not compile or install its contributed extra modules. This is to reduce the compilation time (which is already long enough) and also because most of these extra modules are (1) too specific for most applications of OpenCV, and (2) they do not always compile nicely.

We will work toward providing a mechanism to install the extra modules, but this is not part of our immediate plans.