Type: Package
Title: Helper Package for Installing OpenCV with R
Version: 4.110.0
Date: 2025-05-01
Maintainer: Simon Garnier <garnier@njit.edu>
Description: Installs 'OpenCV' for use by other packages. 'OpenCV' https://opencv.org/ is library of programming functions mainly aimed at real-time computer vision. This 'Lite' version installs the stable base version of 'OpenCV' and some of its experimental externally contributed modules. It does not provide R bindings directly.
License: GPL-3
Imports: utils, parallel
SystemRequirements: cmake
RoxygenNote: 7.3.2
Biarch: false
Encoding: UTF-8
Depends: R (≥ 4.0.0)
Suggests: covr, knitr, rmarkdown
VignetteBuilder: knitr
URL: https://swarm-lab.github.io/ROpenCVLite/, https://github.com/swarm-lab/ROpenCVLite
BugReports: https://github.com/swarm-lab/ROpenCVLite/issues
NeedsCompilation: no
Packaged: 2025-05-05 10:24:05 UTC; simon
Author: Simon Garnier ORCID iD [aut, cre], Muschelli John [ctb]
Repository: CRAN
Date/Publication: 2025-05-05 12:20:01 UTC

ROpenCVLite: A package to install OpenCV within R

Description

This is a utility package that installs OpenCV within R for use by other packages. This Lite version does not contain any of the contributed modules of OpenCV.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

Useful links:


Install Location of OpenCV

Description

This function returns the location at which OpenCV is installed.

Usage

OpenCVPath()

Value

A character string.

Author(s)

Simon Garnier, garnier@njit.edu

Examples

## Not run: 
 OpenCVPath()

## End(Not run)


Default Install Location of OpenCV

Description

This function returns the location at which OpenCV should be installed by default.

Usage

defaultOpenCVPath()

Value

A character string.

Author(s)

Simon Garnier, garnier@njit.edu

Examples

## Not run: 
defaultOpenCVPath()

## End(Not run)


Install OpenCV

Description

This function attempts to download, compile and install OpenCV on the system. This process will take several minutes.

Usage

installOpenCV(install_path = defaultOpenCVPath(), batch = FALSE)

Arguments

install_path

A character string indicating the location at which OpenCV should be installed. By default, it is the value returned by defaultOpenCVPath.

batch

A boolean indicating whether to skip (TRUE) or not (FALSE, the default) the interactive installation dialog. This is useful when OpenCV needs to be installed in a non-interactive environment (e.g., during a batch installation on a server).

Value

A boolean.

Author(s)

Simon Garnier, garnier@njit.edu

Examples

## Not run: 
installOpenCV()

## End(Not run)


Check Cmake Installation

Description

This function checks that Cmake is installed on the system.

Usage

isCmakeInstalled()

Value

A boolean.

Author(s)

Simon Garnier, garnier@njit.edu

Examples

isCmakeInstalled()


Check OpenCV Installation

Description

This function checks that OpenCV is installed and accessible.

Usage

isOpenCVInstalled()

Value

A boolean.

Author(s)

Simon Garnier, garnier@njit.edu

Examples

isOpenCVInstalled()


C/C++ configuration options

Description

This function returns the configuration options for compiling C/C++-based packages against OpenCV installed by ROpenCVLite.

Usage

opencvConfig(output = "libs", arch = NULL)

Arguments

output

Either 'libs' for library configuration options or 'cflags' for C/C++ configuration flags.

arch

architecture relevant for Windows. If NULL, then R.version$arch will be used.

Value

A concatenated character string (with cat) of the configuration options.

Author(s)

Simon Garnier, garnier@njit.edu

Examples

## Not run: 
 if (isOpenCVInstalled()) {
   opencvConfig()
   opencvConfig(output = "cflags")
   opencvConfig(arch = R.version$arch)
 }

## End(Not run)


OpenCV Version

Description

This function determines the version of OpenCV installed within R.

Usage

opencvVersion()

Value

A character string.

Author(s)

Simon Garnier, garnier@njit.edu

Examples

if (isOpenCVInstalled()) {
  opencvVersion()
}


Remove OpenCV

Description

This function removes OpenCV from the system.

Usage

removeOpenCV()

Value

A boolean.

Author(s)

Simon Garnier, garnier@njit.edu

Examples

## Not run: 
installOpenCV()

## End(Not run)