Camtool plugin development


This page describes how to develop custom plugins for XIMEA software - CamTool.

The plugins are implemented in the Qt framework.
To create a custom plugin, it is necessary to configure the development workspace.
This includes building the Qt, installing Qt Creator.
After this environment is prepared, the custom plugin may be built and added to the XIMEA CamTool.

Development workspace preparation

The following instructions assume you are working on Windows.
If you are working with Linux, please have a look at the instructions for Linux.

There are 4 main components required to develop CamTool Plugins:

  • Ximea API SP installed.
  • CamTool compatible C++ compiler (MSVC 2013 VC++)
    is recommended to use).
  • Qt Framework - headers and libraries for linking (the .lib files) + runtime (the .dll files).
  • Qt Creator - the native Qt development tool.

CamTool SDK installation

Check The CamTool Example when installing the XIMEA SP.

Qt installation

Install from binaries

  1. Download and install the standard Qt release from this page.
    (!) Currently, Qt 5.6.1 or earlier is recommended for CamTool plugin development; later versions may not work (!) .

Install from source

Alternatively, Qt can be built from sources (official guide can be found here).

Qt installation steps:

  1. Download the "single zip" package of the QT from this page.
    This single package contains all the required Qt source files.
  2. Create a directory corresponding to the CamTool version you are using:
    • For 32-bit CamTool -> C:\Qt\5.3.1_x86 (for 32bit build)
    • For 64-bit CamTool -> C:\Qt\5.3.1_x64 (for 64bit build)
  3. Unpack the source files and copy the content to the 5.3.1_x86 ( 5.3.1_x64 ) directory created in the previous step.
  4. Open the Visual Studio Command Prompt:
    • For 32bit: Start - All Programs - Microsoft Visual Studio 2010 - Visual Studio Tools - Visual Studio Command Prompt (2010),
    • For 64bit: Start - All Programs - Microsoft Visual Studio 2010 - Visual Studio Tools - Visual Studio x64 Win64 Command Prompt (2010),
  5. In the command prompt move to:
    • C:\Qt\5.3.1_x86 (32bit cmd prompt)
    • C:\Qt\5.3.1_x64 (64bit cmd prompt)\
  6. Execute "configure -opengl desktop" from the command prompt.
    Follow the instructions displayed by the script - compile the Open Source version when asked.
    After a while (1-2 minutes) the configuration is done.
  7. Execute the "nmake" command which starts the Qt compilation.
    The compilation takes several hours.

Note: Some modules don't need to be installed. They can be skipped by calling ./configure -skip <selected module> from the command line.

Qt Creator installation

The Qt Creator IDE required for the CamTool plugin development can be downloaded here.
Next step is to install the Qt Creator.

Qt Configuration steps:

  1. Start the Qt Creator.
  2. In the main menu select Tools - Options....
  3. Select the Build & Run on the left-side toolbar.
  4. Select the Qt Versions tab.
  5. Click the Add button, it displays an open file dialog.
  6. Select the C:\Qt\5.3.1_x86\qtbase\bin\qmake.exe ( C:\Qt\5.3.1_x64\qtbase\bin\qmake.exe for 64-bit ).
  7. Activate the Kits tab.
  8. Click the Add button. It displays a dialog.
  9. For 32bit fill the dialog as shown in the image below and click the Apply button.
  10. For 64bit fill the dialog analogically but be sure that you selected the correct x64 compiler, debugger and Qt version.
  11. Click the Ok button.

Plugin compilation

Open located in the C:\XIMEA\Examples\CamTool\xvpSample.
Select the desired project configuration (according to the image below) and click Configure Project.
Then select the xvpSample project and build it with the desired configuration.
xvpSampleDist.pri contains paths with regards to the folder structure in Examples. You can rename it to xvpSample.pri and replace the previous one.
Important! - The plugin has to be built with the proper archive type (32-bit, or 64-bit).

Plugin installation

The built plugin is located in the C:\XIMEA\Examples\CamTool\xvpSample\bin directory as a xvpSample.dll. file.
To install the plugin into Ximea CamTool, follow these steps:

  1. Copy the xvpSample.dll into C:\XIMEA\XIMEACamTool root directory
  2. Open CamTool, go to Plugins -> Plugin Manager. If the plugin is loaded correctly, it should be listed in the Plugins table.

  3. Check if the plugin is enabled in the Tools menu. It should look like this:

Sample plugin

Mean grey measurement

Users can draw rectangles into opened image views and the mean intensity is measured inside them.
Users can additionally resize the rectangles and the result is recalculated.
When on a live image from the camera, the result is calculated 4x per second (not to block the CPU for high frame rates).
The results are shown in the docked widget at the bottom of the screen (hidden as default).
The measurement table was designed in Qt Designer inside Qt Creator and is added to the application in CxPlugin::init.
The rectangles are added as CxVectorObjectRect to the image in mouse events relayed to the plugin in CxPlugin::viewMouseBtnPressEvent, CxPlugin::viewMouseMoveEvent and CxPlugin::viewMouseBtnReleaseEvent. The changes to the geometry are detected using CxVectorObjectRect::rectChanging signals called from CxVectorObjectRect instance.

When measuring the image, the image data is obtained using IxAppDelegate::viewCurrentImage.
To measure on live image, the data in CxPlugin::viewGotNewImage notification is used.

The results table stores the view ID and ID of the rectangle for each record to identify the object on the screen, to be able to update the results and delete the objects when the user wishes to.


Simple in-place image processing.
It does not change the image format, so it returns the same SxPicBufInfo as on input in CxImageProvider::queryOutputImageInfo and as it is in place, it does not require any additional image buffers, so returns 0 in CxChainable::buffersCountInMemoryPool.

RAW Coloring

Another image processing object.
Works with images in RAW format, and sends RGB image as output. As it needs to allocate new image, it returns 1 in CxChainable::buffersCountInMemoryPool.

Plugin API