diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..bbb0965b --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,16 @@ +# Copilot instructions — itom plugins + +The tool-independent instructions for this repository live in +[`AGENTS.md`](../AGENTS.md). **Read and follow that file.** + +Quick reminders: + +- A plugin = interface class (`ito::AddInInterfaceBase`) + implementation + (`ito::AddInDataIO`, `ito::AddInActuator` or `ito::AddInAlgo`) + own `CMakeLists.txt`. +- Use `DummyGrabber`, `DummyMotor` and `BasicFilters` as reference implementations. +- Return `ito::RetVal`; never let an exception escape a plugin method. +- Always release the `ItomSharedSemaphore*` (`ItomSharedSemaphoreLocker`) on every path. +- Declare parameters in `m_params` with meta info + doc string, validate in `setParam` + and emit `parametersChanged(m_params)`. +- Do not modify the core API from here; do not include headers of other plugins. +- Formatting via `.clang-format`; format only the lines you touch. diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..9e355bed --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,64 @@ +# AGENTS.md — itom plugins + +Guidance for AI coding agents working in the **itom plugins** repository (hardware and +algorithm plugins). Normally used as a submodule of `itomProject`. + +## Plugin anatomy + +Each plugin lives in its own folder and consists of: + +- `CMakeLists.txt` — target definition, Qt moc/uic, install rules +- an **interface** class derived from `ito::AddInInterfaceBase`: + metadata (`m_type`, `m_description`, `m_detaildescription`, `m_author`, `m_license`), + mandatory/optional init parameters, `getAddInInst` / `closeThisInst` +- an **implementation** class derived from one of + - `ito::AddInDataIO` — cameras, grabbers, serial/IO devices + - `ito::AddInActuator` — motors, stages + - `ito::AddInAlgo` — filters and algorithm widgets +- optionally `dialog*` / `dockWidget*` UI classes and a `docs/` folder + +Reference implementations: `DummyGrabber`, `DummyMotor`, `BasicFilters`. +Skeletons: `itom/pluginTemplates` in the core repository. + +## Hard rules + +1. **Never change the core API from here** — only consume it. If something is missing in + the core, say so instead of working around it. +2. **`ito::RetVal` for all error handling**; no exception may leave a plugin method. +3. **Semaphores:** every method that receives an `ItomSharedSemaphore* waitCond` must + release it on *every* code path — use `ItomSharedSemaphoreLocker locker(waitCond);` + and follow the pattern of the neighbouring plugins. +4. **Threading:** plugin instances run in their own thread; do not touch GUI objects + directly, use signals (`parametersChanged`, `actuatorStatusChanged`, + `targetChanged`, `newDataAvailable`). +5. **Parameters:** declare all parameters in the constructor in `m_params` with + meta information and documentation strings; keys are lowerCamelCase and stable. + `setParam` must validate via `apiValidateParam` and emit `parametersChanged`. +6. **DataObject outputs:** allocate/resize via `checkData()`, keep axis and tag meta + data (`setAxisUnit`, `setAxisScale`, `setValueUnit`, `setTag`) up to date. +7. **Third party SDKs** are found via the CMake modules in `cmake/`; do not vendor + binaries and do not hard-code SDK paths. + +## Style + +- `.clang-format` (`BasedOnStyle: Microsoft`, 4 spaces, `ColumnLimit: 100`, + `PointerAlignment: Left`). Format only the lines you change. +- English identifiers and comments; user visible strings via `tr(...)`. +- Keep each plugin self-contained — no cross-plugin includes. + +## Build + +Plugins are built as part of `itomProject` with `BUILD_ITOM_PLUGINS=ON`. +Build only the plugin target you changed: + +```powershell +cmake --build /itomProject --config Debug --target +``` + +Never edit files inside the CMake binary directory. + +## Quality gates + +`pre-commit`: `check-yaml`, `end-of-file-fixer`, `trailing-whitespace`, +`fix-byte-order-marker`, `codespell`, `pyupgrade --py36-plus`, `sphinx-lint`. +Files end with a single newline, no trailing whitespace, no BOM. diff --git a/AerotechA3200/CMakeLists.txt b/AerotechA3200/CMakeLists.txt index b6267cbb..a8d69cd0 100644 --- a/AerotechA3200/CMakeLists.txt +++ b/AerotechA3200/CMakeLists.txt @@ -18,7 +18,12 @@ endif(NOT EXISTS ${ITOM_SDK_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/AndorSDK3/CMakeLists.txt b/AndorSDK3/CMakeLists.txt index a207bc6e..098d5570 100644 --- a/AndorSDK3/CMakeLists.txt +++ b/AndorSDK3/CMakeLists.txt @@ -20,7 +20,12 @@ endif(NOT EXISTS ${ITOM_SDK_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/BasicFilters/CMakeLists.txt b/BasicFilters/CMakeLists.txt index e2d454a7..42a2e8df 100644 --- a/BasicFilters/CMakeLists.txt +++ b/BasicFilters/CMakeLists.txt @@ -19,7 +19,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core imgproc REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core imgproc REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/BasicGPLFilters/CMakeLists.txt b/BasicGPLFilters/CMakeLists.txt index ec07a965..977266d3 100644 --- a/BasicGPLFilters/CMakeLists.txt +++ b/BasicGPLFilters/CMakeLists.txt @@ -20,7 +20,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..6e2452f6 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,3 @@ +# CLAUDE.md + +**Follow the rules in @AGENTS.md.** diff --git a/CommonVisionBlox/CMakeLists.txt b/CommonVisionBlox/CMakeLists.txt index 4aa3615a..2d43de3a 100644 --- a/CommonVisionBlox/CMakeLists.txt +++ b/CommonVisionBlox/CMakeLists.txt @@ -35,7 +35,12 @@ if(CVB_HEADER_FILE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) - find_package(OpenCV COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) + find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/CyUSB/CMakeLists.txt b/CyUSB/CMakeLists.txt index 21ae98d5..2fadba6c 100644 --- a/CyUSB/CMakeLists.txt +++ b/CyUSB/CMakeLists.txt @@ -23,7 +23,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(CyAPI QUIET) include(ItomBuildMacros) diff --git a/DIC/CMakeLists.txt b/DIC/CMakeLists.txt index 8ced0949..b6eee9a0 100644 --- a/DIC/CMakeLists.txt +++ b/DIC/CMakeLists.txt @@ -31,7 +31,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core imgproc REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...), +find_package(OpenCV REQUIRED COMPONENTS core imgproc REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...), + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(VisualLeakDetector QUIET) #silently detects the VisualLeakDetector for Windows (memory leak detector, optional) find_package(Eigen REQUIRED) diff --git a/DIC/matlab/CMakeLists.txt b/DIC/matlab/CMakeLists.txt index f26dfa7c..514ba6f1 100644 --- a/DIC/matlab/CMakeLists.txt +++ b/DIC/matlab/CMakeLists.txt @@ -23,7 +23,12 @@ SET (CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Adds a postfix for debug-built librar set(CMAKE_INCLUDE_CURRENT_DIR ON) SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${ITOM_SDK_DIR}) -find_package(OpenCV COMPONENTS core imgproc REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...), +find_package(OpenCV REQUIRED COMPONENTS core imgproc REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...), + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() #try to enable OpenMP (e.g. not available with VS Express) find_package(OpenMP QUIET) diff --git a/DataObjectIO/CMakeLists.txt b/DataObjectIO/CMakeLists.txt index 30d4946a..9b96a8b1 100644 --- a/DataObjectIO/CMakeLists.txt +++ b/DataObjectIO/CMakeLists.txt @@ -20,7 +20,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core highgui REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core highgui REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() if(OpenCV_VERSION_MAJOR GREATER 2) # for opencv >= 3 we need the imgcodecs module which is not present in opencv < 3 so run again find_package(OpenCV COMPONENTS core highgui imgcodecs REQUIRED) diff --git a/DataObjectIO/DataObjectIO.cpp b/DataObjectIO/DataObjectIO.cpp index e13bb833..150e1579 100644 --- a/DataObjectIO/DataObjectIO.cpp +++ b/DataObjectIO/DataObjectIO.cpp @@ -43,10 +43,22 @@ #include "opencv2/highgui/highgui.hpp" -#if CV_MAJOR_VERSION >= 4 -#include "opencv2//imgcodecs/legacy/constants_c.h" +#if defined(CV_MAJOR_VERSION) && (CV_MAJOR_VERSION == 4) +#include "opencv2/imgcodecs/legacy/constants_c.h" #include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/types_c.h" +#elif defined(CV_MAJOR_VERSION) && (CV_MAJOR_VERSION >= 5) +// OpenCV 5 removed many legacy C headers — include modern C++ headers instead +#include "opencv2/imgcodecs.hpp" +#include "opencv2/imgproc.hpp" +#elif !defined(CV_MAJOR_VERSION) +// Build without OpenCV version macro defined; assume modern C++ headers are available. +#include "opencv2/imgcodecs.hpp" +#include "opencv2/imgproc.hpp" +#else +// Fallback for older OpenCV versions +#include "opencv2/imgcodecs.hpp" +#include "opencv2/imgproc.hpp" #endif #include "common/sharedFunctionsQt.h" @@ -3898,7 +3910,7 @@ ito::RetVal DataObjectIO::saveDataObjectOpenCV( break; case DataObjectIO::ppmFormat: - save_params.push_back(CV_IMWRITE_PXM_BINARY); + save_params.push_back(cv::IMWRITE_PXM_BINARY); save_params.push_back((*paramsOpt)[0].getVal()); checkAndModifyFilenameSuffix(fileName, "ppm"); gray16Supported = false; @@ -3907,7 +3919,7 @@ ito::RetVal DataObjectIO::saveDataObjectOpenCV( case DataObjectIO::pgmFormat: - save_params.push_back(CV_IMWRITE_PXM_BINARY); + save_params.push_back(cv::IMWRITE_PXM_BINARY); save_params.push_back((*paramsOpt)[0].getVal()); gray16Supported = true; colorSupported = false; @@ -3920,7 +3932,7 @@ ito::RetVal DataObjectIO::saveDataObjectOpenCV( case DataObjectIO::jpgFormat: case DataObjectIO::jp2000Format: - save_params.push_back(CV_IMWRITE_JPEG_QUALITY); + save_params.push_back(cv::IMWRITE_JPEG_QUALITY); save_params.push_back((*paramsOpt)[0].getVal()); checkAndModifyFilenameSuffix(fileName, "jpg", "jpeg", "jp2"); @@ -3942,7 +3954,7 @@ ito::RetVal DataObjectIO::saveDataObjectOpenCV( break; case DataObjectIO::pngFormat: - save_params.push_back(CV_IMWRITE_PNG_COMPRESSION); + save_params.push_back(cv::IMWRITE_PNG_COMPRESSION); save_params.push_back((*paramsOpt)[0].getVal()); checkAndModifyFilenameSuffix(fileName, "png"); addAlpha = (*paramsOpt)[1].getVal() != 0 ? true : false; @@ -4848,13 +4860,13 @@ ito::RetVal DataObjectIO::loadImage( if (colorFormat.isEmpty() || colorFormat.compare("asIs", Qt::CaseInsensitive) == 0) { - flags = CV_LOAD_IMAGE_ANYDEPTH; + flags = cv::IMREAD_ANYDEPTH; flags *= -1; reduceChannel = false; } else if (colorFormat.compare("alpha", Qt::CaseInsensitive) == 0) { - flags = CV_LOAD_IMAGE_COLOR | CV_LOAD_IMAGE_ANYDEPTH; + flags = cv::IMREAD_COLOR | cv::IMREAD_ANYDEPTH; flags *= -1; reduceChannel = true; } @@ -4863,7 +4875,7 @@ ito::RetVal DataObjectIO::loadImage( colorFormat.compare("G", Qt::CaseInsensitive) == 0 || colorFormat.compare("B", Qt::CaseInsensitive) == 0) { - flags = CV_LOAD_IMAGE_COLOR | CV_LOAD_IMAGE_ANYDEPTH; + flags = cv::IMREAD_COLOR | cv::IMREAD_ANYDEPTH; flags *= -1; reduceChannel = true; } @@ -4871,14 +4883,14 @@ ito::RetVal DataObjectIO::loadImage( colorFormat.compare("gray", Qt::CaseInsensitive) == 0 || colorFormat.compare("grey", Qt::CaseInsensitive) == 0) { - flags = CV_LOAD_IMAGE_GRAYSCALE | CV_LOAD_IMAGE_ANYDEPTH; + flags = cv::IMREAD_GRAYSCALE | cv::IMREAD_ANYDEPTH; reduceChannel = false; } else { reduceChannel = false; - flags = CV_LOAD_IMAGE_COLOR; + flags = cv::IMREAD_COLOR; flags *= -1; } diff --git a/DummyGrabber/CMakeLists.txt b/DummyGrabber/CMakeLists.txt index 3265fc63..7f6fdfad 100644 --- a/DummyGrabber/CMakeLists.txt +++ b/DummyGrabber/CMakeLists.txt @@ -20,7 +20,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/DummyMotor/CMakeLists.txt b/DummyMotor/CMakeLists.txt index c32d944c..cbd6a227 100644 --- a/DummyMotor/CMakeLists.txt +++ b/DummyMotor/CMakeLists.txt @@ -20,7 +20,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/FFTWfilters/CMakeLists.txt b/FFTWfilters/CMakeLists.txt index 65bacb59..d62e2cfa 100644 --- a/FFTWfilters/CMakeLists.txt +++ b/FFTWfilters/CMakeLists.txt @@ -19,7 +19,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(FFTW 3) include(ItomBuildMacros) diff --git a/FileGrabber/CMakeLists.txt b/FileGrabber/CMakeLists.txt index e9ff1b1a..20e7e347 100644 --- a/FileGrabber/CMakeLists.txt +++ b/FileGrabber/CMakeLists.txt @@ -26,7 +26,12 @@ itom_init_plugin_library(${target_name}) #Start the project, init compiler setti itom_find_package_qt(ON Core Widgets Xml LinguistTools) #run once so we get the installed opencv version -find_package(OpenCV COMPONENTS core highgui REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core highgui REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() if(OpenCV_VERSION_MAJOR GREATER 2) # for opencv >= 3 we need the imgcodecs module which is not present in opencv < 3 so run again find_package(OpenCV COMPONENTS core highgui imgcodecs REQUIRED) diff --git a/FittingFilters/CMakeLists.txt b/FittingFilters/CMakeLists.txt index 24944a13..b387a4ab 100644 --- a/FittingFilters/CMakeLists.txt +++ b/FittingFilters/CMakeLists.txt @@ -20,7 +20,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core imgproc REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core imgproc REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(LAPACKE) find_package(OpenMP QUIET) diff --git a/GenICam/CMakeLists.txt b/GenICam/CMakeLists.txt index ba9c0da5..4ed2c10f 100644 --- a/GenICam/CMakeLists.txt +++ b/GenICam/CMakeLists.txt @@ -20,7 +20,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) find_package(GenICam QUIET) #located in CMAKE_CURRENT_SOURCE_DIR -find_package(OpenCV COMPONENTS imgproc REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS imgproc REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/HBMSpider8/CMakeLists.txt b/HBMSpider8/CMakeLists.txt index f6d8dfd2..35f86458 100644 --- a/HBMSpider8/CMakeLists.txt +++ b/HBMSpider8/CMakeLists.txt @@ -22,7 +22,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...), +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...), + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(VisualLeakDetector QUIET) #silently detects the VisualLeakDetector for Windows (memory leak detector, optional) include(ItomBuildMacros) diff --git a/IDSuEye/CMakeLists.txt b/IDSuEye/CMakeLists.txt index 3f6256e3..cf9e032d 100644 --- a/IDSuEye/CMakeLists.txt +++ b/IDSuEye/CMakeLists.txt @@ -20,7 +20,12 @@ endif(NOT EXISTS ${ITOM_SDK_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/LibUSB/CMakeLists.txt b/LibUSB/CMakeLists.txt index a8e6f8c2..d96f5939 100644 --- a/LibUSB/CMakeLists.txt +++ b/LibUSB/CMakeLists.txt @@ -19,7 +19,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(LibUSB) include(ItomBuildMacros) diff --git a/MSMediaFoundation/CMakeLists.txt b/MSMediaFoundation/CMakeLists.txt index 2437c495..94647b50 100644 --- a/MSMediaFoundation/CMakeLists.txt +++ b/MSMediaFoundation/CMakeLists.txt @@ -19,7 +19,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core imgproc REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core imgproc REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(WindowsSDK QUIET) include(ItomBuildMacros) diff --git a/NITWidySWIR/CMakeLists.txt b/NITWidySWIR/CMakeLists.txt index dacc17bc..e6181911 100644 --- a/NITWidySWIR/CMakeLists.txt +++ b/NITWidySWIR/CMakeLists.txt @@ -20,7 +20,12 @@ endif(NOT EXISTS ${ITOM_SDK_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core imgproc REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core imgproc REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/NerianSceneScanPro/CMakeLists.txt b/NerianSceneScanPro/CMakeLists.txt index b024c2b2..c5197041 100644 --- a/NerianSceneScanPro/CMakeLists.txt +++ b/NerianSceneScanPro/CMakeLists.txt @@ -25,7 +25,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core imgproc REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core imgproc REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/OpenCVFilters/CMakeLists.txt b/OpenCVFilters/CMakeLists.txt index 4530e535..d7cd9f97 100644 --- a/OpenCVFilters/CMakeLists.txt +++ b/OpenCVFilters/CMakeLists.txt @@ -19,7 +19,30 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core calib3d flann features2d imgproc REQUIRED) + +# Require minimal OpenCV modules and probe optional ones (OpenCV 5 may not provide +# every module; enable source files conditionally). +# calib3d and features2d are standard OpenCV modules that ship with every +# regular OpenCV 3.0 - 5.0 distribution, so no optional detection is needed. +# They are NOT requested as explicit COMPONENTS here on purpose: OpenCV 5.0 +# (and other "world" builds) only export the bundled opencv_world target and +# would fail a `REQUIRED COMPONENTS calib3d features2d` check even though the +# functionality is present. Requesting only core/imgproc resolves OpenCV_LIBS +# and OpenCV_INCLUDE_DIRS correctly for both component-based and world builds. +find_package(OpenCV REQUIRED COMPONENTS core imgproc) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() + +# Use the OpenCV_LIBS variable, which OpenCVConfig always populates correctly +# for both component-based and "world" builds (e.g. OpenCV 5.0). +set(OPENCV_LINK_LIBS ${OpenCV_LIBS}) + +if(DEFINED OpenCV_INCLUDE_DIRS) + include_directories(${OpenCV_INCLUDE_DIRS}) +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) @@ -68,7 +91,7 @@ add_library(${target_name} SHARED ${PLUGIN_SOURCES} ${PLUGIN_HEADERS} ${PLUGIN_U # Qt: enable all automoc, autouic and autorcc. set_target_properties(${target_name} PROPERTIES AUTOMOC ON AUTORCC ON AUTOUIC ON) -target_link_libraries(${target_name} ${ITOM_SDK_LIBRARIES} ${OpenCV_LIBS} ${QT5_LIBRARIES} ${VISUALLEAKDETECTOR_LIBRARIES}) +target_link_libraries(${target_name} ${ITOM_SDK_LIBRARIES} ${OPENCV_LINK_LIBS} ${QT5_LIBRARIES} ${VISUALLEAKDETECTOR_LIBRARIES}) #translation set(FILES_TO_TRANSLATE ${PLUGIN_SOURCES} ${PLUGIN_HEADERS} ${PLUGIN_UI}) diff --git a/OpenCVFilters/OpenCVFilters.cpp b/OpenCVFilters/OpenCVFilters.cpp index 06a387d0..70828fe5 100644 --- a/OpenCVFilters/OpenCVFilters.cpp +++ b/OpenCVFilters/OpenCVFilters.cpp @@ -29,6 +29,12 @@ #include "itomCvConversions.h" #include +#include "opencv2/imgproc.hpp" +#if (CV_MAJOR_VERSION >= 5) +// OpenCV 5.0 moved geometric transform helpers (e.g. getRotationMatrix2D) +// out of imgproc.hpp into a dedicated geometry header. +#include "opencv2/geometry/2d.hpp" +#endif #include "DataObject/dataObjectFuncs.h" #include "DataObject/dataobj.h" #include "common/numeric.h" @@ -3670,7 +3676,14 @@ When you want to use the cvWarpAffine method with this rotation matrix your cent itomtype = ito::guessDataTypeFromCVMat(&rotMat, retval); if (!retval.containsError()) { - *rotDObj = ito::DataObject(2, rotMat.size, itomtype, &rotMat, 1); + const int* sizes_ptr = +#if (CV_MAJOR_VERSION >= 5) + rotMat.size.data(); +#else + rotMat.size; +#endif + *rotDObj = ito::DataObject(2, sizes_ptr, itomtype, &rotMat, 1); + rotDObj->addToProtocol( std::string(tr("Rotation Matrix for %1 deg angle with scale factor of %2") .arg(angle) @@ -3944,7 +3957,13 @@ of the target object differ from each other depending on the algorithm parameter ito::tDataType itomtype = ito::guessDataTypeFromCVMat(&dest, retval); if (!retval.containsError()) { - *dObjDst = ito::DataObject(2, dest.size, itomtype, &dest, 1); + const int* sizes_ptr = +#if (CV_MAJOR_VERSION >= 5) + dest.size.data(); +#else + dest.size; +#endif + *dObjDst = ito::DataObject(2, sizes_ptr, itomtype, &dest, 1); //dObjSrc->copyAxisTagsTo(*dObjDst); //dObjSrc->copyTagMapTo(*dObjDst); } @@ -4034,8 +4053,6 @@ ito::RetVal OpenCVFilters::init( /*filter = new FilterDef(OpenCVFilters::cvCalcHist, OpenCVFilters::cvCalcHistParams, cvCalcHistDoc); m_filterList.insert("cvCalcHistogram", filter);*/ -#if (CV_MAJOR_VERSION > 2 || CV_MINOR_VERSION > 3) - filter = new FilterDef( OpenCVFilters::cvFindCircles, OpenCVFilters::cvFindCirclesParams, cvFindCirclesDoc); m_filterList.insert("cvFindCircles", filter); @@ -4133,8 +4150,6 @@ ito::RetVal OpenCVFilters::init( new FilterDef(OpenCVFilters::cvThreshold, OpenCVFilters::cvThresholdParams, cvThresholdDoc); m_filterList.insert("cvThreshold", filter); -#endif //(CV_MAJOR_VERSION > 2 || CV_MINOR_VERSION > 3) - filter = new FilterDef( OpenCVFilters::cvFlipUpDown, OpenCVFilters::stdParams2Objects, cvFlipUpDownDoc); m_filterList.insert("cvFlipUpDown", filter); diff --git a/OpenCVFilters/OpenCVFilters.h b/OpenCVFilters/OpenCVFilters.h index 36a0138b..ea618786 100644 --- a/OpenCVFilters/OpenCVFilters.h +++ b/OpenCVFilters/OpenCVFilters.h @@ -25,7 +25,7 @@ #include "common/addInInterface.h" -#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/imgproc.hpp" #include "pluginVersion.h" #include @@ -255,7 +255,6 @@ class OpenCVFilters : public ito::AddInAlgo QVector* paramsOpt, QVector* paramsOut); -#if (CV_MAJOR_VERSION > 2 || CV_MINOR_VERSION > 3) static const QString cvFindCirclesDoc; static ito::RetVal cvFindCircles( QVector* paramsMand, @@ -451,7 +450,7 @@ class OpenCVFilters : public ito::AddInAlgo QVector* paramsMand, QVector* paramsOpt, QVector* paramsOut); -#endif //(CV_MAJOR_VERSION > 2 || CV_MINOR_VERSION > 3) + static const QString cvCannyEdgeDoc; static ito::RetVal cvCannyEdge( QVector* paramsMand, diff --git a/OpenCVFilters/calib3d.cpp b/OpenCVFilters/calib3d.cpp index d256c339..afdb1427 100644 --- a/OpenCVFilters/calib3d.cpp +++ b/OpenCVFilters/calib3d.cpp @@ -27,11 +27,14 @@ #include "DataObject/dataObjectFuncs.h" #include -#if (CV_MAJOR_VERSION >= 2) //calib3d only available for OpenCV Version > 2.0 +#if (CV_MAJOR_VERSION >= 5) + #include "opencv2/calib3d.hpp" +#else #include "opencv2/calib3d/calib3d.hpp" +#endif #if (CV_MAJOR_VERSION >= 4) - #include "opencv2/highgui.hpp" +#include "opencv2/highgui.hpp" #else #include "opencv/highgui.h" #endif @@ -109,13 +112,8 @@ ito::RetVal OpenCVFilters::cvFindCircles(QVector *paramsMand, QV const cv::Mat *cvplaneIn = input.getCvPlaneMat(0); // Declare the output vector to hold the circle coordinates and radii -#if (CV_MAJOR_VERSION >= 3) std::vector circles; int method = cv::HOUGH_GRADIENT; -#else - cv::vector circles; - int method = CV_HOUGH_GRADIENT; -#endif /* void HoughCircles(InputArray image, OutputArray circles, int method, double dp, double minDist, double param1=100, double param2=100, int minRadius=0, int maxRadius=0) dp : Inverse ratio of the accumulator resolution to the image resolution. For example, if dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has half as big width and height. @@ -1414,4 +1412,3 @@ ito::RetVal OpenCVFilters::cvProjectPoints(QVector *paramsMand, // //} -#endif //(CV_MAJOR_VERSION > 2 || CV_MINOR_VERSION > 3) diff --git a/OpenCVFilters/features2d.cpp b/OpenCVFilters/features2d.cpp index f4637e89..11e13316 100644 --- a/OpenCVFilters/features2d.cpp +++ b/OpenCVFilters/features2d.cpp @@ -28,13 +28,7 @@ #include #include -#if (CV_MAJOR_VERSION > 2 || CV_MINOR_VERSION > 3) - - #if (CV_MAJOR_VERSION == 2) - #include "opencv2/features2d/features2d.hpp" - #else - #include "opencv2/features2d.hpp" - #endif +#include "opencv2/features2d.hpp" //---------------------------------------------------------------------------------------------------------------------------------- /*static*/ const QString OpenCVFilters::cvFlannBasedMatcherDoc = QObject::tr("This function uses the nearest search methods to find the best matching points. Matching methods by means of Flann matcher. \n\ @@ -447,4 +441,3 @@ This function draws matches of keypoints from two images in the output image. Ma return retval; } -#endif //(CV_MAJOR_VERSION > 2 || CV_MINOR_VERSION > 3) diff --git a/OpenCVFilters/itomCvConversions.cpp b/OpenCVFilters/itomCvConversions.cpp index d409ae43..7d05d53c 100644 --- a/OpenCVFilters/itomCvConversions.cpp +++ b/OpenCVFilters/itomCvConversions.cpp @@ -226,7 +226,13 @@ ito::RetVal setOutputArrayToDataObject(ito::ParamBase &dataObjParam, const cv::M } else { - *dObj = ito::DataObject(mat_.dims, mat_.size, cameraMatrixType, &mat_, 1); + const int* sizes_ptr = +#if (CV_MAJOR_VERSION >= 5) + mat_.size.data(); +#else + mat_.size; +#endif + *dObj = ito::DataObject(mat_.dims, sizes_ptr, cameraMatrixType, &mat_, 1); } } } diff --git a/OpenCVFiltersNonFree/CMakeLists.txt b/OpenCVFiltersNonFree/CMakeLists.txt index 3f79f1cd..76235c58 100644 --- a/OpenCVFiltersNonFree/CMakeLists.txt +++ b/OpenCVFiltersNonFree/CMakeLists.txt @@ -22,6 +22,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) find_package(OpenCV 4.5.3 COMPONENTS core features2d REQUIRED) +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() + include(ItomBuildMacros) itom_init_cmake_policy(3.12) itom_init_plugin_library(${target_name}) #Start the project, init compiler settings and set default configurations for plugins diff --git a/OpenCVGrabber/CMakeLists.txt b/OpenCVGrabber/CMakeLists.txt index da830edf..378f978e 100644 --- a/OpenCVGrabber/CMakeLists.txt +++ b/OpenCVGrabber/CMakeLists.txt @@ -18,7 +18,12 @@ endif(NOT EXISTS ${ITOM_SDK_DIR}) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) -find_package(OpenCV COMPONENTS core highgui imgproc REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core highgui imgproc REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) if(OpenCV_VERSION_MAJOR GREATER 2) # for opencv >= 3 we need the imgcodecs module which is not present in opencv < 3 so run again diff --git a/OpenCVGrabber/OpenCVGrabber.cpp b/OpenCVGrabber/OpenCVGrabber.cpp index d08a80d8..d84ad9ed 100644 --- a/OpenCVGrabber/OpenCVGrabber.cpp +++ b/OpenCVGrabber/OpenCVGrabber.cpp @@ -1,7 +1,7 @@ /* ******************************************************************** Plugin "OpenCV-Grabber" for itom software URL: http://www.uni-stuttgart.de/ito - Copyright (C) 2018, Institut für Technische Optik (ITO), + Copyright (C) 2026, Institut für Technische Optik (ITO), Universität Stuttgart, Germany This file is part of a plugin for the measurement software itom. @@ -28,9 +28,7 @@ #include "gitVersion.h" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/core/core.hpp" -#if (CV_MAJOR_VERSION >= 3) #include "opencv2/videoio/videoio.hpp" -#endif #define _USE_MATH_DEFINES // needs to be defined to enable standard declarations of PI constant @@ -329,10 +327,9 @@ const ito::RetVal OpenCVGrabber::showConfDialog(void) { #if (CV_MAJOR_VERSION >= 4) return apiShowConfigurationDialog(this, new DialogOpenCVGrabber(this, (m_imgChannels == 3), m_pCam->open(cv::CAP_DSHOW))); -#elif (CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION < 4) - return apiShowConfigurationDialog(this, new DialogOpenCVGrabber(this, (m_imgChannels == 3), cvGetCaptureDomain(m_pCam->getDevice()) == CV_CAP_DSHOW)); #else - return apiShowConfigurationDialog(this, new DialogOpenCVGrabber(this, (m_imgChannels == 3), false)); + return apiShowConfigurationDialog(this, new DialogOpenCVGrabber(this, (m_imgChannels == 3), cvGetCaptureDomain(m_pCam->getDevice()) == CV_CAP_DSHOW)); + #endif } @@ -1017,33 +1014,16 @@ ito::RetVal OpenCVGrabber::init(QVector *paramsMand, QVectorget(cv::CAP_PROP_FOCUS); -#endif -#ifdef cv::CAP_PROP_IRIS qDebug() << "cv::CAP_PROP_IRIS" << m_pCam->get(cv::CAP_PROP_IRIS); -#endif -#ifdef cv::CAP_PROP_ZOOM qDebug() << "cv::CAP_PROP_ZOOM" << m_pCam->get(cv::CAP_PROP_ZOOM); -#endif -#ifdef cv::CAP_PROP_ROLL qDebug() << "cv::CAP_PROP_ROLL" << m_pCam->get(cv::CAP_PROP_ROLL); -#endif -#ifdef cv::CAP_PROP_TILT qDebug() << "cv::CAP_PROP_TILT" << m_pCam->get(cv::CAP_PROP_TILT); -#endif -#ifdef cv::CAP_PROP_PAN qDebug() << "cv::CAP_PROP_PAN" << m_pCam->get(cv::CAP_PROP_PAN); -#endif -#ifdef cv::CAP_PROP_BACKLIGHT qDebug() << "cv::CAP_PROP_BACKLIGHT" << m_pCam->get(cv::CAP_PROP_BACKLIGHT); -#endif qDebug() << "cv::CAP_PROP_EXPOSURE" << m_pCam->get(cv::CAP_PROP_EXPOSURE); qDebug() << "cv::CAP_PROP_GAIN" << m_pCam->get(cv::CAP_PROP_GAIN); qDebug() << "v::CAP_PROP_WHITE_BALANCE_BLUE_U" << m_pCam->get(cv::CAP_PROP_WHITE_BALANCE_BLUE_U); -#if (CV_MAJOR_VERSION < 3) - qDebug() << "cv::CAP_PROP_MONOCROME" << m_pCam->get(cv::CAP_PROP_MONOCROME); -#endif qDebug() << "cv::CAP_PROP_GAMMA" << m_pCam->get(cv::CAP_PROP_GAMMA); qDebug() << "cv::CAP_PROP_SHARPNESS" << m_pCam->get(cv::CAP_PROP_SHARPNESS); qDebug() << "cv::CAP_PROP_SATURATION" << m_pCam->get(cv::CAP_PROP_SATURATION); @@ -1582,9 +1562,8 @@ bool OpenCVGrabber::showNativeSettingsDialog() { #if (CV_MAJOR_VERSION >= 4) return m_pCam->set(cv::CAP_PROP_SETTINGS, 0.0); -#elif(CV_MAJOR_VERSION > 2 && CV_MAJOR_VERSION < 4) - return m_pCam->set(CV_CAP_PROP_SETTINGS, 0.0); #else - return false; + return m_pCam->set(CV_CAP_PROP_SETTINGS, 0.0); + #endif } diff --git a/OpenCVGrabber/OpenCVGrabber.h b/OpenCVGrabber/OpenCVGrabber.h index 50ecf7d2..c2b2be87 100644 --- a/OpenCVGrabber/OpenCVGrabber.h +++ b/OpenCVGrabber/OpenCVGrabber.h @@ -1,7 +1,7 @@ /* ******************************************************************** Plugin "OpenCV-Grabber" for itom software URL: http://www.uni-stuttgart.de/ito - Copyright (C) 2018, Institut für Technische Optik (ITO), + Copyright (C) 2026, Institut für Technische Optik (ITO), Universität Stuttgart, Germany This file is part of a plugin for the measurement software itom. @@ -82,7 +82,6 @@ class OpenCVGrabber : public ito::AddInGrabber //, public OpenCVGrabberInterface VideoCaptureItom() : cv::VideoCapture() {} VideoCaptureItom(const std::string& filename) : cv::VideoCapture(filename) {} VideoCaptureItom(int device) : cv::VideoCapture(device) {} - cv::Ptr getDevice() const { return cap; }; }; VideoCaptureItom *m_pCam; /*!< Handle to the openCV-Cam-Class */ diff --git a/OphirPowermeter/CMakeLists.txt b/OphirPowermeter/CMakeLists.txt index 7f22bc6b..73001ff0 100644 --- a/OphirPowermeter/CMakeLists.txt +++ b/OphirPowermeter/CMakeLists.txt @@ -19,7 +19,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/PCOCamera/CMakeLists.txt b/PCOCamera/CMakeLists.txt index 73583991..7fcdb1c5 100644 --- a/PCOCamera/CMakeLists.txt +++ b/PCOCamera/CMakeLists.txt @@ -28,7 +28,12 @@ endif(NOT PCO_SDK_DIR) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/PCOPixelFly/CMakeLists.txt b/PCOPixelFly/CMakeLists.txt index b547dc60..49c37cdf 100644 --- a/PCOPixelFly/CMakeLists.txt +++ b/PCOPixelFly/CMakeLists.txt @@ -19,7 +19,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/PclTools/CMakeLists.txt b/PclTools/CMakeLists.txt index 7f0a7c5e..9ec9de2e 100644 --- a/PclTools/CMakeLists.txt +++ b/PclTools/CMakeLists.txt @@ -20,7 +20,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT find_package(ITOM_SDK REQUIRED) find_package(ITOM_SDK COMPONENTS dataobject pointcloud itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/PclTools/pclModelFit.cpp b/PclTools/pclModelFit.cpp index ad5c8399..2ca61915 100644 --- a/PclTools/pclModelFit.cpp +++ b/PclTools/pclModelFit.cpp @@ -21,7 +21,10 @@ *********************************************************************** */ #include "pclTools.h" -#define EIGEN_QT_SUPPORT +//EIGEN_QT_SUPPORT is intentionally not defined: it only enables the optional +//Eigen::Transform <-> QMatrix / QTransform conversions. QMatrix has been removed +//in Qt6 and these conversions are not used here, hence omitting the define keeps +//this plugin compatible with Qt5.12 up to Qt6.x. #include "DataObject/dataobj.h" #include "common/helperCommon.h" diff --git a/PclTools/pclModelFitGeneric.cpp b/PclTools/pclModelFitGeneric.cpp index cb5142ec..f19e9d58 100644 --- a/PclTools/pclModelFitGeneric.cpp +++ b/PclTools/pclModelFitGeneric.cpp @@ -22,7 +22,10 @@ #include "pclTools.h" #include "pluginVersion.h" -#define EIGEN_QT_SUPPORT +//EIGEN_QT_SUPPORT is intentionally not defined: it only enables the optional +//Eigen::Transform <-> QMatrix / QTransform conversions. QMatrix has been removed +//in Qt6 and these conversions are not used here, hence omitting the define keeps +//this plugin compatible with Qt5.12 up to Qt6.x. #include "DataObject/dataobj.h" #include "common/helperCommon.h" diff --git a/PclTools/pclNurbs.cpp b/PclTools/pclNurbs.cpp index 651c9aa2..7dc3331e 100644 --- a/PclTools/pclNurbs.cpp +++ b/PclTools/pclNurbs.cpp @@ -23,7 +23,10 @@ along with itom. If not, see . #if PCLHASSURFACENURBS #include "pclTools.h" -#define EIGEN_QT_SUPPORT +//EIGEN_QT_SUPPORT is intentionally not defined: it only enables the optional +//Eigen::Transform <-> QMatrix / QTransform conversions. QMatrix has been removed +//in Qt6 and these conversions are not used here, hence omitting the define keeps +//this plugin compatible with Qt5.12 up to Qt6.x. #include "DataObject/dataobj.h" #include "common/helperCommon.h" diff --git a/PclTools/pclProjectInliers.cpp b/PclTools/pclProjectInliers.cpp index 4bf0312f..9d41aa1f 100644 --- a/PclTools/pclProjectInliers.cpp +++ b/PclTools/pclProjectInliers.cpp @@ -21,7 +21,10 @@ *********************************************************************** */ #include "pclTools.h" -#define EIGEN_QT_SUPPORT +//EIGEN_QT_SUPPORT is intentionally not defined: it only enables the optional +//Eigen::Transform <-> QMatrix / QTransform conversions. QMatrix has been removed +//in Qt6 and these conversions are not used here, hence omitting the define keeps +//this plugin compatible with Qt5.12 up to Qt6.x. #include "DataObject/dataobj.h" #include "common/helperCommon.h" diff --git a/PclTools/pclTools.cpp b/PclTools/pclTools.cpp index 52e1f8cf..fc504768 100644 --- a/PclTools/pclTools.cpp +++ b/PclTools/pclTools.cpp @@ -26,7 +26,10 @@ #include "pclTools.h" #include "pluginVersion.h" #include "gitVersion.h" -#define EIGEN_QT_SUPPORT +//EIGEN_QT_SUPPORT is intentionally not defined: it only enables the optional +//Eigen::Transform <-> QMatrix / QTransform conversions. QMatrix has been removed +//in Qt6 and these conversions are not used here, hence omitting the define keeps +//this plugin compatible with Qt5.12 up to Qt6.x. #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET //before we defined #define EIGEN2_SUPPORT, which also set the #define above. //However, EIGEN2_SUPPORT leads to errors using newer Eigen libraries (Eigen2 support has been removed there) @@ -75,9 +78,13 @@ #elif PCL_VERSION_COMPARE(>=, 1, 10, 0) && PCL_VERSION_COMPARE(<, 1, 11, 0) #include #include -#elif PCL_VERSION_COMPARE(>=, 1, 11, 0) +#elif PCL_VERSION_COMPARE(>=, 1, 11, 0) && PCL_VERSION_COMPARE(<, 1, 15, 0) #include #include +#elif PCL_VERSION_COMPARE(>=, 1, 15, 0) + //the forwarding header pcl/recognition/trimmed_icp.h has been removed in PCL 1.15 + #include + #include #endif diff --git a/Roughness/CMakeLists.txt b/Roughness/CMakeLists.txt index 219d02fe..11962bd7 100644 --- a/Roughness/CMakeLists.txt +++ b/Roughness/CMakeLists.txt @@ -18,7 +18,12 @@ endif(NOT EXISTS ${ITOM_SDK_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} "${ITOM_SDK_DIR}/cmake") find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core imgproc REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core imgproc REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/SerialIO/CMakeLists.txt b/SerialIO/CMakeLists.txt index e0de32c8..5f202947 100644 --- a/SerialIO/CMakeLists.txt +++ b/SerialIO/CMakeLists.txt @@ -20,7 +20,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/SmarActMCS2/CMakeLists.txt b/SmarActMCS2/CMakeLists.txt index 54101b48..56194f04 100644 --- a/SmarActMCS2/CMakeLists.txt +++ b/SmarActMCS2/CMakeLists.txt @@ -1,23 +1,24 @@ -################################################################### -################################################################### -# CMake Template for a plugin of itom +# ################################################################## +# ################################################################## +# CMake Template for a plugin of itom # -# You can use this template, use it in your plugins, modify it, -# copy it and distribute it without any license restrictions. -################################################################### -################################################################### +# You can use this template, use it in your plugins, modify it, +# copy it and distribute it without any license restrictions. +# ################################################################## +# ################################################################## # this should be the first line of your project. cmake_minimum_required(VERSION 3.12...3.29) -#here you give your project a unique name (replace SmarActMCS2 by the desired project name of your plugin) + +# here you give your project a unique name (replace SmarActMCS2 by the desired project name of your plugin) set(target_name SmarActMCS2) -#this is to automatically detect the SDK subfolder of the itom build directory. +# this is to automatically detect the SDK subfolder of the itom build directory. if(NOT EXISTS ${ITOM_SDK_DIR}) find_path(ITOM_SDK_DIR "cmake/itom_sdk.cmake" - HINTS "$ENV{ITOM_SDK_ROOT}" - "${CMAKE_CURRENT_BINARY_DIR}/../itom/SDK" - DOC "Path of SDK subfolder of itom root (build) directory") + HINTS "$ENV{ITOM_SDK_ROOT}" + "${CMAKE_CURRENT_BINARY_DIR}/../itom/SDK" + DOC "Path of SDK subfolder of itom root (build) directory") endif(NOT EXISTS ${ITOM_SDK_DIR}) if(NOT EXISTS ${ITOM_SDK_DIR}) @@ -33,28 +34,29 @@ set(SMARACT_MCS2_DIR "" CACHE PATH "Path to the install directory of SmarAct MCS if(SMARACT_MCS2_DIR) if(WIN32) find_path(SMARACT_MCS2_INCLUDE_DIR "SmarActControl.h" PATHS ${SMARACT_MCS2_DIR} PATH_SUFFIXES "SDK/C/include") + # find_path(SMARACT_MCS2_DIR "SmarActControlConstants.h" PATHS ${SMARACT_MCS2_DIR} PATH_SUFFIXES "SDK/C/include") find_library(SMARACT_MCS2_LIBRARY "SmarActCTL" PATHS ${SMARACT_MCS2_DIR} PATH_SUFFIXES "SDK/C/lib64") endif(WIN32) endif() -################################################################# +# ################################################################ # Input elements for CMake GUI (Checkboxes, Paths, Strings...) -################################################################# +# ################################################################ # BUILD_TARGET64 is set according to bitage of selected compiler # You may select loaded libraries(32 vs 64 bit) according to the Value of this # This value is usually forced to the bitage of the itom SDK if # find_package(ITOM_SDK...) is used (see below). option(BUILD_TARGET64 "Build for 64 bit target if set to ON or 32 bit if set to OFF." ON) -################################################################# +# ################################################################ # Automatic package detection -# add here find_package commands for searching for 3rd party -# libraries +# add here find_package commands for searching for 3rd party +# libraries # -# for detecting Qt, use itom_find_package_qt instead of the -# native command. -################################################################# +# for detecting Qt, use itom_find_package_qt instead of the +# native command. +# ################################################################ # the itom SDK needs to be detected, use the COMPONENTS keyword # to define which library components are needed. Possible values @@ -67,25 +69,27 @@ option(BUILD_TARGET64 "Build for 64 bit target if set to ON or 32 bit if set to # if no components are indicated, all components above are used if(SMARACT_MCS2_INCLUDE_DIR) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) - #find_package(OpenCV COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...), - # if the dataobject is included in the ITOM_SDK components, the OpenCV core component is detected there and the necessary include - # directories and libraries to link against are contained in ITOM_SDK_LIBRARIES and ITOM_SDK_INCLUDE_DIRS - ################################################################# + # find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...), + # if the dataobject is included in the ITOM_SDK components, the OpenCV core component is detected there and the necessary include + # directories and libraries to link against are contained in ITOM_SDK_LIBRARIES and ITOM_SDK_INCLUDE_DIRS + + # ################################################################ # Add Additional Scripts - # add here include commands for searching for adding - # useful scripts - ################################################################# + # add here include commands for searching for adding + # useful scripts + # ################################################################ # ... for example this one, found in the CMAKE_MODULE_PATH include(ItomBuildMacros) + # The CMake policies are assumed to behave like the tested version given as argument. itom_init_cmake_policy(3.12) # 'itom_find_package_qt' is a wrapper for find_package(Qt5...) and internally calls # this and sets some things more. The component names are wrapped to Qt5_{name}. # - #usage of itom_find_package_qt(automoc component1, component2, ...) + # usage of itom_find_package_qt(automoc component1, component2, ...) # automoc is ON or OFF and only relevant for Qt5, usually set it to ON # possible components are: OpenGL,Core,Designer,Xml,Svg,Sql,Network,UiTools,Widgets,PrintSupport,LinguistTools... # The automoc flag is deprecated. It is usually smarter to use both automoc, @@ -105,42 +109,44 @@ if(SMARACT_MCS2_INCLUDE_DIR) # Add ${VISUALLEAKDETECTOR_LIBRARIES} to target_link_libraries below. itom_init_plugin_library(${target_name}) - ################################################################# + # ################################################################ # General settings and preprocessor settings - ################################################################# + # ################################################################ - #add here some preprocessors, if necessary, e.g. - #add_definitions(-DMYOPTION) + # add here some preprocessors, if necessary, e.g. + # add_definitions(-DMYOPTION) - ################################################################# + # ################################################################ # List of include directories # # Hint: necessary Qt include directories are automatically added - # via the FIND_PACKAGE macro above - ################################################################# + # via the FIND_PACKAGE macro above + # ################################################################ include_directories( - ${CMAKE_CURRENT_BINARY_DIR} #build directory of this plugin (recommended) - ${CMAKE_CURRENT_SOURCE_DIR} #source directory of this plugin (recommended) - ${ITOM_SDK_INCLUDE_DIRS} #include directory of the itom SDK (recommended) as well as necessary 3rd party directories (e.g. from OpenCV) - #add further include directories here + ${CMAKE_CURRENT_BINARY_DIR} # build directory of this plugin (recommended) + ${CMAKE_CURRENT_SOURCE_DIR} # source directory of this plugin (recommended) + ${ITOM_SDK_INCLUDE_DIRS} # include directory of the itom SDK (recommended) as well as necessary 3rd party directories (e.g. from OpenCV) + + # add further include directories here ${SMARACT_MCS2_INCLUDE_DIR} ) - ################################################################# + # ################################################################ # List of linker directories # # Hint: libraries detected using FIND_PACKAGE usually provide - # all necessary libraries in a specific variable (e.g. - # ${OpenCV_LIBS} or ${ITOM_SDK_LIBRARIES}). These variables - # already contain absolute paths, therefore no link directory - # needs to be set for them. Simply add these variables to - # the link target command below. - ################################################################# + # all necessary libraries in a specific variable (e.g. + # ${OpenCV_LIBS} or ${ITOM_SDK_LIBRARIES}). These variables + # already contain absolute paths, therefore no link directory + # needs to be set for them. Simply add these variables to + # the link target command below. + # ################################################################ link_directories( - #add all linker directories + + # add all linker directories ) - ################################################################# + # ################################################################ # List of header files, source files, ui files and rcc files # # Add all header files to the PLUGIN_HEADERS list. @@ -153,27 +159,29 @@ if(SMARACT_MCS2_INCLUDE_DIR) # ${CMAKE_CURRENT_SOURCE_DIR} is the source directory of this plugin # ${CMAKE_CURRENT_BINARY_DIR} is the build directory of this plugin # - ################################################################# + # ################################################################ set(PLUGIN_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/SmarActMCS2.h ${CMAKE_CURRENT_SOURCE_DIR}/dialogSmarActMCS2.h ${CMAKE_CURRENT_SOURCE_DIR}/dockWidgetSmarActMCS2.h ${CMAKE_CURRENT_BINARY_DIR}/pluginVersion.h - ${CMAKE_CURRENT_BINARY_DIR}/gitVersion.h #provided by the init script, contains currently checked out git tag - #add further header files (absolute paths e.g. using CMAKE_CURRENT_SOURCE_DIR) + ${CMAKE_CURRENT_BINARY_DIR}/gitVersion.h # provided by the init script, contains currently checked out git tag + + # add further header files (absolute paths e.g. using CMAKE_CURRENT_SOURCE_DIR) ) set(PLUGIN_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dialogSmarActMCS2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dockWidgetSmarActMCS2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/SmarActMCS2.cpp - #add further source files here + + # add further source files here ) - #Define Version in pluginVersion.h - configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/pluginVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/pluginVersion.h) + # Define Version in pluginVersion.h + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pluginVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/pluginVersion.h) - #Append rc file to the source files for adding information about the plugin + # Append rc file to the source files for adding information about the plugin # to the properties of the DLL under Visual Studio. if(MSVC) list(APPEND PLUGIN_SOURCES ${ITOM_SDK_INCLUDE_DIR}/../pluginLibraryVersion.rc) @@ -185,11 +193,11 @@ if(SMARACT_MCS2_INCLUDE_DIR) ) set(PLUGIN_RCC - #add absolute paths to any *.qrc resource files here - ) + # add absolute paths to any *.qrc resource files here + ) - ################################################################# + # ################################################################ # Group files in their original folder structure (MSVC only) # If you have some header and source files in a specific # subfolder, you can even have this subfolder in your @@ -197,28 +205,27 @@ if(SMARACT_MCS2_INCLUDE_DIR) # itom_add_source_group(directoryName) for each subdirectory. # # HINT: This command does nothing for IDE different than MSVC. - ################################################################# - #itom_add_source_group(subdirectory) - + # ################################################################ + # itom_add_source_group(subdirectory) - ################################################################# + # ################################################################ # Compile and link the plugin library # - ################################################################# + # ################################################################ - #add all (generated) header and source files to the library (these files are compiled then) + # add all (generated) header and source files to the library (these files are compiled then) add_library(${target_name} SHARED ${PLUGIN_SOURCES} ${PLUGIN_HEADERS} ${PLUGIN_UI} ${PLUGIN_RCC} - ) + ) # Qt: enable all automoc, autouic and autorcc. Autouic file will be disabled for all files that are processed manually by itom_qt_wrap_ui. set_target_properties(${target_name} PROPERTIES AUTOMOC ON AUTORCC ON AUTOUIC ON) - #link the compiled library - #append all libraries this plugin should be linked to at the end of the target_link_libraries command + # link the compiled library + # append all libraries this plugin should be linked to at the end of the target_link_libraries command # Important variables are: # ${ITOM_SDK_LIBRARIES} -> all necessary libraries from find_package(ITOM_SDK) # -> all necessary libraries from FIND_PACKAGE_QT (Qt4 or Qt5) @@ -226,15 +233,14 @@ if(SMARACT_MCS2_INCLUDE_DIR) # # if you want to link against one library whose directory is already added to link_directories above # simply add its filename without suffix (*.lib, *.so...). This is automatically done by CMake - target_link_libraries(${target_name} ${ITOM_SDK_LIBRARIES} ${QT5_LIBRARIES} ${VISUALLEAKDETECTOR_LIBRARIES} ${SMARACT_MCS2_LIBRARY} - ) + ) - ################################################################# + # ################################################################ # Plugin Translation # # In the plugin source directory can be a 'translation' subfolder @@ -253,15 +259,15 @@ if(SMARACT_MCS2_INCLUDE_DIR) # solution, the ts-files are compiled into qm-files, which are then # put into itom's plugin subdirectory together with the plugin # library itself. - ################################################################# + # ################################################################ set(FILES_TO_TRANSLATE ${PLUGIN_SOURCES} ${PLUGIN_HEADERS} ${PLUGIN_UI} ${PLUGIN_RCC}) itom_library_translation( QM_FILES TARGET ${target_name} FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} - ) + ) - ################################################################# + # ################################################################ # Plugin Documentation # # In the source directory of the plugin can be a subfolder 'docs'. @@ -271,10 +277,10 @@ if(SMARACT_MCS2_INCLUDE_DIR) # suffix rst) in the following command: # # itom_configure_plugin_documentation(${target_name} nameOfTheFile) - ################################################################# + # ################################################################ itom_configure_plugin_documentation(${target_name} SmarActMCS2) - ################################################################# + # ################################################################ # Post-Build Copy Operations # # itom is able to force a post-build process that copies @@ -290,14 +296,14 @@ if(SMARACT_MCS2_INCLUDE_DIR) # # itom_add_pluginlibrary_to_copy_list # - this is necessary for each plugin such that the library - # is automatically copied to the plugins folder of - # the itom build directory. + # is automatically copied to the plugins folder of + # the itom build directory. # # itom_add_plugin_qm_files_to_copy_list # - installs the generated translation files (qm) at the - # right place in the itom build directory as well. + # right place in the itom build directory as well. # - ################################################################# + # ################################################################ set(COPY_SOURCES "") set(COPY_DESTINATIONS "") @@ -308,18 +314,18 @@ if(SMARACT_MCS2_INCLUDE_DIR) itom_post_build_copy_files_to_lib_folder(${target_name} SMARACTMCS_BINARY) - set(BINARY_FILES - "${SMARACT_MCS2_DIR}/SDK/Redistributable/DLL/x64/SmarActCTL.dll" - "${SMARACT_MCS2_DIR}/SDK/Redistributable/DLL/x64/SmarActIO.dll" - "${SMARACT_MCS2_DIR}/SDK/Redistributable/DLL/x64/SmarActLog.dll" - ) + set(BINARY_FILES + "${SMARACT_MCS2_DIR}/SDK/Redistributable/DLL/x64/SmarActCTL.dll" + "${SMARACT_MCS2_DIR}/SDK/Redistributable/DLL/x64/SmarActIO.dll" + "${SMARACT_MCS2_DIR}/SDK/Redistributable/DLL/x64/SmarActLog.dll" + ) - itom_post_build_copy_files_to_lib_folder(${target_name} BINARY_FILES) + itom_post_build_copy_files_to_lib_folder(${target_name} BINARY_FILES) - #if you want to copy one or more files to the lib-folder of - # the itom build directory, use the following macro: - # - # itom_post_build_copy_files_to_lib_folder(${target}, ${listOfFiles}) +# if you want to copy one or more files to the lib-folder of +# the itom build directory, use the following macro: +# +# itom_post_build_copy_files_to_lib_folder(${target}, ${listOfFiles}) else(SMARACT_MCS2_INCLUDE_DIR) message(SEND_ERROR "${SMARACT_MCS2_INCLUDE_DIR} for plugin ${target_name} could not be found. ${target_name} will not be build. Please properly indicate SMARACT_MCS2_INCLUDE_DIR.") ENDIF(SMARACT_MCS2_INCLUDE_DIR) \ No newline at end of file diff --git a/SmarActMCS2/SmarActMCS2.cpp b/SmarActMCS2/SmarActMCS2.cpp index 376d80e4..63fb5d3b 100644 --- a/SmarActMCS2/SmarActMCS2.cpp +++ b/SmarActMCS2/SmarActMCS2.cpp @@ -1,7 +1,7 @@ /* ******************************************************************** Plugin "SmarActMCS2" for itom software URL: http://www.uni-stuttgart.de/ito - Copyright (C) 2025, TRUMPF Lasersystems for Semiconductor Manufacturing SE,´Germany + Copyright (C) 2025, TRUMPF Lasersystems for Semiconductor Manufacturing SE,�Germany This file is part of a plugin for the measurement software itom. @@ -23,14 +23,15 @@ #define ITOM_IMPORT_PLOTAPI #include "SmarActMCS2.h" -#include "pluginVersion.h" #include "gitVersion.h" +#include "pluginVersion.h" +#include +#include +#include +#include #include #include -#include -#include -#include #include #include "common/helperCommon.h" @@ -56,9 +57,8 @@ SmarActMCS2Interface::SmarActMCS2Interface() m_description = QObject::tr("SmarActMCS2"); - //for the docstring, please don't set any spaces at the beginning of the line. - char docstring[] = \ -"This plugin is an actuator plugin to control stages from SmarAct.\n\ + // for the docstring, please don't set any spaces at the beginning of the line. + char docstring[] = "This plugin is an actuator plugin to control stages from SmarAct.\n\ \n\ It was implemented for ETHERNET communication and tested with:\n\ \n\ @@ -75,15 +75,16 @@ It was implemented for ETHERNET communication and tested with:\n\ m_license = QObject::tr(PLUGIN_LICENCE); m_aboutThis = QObject::tr(GITVERSION); - //optional parameter - m_initParamsOpt.append(ito::Param( - "serialNo", - ito::ParamBase::String, - "", - tr("Serial number of the device to be loaded. If empty, the first device that can be " - "opened will be opened. (e.g.: network:sn:MCS2-00012345") - .toLatin1() - .data())); + // optional parameter + m_initParamsOpt.append( + ito::Param( + "serialNo", + ito::ParamBase::String, + "", + tr("Serial number of the device to be loaded. If empty, the first device that can be " + "opened will be opened. (e.g.: network:sn:MCS2-00012345") + .toLatin1() + .data())); } //---------------------------------------------------------------------------------------------------------------------------------- @@ -96,27 +97,29 @@ SmarActMCS2Interface::~SmarActMCS2Interface() } //---------------------------------------------------------------------------------------------------------------------------------- -ito::RetVal SmarActMCS2Interface::getAddInInst(ito::AddInBase **addInInst) +ito::RetVal SmarActMCS2Interface::getAddInInst(ito::AddInBase** addInInst) { - NEW_PLUGININSTANCE(SmarActMCS2) //the argument of the macro is the classname of the plugin + NEW_PLUGININSTANCE(SmarActMCS2) // the argument of the macro is the classname of the plugin return ito::retOk; } //---------------------------------------------------------------------------------------------------------------------------------- -ito::RetVal SmarActMCS2Interface::closeThisInst(ito::AddInBase **addInInst) +ito::RetVal SmarActMCS2Interface::closeThisInst(ito::AddInBase** addInInst) { - REMOVE_PLUGININSTANCE(SmarActMCS2) //the argument of the macro is the classname of the plugin - return ito::retOk; + REMOVE_PLUGININSTANCE(SmarActMCS2) // the argument of the macro is the classname of the plugin + return ito::retOk; } //---------------------------------------------------------------------------------------------------------------------------------- #if QT_VERSION < 0x050000 - Q_EXPORT_PLUGIN2(SmarActMCS2interface, SmarActMCS2Interface) //the second parameter must correspond to the class-name of the interface class, the first parameter is arbitrary (usually the same with small letters only) +Q_EXPORT_PLUGIN2( + SmarActMCS2interface, + SmarActMCS2Interface) // the second parameter must correspond to the class-name of the interface + // class, the first parameter is arbitrary (usually the same with small + // letters only) #endif - - //---------------------------------------------------------------------------------------------------------------------------------- //! Constructor of plugin. /*! @@ -174,9 +177,7 @@ SmarActMCS2::SmarActMCS2() : AddInActuator(), m_async(0), m_nrOfAxes(1) 0, std::numeric_limits::max(), 0, - tr("Number of Bus Modules.") - .toUtf8() - .data()); + tr("Number of Bus Modules.").toUtf8().data()); paramVal.setMeta(new ito::IntMeta(0, std::numeric_limits::max(), 1, "Device info")); m_params.insert(paramVal.getName(), paramVal); @@ -186,9 +187,7 @@ SmarActMCS2::SmarActMCS2() : AddInActuator(), m_async(0), m_nrOfAxes(1) 0, std::numeric_limits::max(), 0, - tr("Number of Channels.") - .toUtf8() - .data()); + tr("Number of Channels.").toUtf8().data()); paramVal.setMeta(new ito::IntMeta(0, std::numeric_limits::max(), 1, "Device info")); m_params.insert(paramVal.getName(), paramVal); @@ -261,18 +260,20 @@ SmarActMCS2::SmarActMCS2() : AddInActuator(), m_async(0), m_nrOfAxes(1) tr("Lower limits of axes.").toLatin1().data()); m_params.insert(paramVal.getName(), paramVal); - //initialize the current position vector, the status vector and the target position vector - m_currentPos.fill(0.0,m_nrOfAxes); - m_currentStatus.fill(0,m_nrOfAxes); - m_targetPos.fill(0.0,m_nrOfAxes); + // initialize the current position vector, the status vector and the target position vector + m_currentPos.fill(0.0, m_nrOfAxes); + m_currentStatus.fill(0, m_nrOfAxes); + m_targetPos.fill(0.0, m_nrOfAxes); m_factor.fill(1, m_nrOfAxes); - //the following lines create and register the plugin's dock widget. Delete these lines if the plugin does not have a dock widget. - DockWidgetSmarActMCS2 *dw = new DockWidgetSmarActMCS2(this); + // the following lines create and register the plugin's dock widget. Delete these lines if the + // plugin does not have a dock widget. + DockWidgetSmarActMCS2* dw = new DockWidgetSmarActMCS2(this); Qt::DockWidgetAreas areas = Qt::AllDockWidgetAreas; - QDockWidget::DockWidgetFeatures features = QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable; - createDockWidget(QString(m_params["name"].getVal()), features, areas, dw); + QDockWidget::DockWidgetFeatures features = QDockWidget::DockWidgetClosable | + QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable; + createDockWidget(QString(m_params["name"].getVal()), features, areas, dw); } //---------------------------------------------------------------------------------------------------------------------------------- @@ -285,7 +286,10 @@ SmarActMCS2::~SmarActMCS2() /*! \sa close */ -ito::RetVal SmarActMCS2::init(QVector *paramsMand, QVector *paramsOpt, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::init( + QVector* paramsMand, + QVector* paramsOpt, + ItomSharedSemaphore* waitCond) { ItomSharedSemaphoreLocker locker(waitCond); ito::RetVal retValue(ito::retOk); @@ -309,16 +313,12 @@ ito::RetVal SmarActMCS2::init(QVector *paramsMand, QVector *paramsMand, QVector *paramsMand, QVector *paramsMand, QVector *paramsMand, QVector *paramsMand, QVector *paramsMand, QVector(baseUnit, m_nrOfAxes); @@ -615,20 +613,18 @@ ito::RetVal SmarActMCS2::init(QVector *paramsMand, QVector *paramsMand, QVectorrelease(); } - setInitialized(true); //init method has been finished (independent on retval) + setInitialized(true); // init method has been finished (independent on retval) return retValue; } @@ -730,7 +726,7 @@ ito::RetVal SmarActMCS2::init(QVector *paramsMand, QVector val, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::getParam(QSharedPointer val, ItomSharedSemaphore* waitCond) { ItomSharedSemaphoreLocker locker(waitCond); ito::RetVal retValue; @@ -756,22 +752,23 @@ ito::RetVal SmarActMCS2::getParam(QSharedPointer val, ItomSharedSema bool hasIndex = false; int index; QString suffix; - QMap::iterator it; + QMap::iterator it; - //parse the given parameter-name (if you support indexed or suffix-based parameters) + // parse the given parameter-name (if you support indexed or suffix-based parameters) retValue += apiParseParamName(val->getName(), key, hasIndex, index, suffix); - if(retValue == ito::retOk) + if (retValue == ito::retOk) { - //gets the parameter key from m_params map (read-only is allowed, since we only want to get the value). + // gets the parameter key from m_params map (read-only is allowed, since we only want to get + // the value). retValue += apiGetParamFromMapByKey(m_params, key, it, false); } - if(!retValue.containsError()) + if (!retValue.containsError()) { - //put your switch-case.. for getting the right value here + // put your switch-case.. for getting the right value here - //finally, save the desired value in the argument val (this is a shared pointer!) + // finally, save the desired value in the argument val (this is a shared pointer!) *val = it.value(); } @@ -785,7 +782,7 @@ ito::RetVal SmarActMCS2::getParam(QSharedPointer val, ItomSharedSema } //---------------------------------------------------------------------------------------------------------------------------------- -ito::RetVal SmarActMCS2::setParam(QSharedPointer val, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::setParam(QSharedPointer val, ItomSharedSemaphore* waitCond) { ItomSharedSemaphoreLocker locker(waitCond); ito::RetVal retValue(ito::retOk); @@ -796,31 +793,35 @@ ito::RetVal SmarActMCS2::setParam(QSharedPointer val, ItomShared QMap::iterator it; SA_CTL_Result_t result; - //parse the given parameter-name (if you support indexed or suffix-based parameters) - retValue += apiParseParamName( val->getName(), key, hasIndex, index, suffix ); + // parse the given parameter-name (if you support indexed or suffix-based parameters) + retValue += apiParseParamName(val->getName(), key, hasIndex, index, suffix); - if(isMotorMoving()) //this if-case is for actuators only. + if (isMotorMoving()) // this if-case is for actuators only. { - retValue += ito::RetVal(ito::retError, 0, tr("any axis is moving. Parameters cannot be set.").toLatin1().data()); + retValue += ito::RetVal( + ito::retError, + 0, + tr("any axis is moving. Parameters cannot be set.").toLatin1().data()); } - if(!retValue.containsError()) + if (!retValue.containsError()) { - //gets the parameter key from m_params map (read-only is not allowed and leads to ito::retError). + // gets the parameter key from m_params map (read-only is not allowed and leads to + // ito::retError). retValue += apiGetParamFromMapByKey(m_params, key, it, true); } - if(!retValue.containsError()) + if (!retValue.containsError()) { - //here the new parameter is checked whether its type corresponds or can be cast into the - // value in m_params and whether the new type fits to the requirements of any possible - // meta structure. + // here the new parameter is checked whether its type corresponds or can be cast into the + // value in m_params and whether the new type fits to the requirements of any possible + // meta structure. retValue += apiValidateParam(*it, *val, false, true); } - if(!retValue.containsError()) + if (!retValue.containsError()) { - if(key == "async") + if (key == "async") { m_async = val->getVal(); } @@ -834,7 +835,8 @@ ito::RetVal SmarActMCS2::setParam(QSharedPointer val, ItomShared result = SA_CTL_SetProperty_i64( m_insrumentHdl, i, - SA_CTL_PKEY_MOVE_VELOCITY, static_cast(data[i] * m_factor[i])); + SA_CTL_PKEY_MOVE_VELOCITY, + static_cast(data[i] * m_factor[i])); if (result != SA_CTL_ERROR_NONE) { retValue += ito::RetVal( @@ -867,7 +869,8 @@ ito::RetVal SmarActMCS2::setParam(QSharedPointer val, ItomShared result = SA_CTL_SetProperty_i64( m_insrumentHdl, i, - SA_CTL_PKEY_MOVE_ACCELERATION, static_cast(data[i] * m_factor[i])); + SA_CTL_PKEY_MOVE_ACCELERATION, + static_cast(data[i] * m_factor[i])); if (result != SA_CTL_ERROR_NONE) { retValue += ito::RetVal( @@ -975,7 +978,9 @@ ito::RetVal SmarActMCS2::setParam(QSharedPointer val, ItomShared retValue += ito::RetVal( ito::retError, 0, - tr("MCS2 failed to set positioner type of channel \"%1\". Please make shure that the given positioner type exists (according to the manual)\n") + tr("MCS2 failed to set positioner type of channel \"%1\". Please make " + "shure that the given positioner type exists (according to the " + "manual)\n") .arg(i) .toLatin1() .data()); @@ -1027,18 +1032,19 @@ ito::RetVal SmarActMCS2::setParam(QSharedPointer val, ItomShared .data()); } } - + if (!retValue.containsError()) { - //all parameters that don't need further checks can simply be assigned - //to the value in m_params (the rest is already checked above) - retValue += it->copyValueFrom( &(*val) ); + // all parameters that don't need further checks can simply be assigned + // to the value in m_params (the rest is already checked above) + retValue += it->copyValueFrom(&(*val)); } } - if(!retValue.containsError()) + if (!retValue.containsError()) { - emit parametersChanged(m_params); //send changed parameters to any connected dialogs or dock-widgets + emit parametersChanged( + m_params); // send changed parameters to any connected dialogs or dock-widgets } if (waitCond) @@ -1055,9 +1061,9 @@ ito::RetVal SmarActMCS2::setParam(QSharedPointer val, ItomShared /*! the given axis should be calibrated (e.g. by moving to a reference switch). */ -ito::RetVal SmarActMCS2::calib(const int axis, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::calib(const int axis, ItomSharedSemaphore* waitCond) { - return calib(QVector(1,axis), waitCond); + return calib(QVector(1, axis), waitCond); } //---------------------------------------------------------------------------------------------------------------------------------- @@ -1065,16 +1071,19 @@ ito::RetVal SmarActMCS2::calib(const int axis, ItomSharedSemaphore *waitCond) /*! the given axes should be calibrated (e.g. by moving to a reference switch). */ -ito::RetVal SmarActMCS2::calib(const QVector axis, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::calib(const QVector axis, ItomSharedSemaphore* waitCond) { ItomSharedSemaphoreLocker locker(waitCond); ito::RetVal retValue(ito::retOk); SA_CTL_Result_t result; - if(isMotorMoving()) + if (isMotorMoving()) { - retValue += ito::RetVal(ito::retError, 0, tr("motor is running. Further action is not possible").toLatin1().data()); + retValue += ito::RetVal( + ito::retError, + 0, + tr("motor is running. Further action is not possible").toLatin1().data()); } if (!retValue.containsError()) @@ -1089,11 +1098,14 @@ ito::RetVal SmarActMCS2::calib(const QVector axis, ItomSharedSemaphore *wai else if (m_params["sensorPresent"].getVal()[axis[i]] == 0) { retValue += ito::RetVal::format( - ito::retError, 1, tr("no sensor present at axis %i.").toLatin1().data(), axis[i]); + ito::retError, + 1, + tr("no sensor present at axis %i.").toLatin1().data(), + axis[i]); } else { - //reference in MCS2 is the calibration function + // reference in MCS2 is the calibration function result = SA_CTL_SetProperty_i32( m_insrumentHdl, axis[i], SA_CTL_PKEY_REFERENCING_OPTIONS, 0); @@ -1133,7 +1145,7 @@ ito::RetVal SmarActMCS2::calib(const QVector axis, ItomSharedSemaphore *wai QMutex waitMutex; QWaitCondition waitCondition; long delay = 100; //[ms] - const int timeoutMS = 60000; //Reference can take a lot of time + const int timeoutMS = 60000; // Reference can take a lot of time timer.start(); @@ -1226,7 +1238,6 @@ ito::RetVal SmarActMCS2::calib(const QVector axis, ItomSharedSemaphore *wai { waitCond->returnValue = retValue; waitCond->release(); - } return retValue; @@ -1239,19 +1250,19 @@ ito::RetVal SmarActMCS2::calib(const QVector axis, ItomSharedSemaphore *wai considered to be the new origin (zero-position). If this operation is not possible, return a warning. */ -ito::RetVal SmarActMCS2::setOrigin(const int axis, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::setOrigin(const int axis, ItomSharedSemaphore* waitCond) { - return setOrigin(QVector(1,axis), waitCond); + return setOrigin(QVector(1, axis), waitCond); } //---------------------------------------------------------------------------------------------------------------------------------- //! setOrigin /*! - the given axes should be set to origin. That means (if possible) their current position should be - considered to be the new origin (zero-position). If this operation is not possible, return a + the given axes should be set to origin. That means (if possible) their current position should + be considered to be the new origin (zero-position). If this operation is not possible, return a warning. */ -ito::RetVal SmarActMCS2::setOrigin(QVector axis, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::setOrigin(QVector axis, ItomSharedSemaphore* waitCond) { ItomSharedSemaphoreLocker locker(waitCond); ito::RetVal retValue(ito::retOk); @@ -1272,10 +1283,12 @@ ito::RetVal SmarActMCS2::setOrigin(QVector axis, ItomSharedSemaphore *waitC //---------------------------------------------------------------------------------------------------------------------------------- //! getStatus /*! - re-checks the status (current position, available, end switch reached, moving, at target...) of all axes and - returns the status of each axis as vector. Each status is an or-combination of the enumeration ito::tActuatorStatus. + re-checks the status (current position, available, end switch reached, moving, at target...) of + all axes and returns the status of each axis as vector. Each status is an or-combination of the + enumeration ito::tActuatorStatus. */ -ito::RetVal SmarActMCS2::getStatus(QSharedPointer > status, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::getStatus( + QSharedPointer> status, ItomSharedSemaphore* waitCond) { ItomSharedSemaphoreLocker locker(waitCond); ito::RetVal retValue(ito::retOk); @@ -1294,13 +1307,16 @@ ito::RetVal SmarActMCS2::getStatus(QSharedPointer > status, ItomSha //---------------------------------------------------------------------------------------------------------------------------------- //! getPos /*! - returns the current position in pico meter [pm] for linear positioners or nano degree [ndeg] for rotatory positioners of the given axis + returns the current position in pico meter [pm] for linear positioners or nano degree [ndeg] for + rotatory positioners of the given axis */ -ito::RetVal SmarActMCS2::getPos(const int axis, QSharedPointer pos, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::getPos( + const int axis, QSharedPointer pos, ItomSharedSemaphore* waitCond) { ItomSharedSemaphoreLocker locker(waitCond); - QSharedPointer > pos2(new QVector(1,0.0)); - ito::RetVal retValue = getPos(QVector(1,axis), pos2, NULL); //forward to multi-axes version + QSharedPointer> pos2(new QVector(1, 0.0)); + ito::RetVal retValue = + getPos(QVector(1, axis), pos2, NULL); // forward to multi-axes version *pos = (*pos2)[0]; if (waitCond) @@ -1315,9 +1331,11 @@ ito::RetVal SmarActMCS2::getPos(const int axis, QSharedPointer pos, Itom //---------------------------------------------------------------------------------------------------------------------------------- //! getPos /*! - returns the current position in meter for linear positioners or degree for rotatory positioners of all given axes + returns the current position in meter for linear positioners or degree for rotatory positioners + of all given axes */ -ito::RetVal SmarActMCS2::getPos(QVector axis, QSharedPointer > pos, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::getPos( + QVector axis, QSharedPointer> pos, ItomSharedSemaphore* waitCond) { ItomSharedSemaphoreLocker locker(waitCond); ito::RetVal retValue(ito::retOk); @@ -1329,7 +1347,10 @@ ito::RetVal SmarActMCS2::getPos(QVector axis, QSharedPointer= 0 && axis[i] < m_nrOfAxes) @@ -1385,9 +1406,9 @@ ito::RetVal SmarActMCS2::getPos(QVector axis, QSharedPointer(1,axis), QVector(1,pos), waitCond); + return setPosAbs(QVector(1, axis), QVector(1, pos), waitCond); } //---------------------------------------------------------------------------------------------------------------------------------- @@ -1401,15 +1422,19 @@ ito::RetVal SmarActMCS2::setPosAbs(const int axis, const double pos, ItomSharedS In some cases only relative movements are possible, then get the current position, determine the relative movement and call the method relatively move the axis. */ -ito::RetVal SmarActMCS2::setPosAbs(QVector axis, QVector pos, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::setPosAbs( + QVector axis, QVector pos, ItomSharedSemaphore* waitCond) { ItomSharedSemaphoreLocker locker(waitCond); ito::RetVal retValue(ito::retOk); bool released = false; - if(isMotorMoving()) + if (isMotorMoving()) { - retValue += ito::RetVal(ito::retError, 0, tr("motor is running. Additional actions are not possible.").toLatin1().data()); + retValue += ito::RetVal( + ito::retError, + 0, + tr("motor is running. Additional actions are not possible.").toLatin1().data()); } else { @@ -1417,14 +1442,18 @@ ito::RetVal SmarActMCS2::setPosAbs(QVector axis, QVector pos, ItomS { if (axis[i] < 0 || axis[i] >= m_nrOfAxes) { - retValue += ito::RetVal::format(ito::retError, 1, tr("axis %i not available").toLatin1().data(), axis[i]); + retValue += ito::RetVal::format( + ito::retError, 1, tr("axis %i not available").toLatin1().data(), axis[i]); } else if ( m_params["sensorPresent"].getVal()[axis[i]] == 0 && pos[i] != m_currentPos[axis[i]]) { retValue += ito::RetVal::format( - ito::retError, 1, tr("no sensor present at axis %i.").toLatin1().data(), axis[i]); + ito::retError, + 1, + tr("no sensor present at axis %i.").toLatin1().data(), + axis[i]); } else { @@ -1452,7 +1481,8 @@ ito::RetVal SmarActMCS2::setPosAbs(QVector axis, QVector pos, ItomS if (!retValue.containsError()) { - //set status of all given axes to moving and keep all flags related to the status and switches + // set status of all given axes to moving and keep all flags related to the status and + // switches setStatus(axis, ito::actuatorMoving, ito::actSwitchesMask | ito::actStatusMask); for (int i = 0; i < axis.size(); i++) @@ -1489,26 +1519,31 @@ ito::RetVal SmarActMCS2::setPosAbs(QVector axis, QVector pos, ItomS } } - //emit the signal targetChanged with m_targetPos as argument, such that all connected slots gets informed about new targets + // emit the signal targetChanged with m_targetPos as argument, such that all connected + // slots gets informed about new targets sendTargetUpdate(); - //emit the signal sendStatusUpdate such that all connected slots gets informed about changes in m_currentStatus and m_currentPos. + // emit the signal sendStatusUpdate such that all connected slots gets informed about + // changes in m_currentStatus and m_currentPos. sendStatusUpdate(); - //release the wait condition now, if async is true (itom considers this method to be finished now due to the threaded call) - if(m_async && waitCond && !released) + // release the wait condition now, if async is true (itom considers this method to be + // finished now due to the threaded call) + if (m_async && waitCond && !released) { waitCond->returnValue = retValue; waitCond->release(); released = true; } - //call waitForDone in order to wait until all axes reached their target or a given timeout expired - //the m_currentPos and m_currentStatus vectors are updated within this function - retValue += waitForDone(60000, axis); //WaitForAnswer(60000, axis); + // call waitForDone in order to wait until all axes reached their target or a given + // timeout expired the m_currentPos and m_currentStatus vectors are updated within this + // function + retValue += waitForDone(60000, axis); // WaitForAnswer(60000, axis); - //release the wait condition now, if async is false (itom waits until now if async is false, hence in the synchronous mode) - if(!m_async && waitCond && !released) + // release the wait condition now, if async is false (itom waits until now if async is + // false, hence in the synchronous mode) + if (!m_async && waitCond && !released) { waitCond->returnValue = retValue; waitCond->release(); @@ -1517,7 +1552,7 @@ ito::RetVal SmarActMCS2::setPosAbs(QVector axis, QVector pos, ItomS } } - //if the wait condition has not been released yet, do it now + // if the wait condition has not been released yet, do it now if (waitCond && !released) { waitCond->returnValue = retValue; @@ -1538,9 +1573,9 @@ ito::RetVal SmarActMCS2::setPosAbs(QVector axis, QVector pos, ItomS In some cases only absolute movements are possible, then get the current position, determine the new absolute target position and call setPosAbs with this absolute target position. */ -ito::RetVal SmarActMCS2::setPosRel(const int axis, const double pos, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::setPosRel(const int axis, const double pos, ItomSharedSemaphore* waitCond) { - return setPosRel(QVector(1,axis), QVector(1,pos), waitCond); + return setPosRel(QVector(1, axis), QVector(1, pos), waitCond); } //---------------------------------------------------------------------------------------------------------------------------------- @@ -1551,18 +1586,22 @@ ito::RetVal SmarActMCS2::setPosRel(const int axis, const double pos, ItomSharedS depending on m_async this method directly returns after starting the movement (async = 1) or only returns if all axes reached the given target positions (async = 0) - In some cases only absolute movements are possible, then get the current positions, determine the - new absolute target positions and call setPosAbs with these absolute target positions. + In some cases only absolute movements are possible, then get the current positions, determine + the new absolute target positions and call setPosAbs with these absolute target positions. */ -ito::RetVal SmarActMCS2::setPosRel(QVector axis, QVector pos, ItomSharedSemaphore *waitCond) +ito::RetVal SmarActMCS2::setPosRel( + QVector axis, QVector pos, ItomSharedSemaphore* waitCond) { ItomSharedSemaphoreLocker locker(waitCond); ito::RetVal retValue(ito::retOk); bool released = false; - if(isMotorMoving()) + if (isMotorMoving()) { - retValue += ito::RetVal(ito::retError, 0, tr("motor is running. Additional actions are not possible.").toLatin1().data()); + retValue += ito::RetVal( + ito::retError, + 0, + tr("motor is running. Additional actions are not possible.").toLatin1().data()); } else { @@ -1663,26 +1702,31 @@ ito::RetVal SmarActMCS2::setPosRel(QVector axis, QVector pos, ItomS } } - //emit the signal targetChanged with m_targetPos as argument, such that all connected slots gets informed about new targets + // emit the signal targetChanged with m_targetPos as argument, such that all connected + // slots gets informed about new targets sendTargetUpdate(); - //emit the signal sendStatusUpdate such that all connected slots gets informed about changes in m_currentStatus and m_currentPos. + // emit the signal sendStatusUpdate such that all connected slots gets informed about + // changes in m_currentStatus and m_currentPos. sendStatusUpdate(); - //release the wait condition now, if async is true (itom considers this method to be finished now due to the threaded call) - if(m_async && waitCond && !released) + // release the wait condition now, if async is true (itom considers this method to be + // finished now due to the threaded call) + if (m_async && waitCond && !released) { waitCond->returnValue = retValue; waitCond->release(); released = true; } - //call waitForDone in order to wait until all axes reached their target or a given timeout expired - //the m_currentPos and m_currentStatus vectors are updated within this function - retValue += waitForDone(60000, axis); //WaitForAnswer(60000, axis); + // call waitForDone in order to wait until all axes reached their target or a given + // timeout expired the m_currentPos and m_currentStatus vectors are updated within this + // function + retValue += waitForDone(60000, axis); // WaitForAnswer(60000, axis); - //release the wait condition now, if async is false (itom waits until now if async is false, hence in the synchronous mode) - if(!m_async && waitCond && !released) + // release the wait condition now, if async is false (itom waits until now if async is + // false, hence in the synchronous mode) + if (!m_async && waitCond && !released) { waitCond->returnValue = retValue; waitCond->release(); @@ -1691,7 +1735,7 @@ ito::RetVal SmarActMCS2::setPosRel(QVector axis, QVector pos, ItomS } } - //if the wait condition has not been released yet, do it now + // if the wait condition has not been released yet, do it now if (waitCond && !released) { waitCond->returnValue = retValue; @@ -1704,8 +1748,10 @@ ito::RetVal SmarActMCS2::setPosRel(QVector axis, QVector pos, ItomS //---------------------------------------------------------------------------------------------------------------------------------- //! method must be overwritten from ito::AddInActuator /*! - WaitForDone should wait for a moving motor until the indicated axes (or all axes of nothing is indicated) have stopped or a timeout or user interruption - occurred. The timeout can be given in milliseconds, or -1 if no timeout should be considered. The flag-parameter can be used for your own purpose. + WaitForDone should wait for a moving motor until the indicated axes (or all axes of nothing is + indicated) have stopped or a timeout or user interruption occurred. The timeout can be given in + milliseconds, or -1 if no timeout should be considered. The flag-parameter can be used for your + own purpose. */ ito::RetVal SmarActMCS2::waitForDone(const int timeoutMS, const QVector axis, const int flags) { @@ -1720,11 +1766,11 @@ ito::RetVal SmarActMCS2::waitForDone(const int timeoutMS, const QVector axi timer.start(); - //if axis is empty, all axes should be observed by this method + // if axis is empty, all axes should be observed by this method QVector _axis = axis; - if (_axis.size() == 0) //all axis + if (_axis.size() == 0) // all axis { - for (int i=0;i axi while (!done && !timeout) { - done = true; //assume all axes at target + done = true; // assume all axes at target for (int i = 0; i < _axis.size(); i++) { @@ -1741,7 +1787,8 @@ ito::RetVal SmarActMCS2::waitForDone(const int timeoutMS, const QVector axi if (m_params["sensorPresent"].getVal()[_axis[i]] == 0) { - // if sensor not present but no movement required, no error will emit --> this is the case, when performing all aces movement in dock widget: + // if sensor not present but no movement required, no error will emit --> this is + // the case, when performing all aces movement in dock widget: if (m_currentPos[axis[i]] != m_targetPos[axis[i]]) { retVal += ito::RetVal( @@ -1767,7 +1814,7 @@ ito::RetVal SmarActMCS2::waitForDone(const int timeoutMS, const QVector axi m_insrumentHdl, _axis[i], SA_CTL_PKEY_CHANNEL_STATE, &state, 0); if (result == SA_CTL_ERROR_NONE) { - //get current position + // get current position SA_CTL_Result_t result; int64_t position; @@ -1810,16 +1857,14 @@ ito::RetVal SmarActMCS2::waitForDone(const int timeoutMS, const QVector axi retVal += ito::RetVal( ito::retError, 0, - tr("MCS2 error occured during check state\n") - .toLatin1() - .data()); + tr("MCS2 error occured during check state\n").toLatin1().data()); } } - //emit actuatorStatusChanged with both m_currentStatus and m_currentPos as arguments + // emit actuatorStatusChanged with both m_currentStatus and m_currentPos as arguments sendStatusUpdate(false); - //now check if the interrupt flag has been set (e.g. by a button click on its dock widget) + // now check if the interrupt flag has been set (e.g. by a button click on its dock widget) if (!done && isInterrupted()) { SA_CTL_Result_t result; @@ -1833,41 +1878,40 @@ ito::RetVal SmarActMCS2::waitForDone(const int timeoutMS, const QVector axi retVal += ito::RetVal( ito::retError, 0, - tr("MCS2 failed to force axis to stop.\n") - .toLatin1() - .data()); + tr("MCS2 failed to force axis to stop.\n").toLatin1().data()); } } - - //set the status of all axes from moving to interrupted (only if moving was set before) + + // set the status of all axes from moving to interrupted (only if moving was set before) replaceStatus(_axis, ito::actuatorMoving, ito::actuatorInterrupted); sendStatusUpdate(true); - retVal += ito::RetVal(ito::retError,0,"interrupt occurred"); + retVal += ito::RetVal(ito::retError, 0, "interrupt occurred"); done = true; return retVal; } - //short delay + // short delay waitMutex.lock(); waitCondition.wait(&waitMutex, delay); waitMutex.unlock(); - //raise the alive flag again, this is necessary such that itom does not drop into a timeout if the - //positioning needs more time than the allowed timeout time. + // raise the alive flag again, this is necessary such that itom does not drop into a timeout + // if the positioning needs more time than the allowed timeout time. setAlive(); if (timeoutMS > -1) { - if (timer.elapsed() > timeoutMS) timeout = true; + if (timer.elapsed() > timeoutMS) + timeout = true; } } if (timeout) { - //timeout occurred, set the status of all currently moving axes to timeout + // timeout occurred, set the status of all currently moving axes to timeout replaceStatus(_axis, ito::actuatorMoving, ito::actuatorTimeout); - retVal += ito::RetVal(ito::retError,9999,"timeout occurred"); + retVal += ito::RetVal(ito::retError, 9999, "timeout occurred"); sendStatusUpdate(true); } @@ -1877,13 +1921,14 @@ ito::RetVal SmarActMCS2::waitForDone(const int timeoutMS, const QVector axi //---------------------------------------------------------------------------------------------------------------------------------- //! method obtains the current position, status of all axes /*! - This is a helper function, it is not necessary to implement a function like this, but it might help. + This is a helper function, it is not necessary to implement a function like this, but it might + help. */ ito::RetVal SmarActMCS2::updateStatus() { ito::RetVal retVal(ito::retOk); - for (int i=0;i()[i] == 0) { @@ -1913,8 +1958,8 @@ ito::RetVal SmarActMCS2::updateStatus() { int32_t state; - result = SA_CTL_GetProperty_i32( - m_insrumentHdl, i, SA_CTL_PKEY_CHANNEL_STATE, &state, 0); + result = + SA_CTL_GetProperty_i32(m_insrumentHdl, i, SA_CTL_PKEY_CHANNEL_STATE, &state, 0); if (result == SA_CTL_ERROR_NONE) { // use bit masking to determine thechannelsmovement state @@ -1930,7 +1975,8 @@ ito::RetVal SmarActMCS2::updateStatus() } } - //emit actuatorStatusChanged with m_currentStatus and m_currentPos in order to inform connected slots about the current status and position + // emit actuatorStatusChanged with m_currentStatus and m_currentPos in order to inform connected + // slots about the current status and position sendStatusUpdate(); return retVal; @@ -1939,20 +1985,34 @@ ito::RetVal SmarActMCS2::updateStatus() //---------------------------------------------------------------------------------------------------------------------------------- //! slot called if the dock widget of the plugin becomes (in)visible /*! - Overwrite this method if the plugin has a dock widget. If so, you can connect the parametersChanged signal of the plugin - with the dock widget once its becomes visible such that no resources are used if the dock widget is not visible. Right after - a re-connection emit parametersChanged(m_params) in order to send the current status of all plugin parameters to the dock widget. + Overwrite this method if the plugin has a dock widget. If so, you can connect the + parametersChanged signal of the plugin with the dock widget once its becomes visible such that no + resources are used if the dock widget is not visible. Right after a re-connection emit + parametersChanged(m_params) in order to send the current status of all plugin parameters to the + dock widget. */ void SmarActMCS2::dockWidgetVisibilityChanged(bool visible) { if (getDockWidget()) { - QWidget *widget = getDockWidget()->widget(); + QWidget* widget = getDockWidget()->widget(); if (visible) { - connect(this, SIGNAL(parametersChanged(QMap)), widget, SLOT(parametersChanged(QMap))); - connect(this, SIGNAL(actuatorStatusChanged(QVector, QVector)), widget, SLOT(actuatorStatusChanged(QVector, QVector))); - connect(this, SIGNAL(targetChanged(QVector)), widget, SLOT(targetChanged(QVector))); + connect( + this, + SIGNAL(parametersChanged(QMap)), + widget, + SLOT(parametersChanged(QMap))); + connect( + this, + SIGNAL(actuatorStatusChanged(QVector, QVector)), + widget, + SLOT(actuatorStatusChanged(QVector, QVector))); + connect( + this, + SIGNAL(targetChanged(QVector)), + widget, + SLOT(targetChanged(QVector))); emit parametersChanged(m_params); sendTargetUpdate(); @@ -1960,9 +2020,21 @@ void SmarActMCS2::dockWidgetVisibilityChanged(bool visible) } else { - disconnect(this, SIGNAL(parametersChanged(QMap)), widget, SLOT(parametersChanged(QMap))); - disconnect(this, SIGNAL(actuatorStatusChanged(QVector, QVector)), widget, SLOT(actuatorStatusChanged(QVector, QVector))); - disconnect(this, SIGNAL(targetChanged(QVector)), widget, SLOT(targetChanged(QVector))); + disconnect( + this, + SIGNAL(parametersChanged(QMap)), + widget, + SLOT(parametersChanged(QMap))); + disconnect( + this, + SIGNAL(actuatorStatusChanged(QVector, QVector)), + widget, + SLOT(actuatorStatusChanged(QVector, QVector))); + disconnect( + this, + SIGNAL(targetChanged(QVector)), + widget, + SLOT(targetChanged(QVector))); } } } @@ -2000,7 +2072,6 @@ ito::RetVal SmarActMCS2::execFunc( } } - SA_CTL_Result_t result; @@ -2129,20 +2200,24 @@ ito::RetVal SmarActMCS2::execFunc( //---------------------------------------------------------------------------------------------------------------------------------- //! method called to show the configuration dialog /*! - This method is called from the main thread from itom and should show the configuration dialog of the plugin. - If the instance of the configuration dialog has been created, its slot 'parametersChanged' is connected to the signal 'parametersChanged' - of the plugin. By invoking the slot sendParameterRequest of the plugin, the plugin's signal parametersChanged is immediately emitted with - m_params as argument. Therefore the configuration dialog obtains the current set of parameters and can be adjusted to its values. - - The configuration dialog should emit reject() or accept() depending if the user wanted to close the dialog using the ok or cancel button. - If ok has been clicked (accept()), this method calls applyParameters of the configuration dialog in order to force the dialog to send - all changed parameters to the plugin. If the user clicks an apply button, the configuration dialog itself must call applyParameters. - - If the configuration dialog is inherited from AbstractAddInConfigDialog, use the api-function apiShowConfigurationDialog that does all - the things mentioned in this description. - - Remember that you need to implement hasConfDialog in your plugin and return 1 in order to signalize itom that the plugin - has a configuration dialog. + This method is called from the main thread from itom and should show the configuration dialog of + the plugin. If the instance of the configuration dialog has been created, its slot + 'parametersChanged' is connected to the signal 'parametersChanged' of the plugin. By invoking the + slot sendParameterRequest of the plugin, the plugin's signal parametersChanged is immediately + emitted with m_params as argument. Therefore the configuration dialog obtains the current set of + parameters and can be adjusted to its values. + + The configuration dialog should emit reject() or accept() depending if the user wanted to close + the dialog using the ok or cancel button. If ok has been clicked (accept()), this method calls + applyParameters of the configuration dialog in order to force the dialog to send all changed + parameters to the plugin. If the user clicks an apply button, the configuration dialog itself + must call applyParameters. + + If the configuration dialog is inherited from AbstractAddInConfigDialog, use the api-function + apiShowConfigurationDialog that does all the things mentioned in this description. + + Remember that you need to implement hasConfDialog in your plugin and return 1 in order to + signalize itom that the plugin has a configuration dialog. \sa hasConfDialog */ diff --git a/ThorlabsDCxCam/CMakeLists.txt b/ThorlabsDCxCam/CMakeLists.txt index 369dc56d..6a321c97 100644 --- a/ThorlabsDCxCam/CMakeLists.txt +++ b/ThorlabsDCxCam/CMakeLists.txt @@ -41,7 +41,12 @@ if(THORLABS_DCxCAMERA_INCLUDE_DIR) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) - find_package(OpenCV COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) + find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/V4L2/CMakeLists.txt b/V4L2/CMakeLists.txt index 46a7e083..8287b2f0 100644 --- a/V4L2/CMakeLists.txt +++ b/V4L2/CMakeLists.txt @@ -18,7 +18,12 @@ endif(NOT EXISTS ${ITOM_SDK_DIR}) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) -find_package(OpenCV COMPONENTS core imgproc REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core imgproc REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) include(ItomBuildMacros) diff --git a/Xeneth/CMakeLists.txt b/Xeneth/CMakeLists.txt index 479e5b27..ee45c133 100644 --- a/Xeneth/CMakeLists.txt +++ b/Xeneth/CMakeLists.txt @@ -30,7 +30,12 @@ if(XENETH_INCLUDE_DIR) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) - find_package(OpenCV COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) + find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) #if you require openCV indicate all components that are required (e.g. core, imgproc...) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/Ximea/CMakeLists.txt b/Ximea/CMakeLists.txt index d6d295ed..c3f8eeb0 100644 --- a/Ximea/CMakeLists.txt +++ b/Ximea/CMakeLists.txt @@ -22,7 +22,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(Ximea) include(ItomBuildMacros) diff --git a/cmu1394/CMakeLists.txt b/cmu1394/CMakeLists.txt index 8b05d90f..c5b95993 100644 --- a/cmu1394/CMakeLists.txt +++ b/cmu1394/CMakeLists.txt @@ -19,7 +19,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/dataobjectarithmetic/CMakeLists.txt b/dataobjectarithmetic/CMakeLists.txt index e915f15f..9c310d2a 100644 --- a/dataobjectarithmetic/CMakeLists.txt +++ b/dataobjectarithmetic/CMakeLists.txt @@ -20,7 +20,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core imgproc REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core imgproc REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12) diff --git a/dispWindow/CMakeLists.txt b/dispWindow/CMakeLists.txt index a1762fed..28e2f396 100644 --- a/dispWindow/CMakeLists.txt +++ b/dispWindow/CMakeLists.txt @@ -19,7 +19,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(OpenGL) include(ItomBuildMacros) diff --git a/glDisplay/CMakeLists.txt b/glDisplay/CMakeLists.txt index 7165bb4a..b6b1b3a0 100644 --- a/glDisplay/CMakeLists.txt +++ b/glDisplay/CMakeLists.txt @@ -19,7 +19,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib itomWidgets REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() find_package(OpenGL) include(ItomBuildMacros) diff --git a/hidapi/CMakeLists.txt b/hidapi/CMakeLists.txt index f8399317..7e58668d 100644 --- a/hidapi/CMakeLists.txt +++ b/hidapi/CMakeLists.txt @@ -19,7 +19,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ITOM_SDK_DIR}/cmake) find_package(ITOM_SDK COMPONENTS dataobject itomCommonLib itomCommonQtLib REQUIRED) -find_package(OpenCV COMPONENTS core REQUIRED) +find_package(OpenCV REQUIRED COMPONENTS core REQUIRED) + +# Verify OpenCV version is 3.0 or higher +if(OpenCV_VERSION VERSION_LESS "3.0") + message(FATAL_ERROR "OpenCV version ${OpenCV_VERSION} found, but version 3.0 or higher is required (supports 3.x, 4.x, and 5.0+)") +endif() include(ItomBuildMacros) itom_init_cmake_policy(3.12)