Wrapping OpenCV

0
279
2 min read

(For more resources related to this topic, see here.)

Architecture overview

In this section we will examine and compare the architectures of OpenCV and Emgu CV.

OpenCV

In the hello-world project, we already knew our code had something to do with the bin folder in the Emgu library that we installed. Those files are OpenCV DLLs, which have the filename starting with opencv_. So the Emgu CV users need to have some basic knowledge about OpenCV.

OpenCV is broadly structured into five main components. Four of them are described in the following section:

  • The first one is the CV component, which includes the algorithms about computer vision and basic image processing. All the methods for basic processes are found here.
  • ML is short for Machine Learning, which contains popular machine learning algorithms with clustering tools and statistical classifiers.

  • HighGUI is designed to construct user-friendly interfaces to load and store media data.
  • CXCore is the most important one. This component provides all the basic data structures and contents.

The components can be seen in the following diagram:

The preceding structure map does not include CvAux, which contains many areas. It can be divided into two parts: defunct areas and experimental algorithms. CvAux is not particularly well documented in the Wiki, but it covers many features. Some of them may migrate to CV in the future, others probably never will.

Emgu CV

Emgu CV can be seen as two layers on top of OpenCV, which are explained as follows:

  • Layer 1 is the basic layer. It includes enumeration, structure, and function mappings. The namespaces are direct wrappers from OpenCV components.
  • Layer 2 is an upper layer. It takes good advantage of .NET framework and mixes the classes together. It can be seen in the bridge from OpenCV to .NET.

The architecture of Emgu CV can be seen in the following diagram, which includes more details:

After we create our new Emgu CV project, the first thing we will do is add references. Now we can see what those DLLs are used for:

  • Emgu.Util.dll: A collection of .NET utilities
  • Emgu.CV.dll: Basic image-processing algorithms from OpenCV
  • Emgu.CV.UI.dll: Useful tools for Emgu controls
  • Emgu.CV.GPU.dll: GPU processing (Nvidia Cuda)
  • Emgu.CV.ML.dll: Machine learning algorithms

Subscribe to the weekly Packt Hub newsletter

* indicates required

LEAVE A REPLY

Please enter your comment!
Please enter your name here