From Slicer Wiki
Jump to: navigation, search
Home < Documentation < Labs < OpenCV


OpenCV is required for image processing tasks of a funded project that intends to use 3D Slicer for automating annotation of digital pathology images. It is also required by several other projects that plan to use OpenCV.


Build an extension SlicerOpenCV that encapsulates OpenCV libraries, and provides configuration/testing modules for the developers, but no end-user functionality. Implement user-level functionality in separate extensions that would depend on SlicerOpenCV.

Extensions that need OpenCV would declare SlicerOpenCV as a dependency, which would automatically fetch the extension on install from the Extension Manager, or initialize all necessary paths to the libraries for building a dependent module. This extension will also build ITK OpenCVBridge module to facilitate integration with ITK-based applications.

We should also consider building pydicom as part of that extension.

Alternative approaches considered

Other options discussed were:

  • installation of OpenCV from binary package (discarded due to incompatibility of the compilers used for OpenCV and Slicer packaged builds on Windows)
  • reuse of the Anaconda (discarded due to the present lack of integration of anaconda (in progress), and the fact that pyopencv is not a standard package)
  • superbuild of OpenCV within an extension providing user-level functionality (discarded since this would not allow the reuse of OpenCV libraries across extensions, and we see several potential users)

Unresolved questions

  • what OpenCV packages are needed by the target users?
  • are Intel-specific of GPU-specific computational libraries needed? (these have licensing restrictions)


  • SBU (Yi): Matrices, color space conversion, iso contour extraction
  • Montreal group (MNI, Louis Collins): only need camera calibration and basic functionality to track colored objects in video; no GPU or Intel libraries needed


  • March 2016: SlicerOpenCV is introduced into ExtensionIndex
  • Jan 2016:
    • Slicer's version of ITK has been patched to allow building the OpenCV bridge module externally, SlicerOpenCV updated to use that functionality.
    • Work is in progress to provide CMake configuration files to easily allow other extensions to build against SlicerOpenCV
  • Dec 2015: Initial tree of the extension is available publicly
  • Oct 2015: Initial discussions and initial plan completed. Update posted to the developer list [1].