Custom Camera support

e-light has built-in support for a wide range of cameras. Even if not explicitly listed, your camera may be supported if it is GenICam (or GigE Vision) compliant. If this is not the case, e-light can be extended with a custom camera plugin.

Community provided plugins

Chance is, someone has already developed a plugin for your camera. Check out the community plugins page to see if your camera is supported.

Developing a custom plugin

A camera plugin is a shared library that implements the ??? interface. This interface is defined in ???.

As an example, we now show how to develop a plugin that adds support for OpenCV’s cv::VideoCapture class.
We will use the CMake build system and C++ programming language, but you can use any build system and language you like.

Step 1: Create a new project

Create a new directory for your project and add a CMakeLists.txt file with the following content:

cmake_minimum_required(VERSION 3.10)
project(OpenCVPlugin)
 
set(CMAKE_CXX_STANDARD 17)
 
add_library(OpenCVPlugin SHARED OpenCVPlugin.cpp)

We now create a semi-blank OpenCVPlugin.cpp file in the same directory:

#include <camera_plugin.h>

now you can try building the project. You can use your IDE’s CMake integration or run the following commands in the project directory:

mkdir build       # we will place the build files in a separate directory
cd build          # change to the build directory
cmake ..          # configure the project
cmake --build .   # build the project

You should now have a libOpenCVPlugin.so (or *.dll/.dylib) file in the build directory.

Add the following lines to your CMakeLists.txt file to link against OpenCV:

find_package(OpenCV REQUIRED)
target_link_libraries(OpenCVPlugin PRIVATE ${OpenCV_LIBS})
target_include_directories(OpenCVPlugin PRIVATE ${OpenCV_INCLUDE_DIRS})

Run cmake --build . again to rebuild the project.

Now our libraries depend on OpenCV and the OpenCV shared libraries have to be available at runtime. You can either copy the OpenCV shared libraries to the same directory as your plugin or set the LD_LIBRARY_PATH environment variable to the directory containing the OpenCV shared libraries.