Camtool plugin development¶
- 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 (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.
Identify the version¶
Get current used version of Qt in dialog shown by opening menu Help - About - About Qt (e.g. v6.4.3)
Install from source¶
Build Qt from sources (official guide can be found here) - use the commit tagged as v6.4.3
Qt installation steps:¶
- Download the "single zip" package of the QT from this page.
This single package contains all the required Qt source files.
- Create a directory corresponding to the CamTool version you are using
- Unpack the source files and copy the content to the @ 6.4.3_x64 directory created in the previous step.
- Open the Visual Studio Command Prompt:
- Start - All Programs - Microsoft Visual Studio 2019 - Visual Studio Tools - Visual Studio x64 Win64 Command Prompt (2010),
- In the command prompt move to:
C:\Qt\6.4.3_x64 (64bit cmd prompt)\
- 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.
- 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:¶
- Start the Qt Creator.
- In the main menu select Tools - Options....
- Select the Build & Run on the left-side toolbar.
- Select the Qt Versions tab.
- Click the Add button, it displays an open file dialog.
- Select the
- Activate the Kits tab.
- Click the Add button. It displays a dialog.
- Fill the dialog analogically but be sure that you selected the correct x64 compiler, debugger and Qt version.
- Click the Ok button.
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.
xvpSampleDist.pri contains paths with regards to the folder structure in Examples. You can rename it to xvpSample.pri and replace the previous one.
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:
- Copy the xvpSample.dll into C:\XIMEA\XIMEACamTool root directory
- Open CamTool, go to Plugins -> Plugin Manager. If the plugin is loaded correctly, it should be listed in the Plugins table.
- Check if the plugin is enabled in the Tools menu. It should look like this:
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.
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.