.Net Programming Hints -Using CVB libraries

<< Click to Display Table of Contents >>

Navigation:  Programming with Common Vision Blox > Compiler specific hints > .NET languages and CVB Programming Hints >

.Net Programming Hints -Using CVB libraries

 

In the .Net programming languages (C#, VB.Net, C++/CLI or in fact any other CLR-based language) the Common Vision Blox DLLs are included through managed wrapper DLLs that import the functions exported by the native DLLs through DLLImport attributes and expose them to managed assemblies through member functions of static classes.

The Common Vision Blox installer installs at least two sets of these wrapper DLLs:

One in the global assembly cache (which can be browsed by opening a Windows Explorer to the folder C:\Windows\assembly) and

one in the folder %CVB%\Lib\Net.

 

The latter location always only contains the very latest version of the managed wrappers for Common Vision Blox, whereas the global assembly cache potentially holds several of them: The very latest plus all older versions back to the last major update. This makes sure that when a managed program has been compiled versus e.g. Common Vision Blox 11.0 it is still usable on an installation of the most up-to-date Common Vision Blox without recompiling it.

 

To use one of the managed wrappers of Common Vision Blox you will need to add it to your project's references.

The precise approach to this varies between programming languages and Visual Studio version.

 

Unlike in unmanaged languages like C/C++ or Delphi, in .Net even static functions always have to be member functions of a class or struct, and each entity has to be part of a name space.

Therefore it is in those languages not possible to simply write the function name (e.g. CreateGenericImage(...)) - instead the whole path to the function needs to be given.

The mapping from the unmanaged function name to the name space and class in the managed domain is not visible from the Common Vision Blox documentation, but should be more or less apparent.

If not, the Visual Studio Object Browser can help you find what you are looking for.

Remember that it is possible to omit the leading name space(s) (like Cvb.)  by adding a using (C#) or Imports (VB.Net) statement.

 

How to include libraries in your managed .Net project

Before you can do anything with CVB in .Net, you need to add the references to our Stemmer.Cvb assemblies:

 

dotNetReferences

 

In the opened dialog switch to Browse and click on the Browse… button:

DotNet_Assemblies

 

Enter %CVB%Lib\Net

in your address list to jump to the CVB library directory for .Net.

Ignore the iXXX.dll group of DLLs (e.g. iCVCImg.dll) – these are the C-style P/Invoke assemblies.

We are interested in the Stemmer.Cvb.* assemblies.

 

Assemblies

 

Image Manager (and thus CameraSuite)

 

Stemmer.Cvb.dll

This is the core assembly containing basic Image and Device handling including acquisition via Streams and configuration (like GenICam GenApi or IDeviceControl).

This combines now the functionality of CVCError.dll, iCVCImg.dll, iCVCDriver.dll, iCVCUtilities.dll, and iCVGenApi.dll.

 

Stemmer.Cvb.Forms.dll

The CVB Display and GenApiGrid for Windows Forms apps.

If you reference this one Stemmer.Cvb.Extensions.dll and Stemmer.Cvb.Aux.dll are needed.

This combines the functionality of the CVDisplay ActiveX and CVGenApi ActiveX controls.

 

Stemmer.Cvb.Wpf.dll

The CVB Display and GenApiGrid for WPF apps.
You also need Stemmer.Cvb.Extensions.dll if you reference this assembly.

In principle this also combines the functionality of the CVDisplay ActiveX and CVGenApi ActiveX controls.

The display is a pure WPF implementation, though.

 

Stemmer.Cvb.Aux.dll

This is needed by the Stemmer.Cvb.Forms.Controls.Display for native interop handling (mostly overlay related).

 

Stemmer.Cvb.Extensions.dll

In here we put extension methods especially for the System.

Drawing namespace to be able to support .Net Core.

 

Foundation Package

Stemmer.Cvb.Foundation.dll

All Foundation functions and Foundation tools are bundled in here covering for example correlation, filtering, non-linear calibration, blob, optical flow and more.

Combined in here is the functionality of the iCVCFoundation.dll, iBayerToRGB.dll, iCVCEdge.dll, and iLightMeter.dll.

 

Tools

Stemmer.Cvb.Manto.dll

Stemmer.Cvb.Minos.dll

Stemmer.Cvb.Movie2.dll

Stemmer.Cvb.Polimago.dll

Stemmer.Cvb.SampleDatabase.dll

  (Sample Image List (SIL) handling)

Stemmer.Cvb.ShapeFinder.dll

 

 

Using the library functions

We support the standard for documentation of .Net.

Therefore we provide the so called IntelliSense, means the documention of functions available in the source code to make programing easier.

The namespace for our CVB libraries is Stemmer.Cvb.

The classes are the names of the libraries, e.g. Image, Driver ...

 

Means to use the Image Dll function IsGrabber looks like this:

CVB.Net

  CheckBoxGrab.Enabled = Cvb.Image.IsGrabber(Cvb.Image.ToCvbOBJ(AxCVimage1.Image))

CSharp

  CheckBoxGrab.Enabled = Cvb.Image.IsGrabber( axCVimge1.Image);

 

Hints:

It is possible to make the job easier and to use only the real function name instead of the whole notation with <namespace.class.function>.

 

Related Topics:

Importing Native Dynamic Link Libraries