" name="keywords" />
Go to Cart
Home → Support → Software XIMEA cameras → XIMEA CamTool → Camtool plugin

Camtool plugin development

Introduction

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 Qt and 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 (Microsoft Visual Studio 2019 is recommended).
  • 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

Identify the version

Get the currently used version of Qt in the dialog shown by opening the menu Help - About - About Qt (e.g. v6.4.3)

Install Qt

You have 2 possibilities here.

  1. install Qt using Qt Online Installer (Qt Maintenance Tool)
  2. or build Qt from source files

Qt Online Installer is much easier. You can find it on www.qt.io .
You will have to create a Qt account and probably conform to the LGPL license.
For plugin development, select only the appropriate choices inside the Qt Online Installer.
It is not necessary to install everything. You will need:

  • Qt 6.4.3 - MSVC2019 64-bit
  • Qt Creator

After this is done, you can skip to the Plugin compilation step.

Install/build Qt from source

Build Qt from sources (official guide can be found here) - use the commit tagged as v6.4.3

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 C:\Qt\6.4.3_x64
  3. Unpack the source files and copy the content to the @ 6.4.3_x64 directory created in the previous step.
  4. Open the Visual Studio Command Prompt:
    • Start - All Programs - Microsoft Visual Studio 2019 - Visual Studio Tools - Visual Studio x64 Win64 Command Prompt (2010),
  5. In the command prompt, move to:
    • C:\Qt\6.4.3_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 .
The next step is to install Qt Creator.

Qt Configuration steps:

  1. Start the Qt Creator.
  2. In the main menu, select Tools - Options....
  3. Select 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\6.4.3_x64\qtbase\bin\qmake.exe .
  7. Activate the Kits tab.
  8. Click the Add button. It displays a dialog.
  9. Fill the dialog similarly, but be sure that you selected the correct x64 compiler, debugger and Qt version.
  10. Click the Ok button.

Plugin compilation

Open xvpSample.pro 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.


You should compile the plugin in Release configuration.
If you need to debug your plugin too, you will need the Debug version of CamTool.
In that case, please contact XIMEA support.

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 the C:\XIMEA\XIMEACamTool64 root directory (note: the standard CamTool distribution already includes a pre-built xvpSample.dll, so just back up and remove the original file)
  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 by 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 the CxVectorObjectRect instance.

When measuring the image, the image data is obtained using IxAppDelegate::viewCurrentImage.
To measure on a live image, the data in the 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.

Negative

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 it returns 0 in CxChainable::buffersCountInMemoryPool.

RAW Coloring

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

Plugin API