ImageDev C++
This section details how to start with ImageDev C++.
ImageDev C++ can be installed with a package archives.
To launch ImageDev examples or to create a new ImageDev C++ project, you need to:
Prerequisites
Supported platforms
To use ImageDev in a C++ project you need:- On Windows: Visual Studio 2017 or greater
- On Linux: GCC 9 compiler or greater
- CMake 3.7 or greater, 64-bits
- A valid ImageDev license
Package deployment
ImageDev C++ is distributed as downloadable archives.To launch ImageDev examples or to create a new ImageDev C++ project, you need to:
- Download the ImageDevC++ and ImageDevExamplesC++ package archives corresponding to your OS and compiler.
- Unzip these archives in a folder.
- path_to_unzipped_ImageDev is the path to the unzipped ImageDevC++ folder
- path_to_unzipped_ImageDevExamples is the path to the unzipped ImageDevExamplesC++ folder
Launching the ImageDev examples
All tutorials of the ImageDev user guide are available in the ImageDevExamplesC++ package. This section describes how to launch these examples.Project generation
To create the C++ solution containing the ImageDev examples:- Define an IMAGEDEVHOME environment variable with the path_to_unzipped_ImageDev value.
- Open CMake.
- Select the path_to_unzipped_ImageDevExamples/examples/source folder with the "Browse Source..." button.
- Select an empty build folder with the "Browse Build..." button.
- Press the "Configure" button.
- Select the appropriate generator, corresponding to your compiler and architecture.
- If your generator is more recent than Visual Studio 16 2019, you need to specify an optional toolset:
- For Visual Studio 17 2022 with Visual 2017 archives: v141
- For Visual Studio 17 2022 with Visual 2019 archives: v142
- Press the "Finish" button.
- Press the "Generate" button.
Hello ImageDev C++
You are now ready to run your first ImageDev code.- Open the generated solution.
- Build the "INSTALL" project to copy the ImageDev libraries in the output directory.
- Set the "T01_01_HelloImageDev" project as Startup Project.
- Start the project execution.
- Compare the resulting images, generated in the build/T01_FirstSteps/T01_01_HelloImageDev folder, with those shown in the HelloImageDev tutorial.
- Run the other examples of the HelloImageDev user guide
Creating a new project linked to ImageDev
Build environment creation
To create a new project using ImageDev from package archives, you need to:- Define a sources folder containing:
- a CMakeLists.txt file with the following instructions:
cmake_minimum_required( VERSION 3.7 ) # Project name project( HelloImageDev ) # ----------------------------------------------------------------------- # Define the directories containing data from the unzipped archives. set( ImageDev_DIR "path_to_unzipped_ImageDev/cmake" ) set( ImageDevExamples_DIR "path_to_unzipped_ImageDevExamples/cmake" ) # Find ImageDev and ImageDevExamples find_package( ImageDev REQUIRED ) find_package( ImageDevExamples REQUIRED ) # ----------------------------------------------------------------------- set( CMAKE_CXX_STANDARD 11 ) if ( UNIX ) set( CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}" ) endif() add_executable( ${PROJECT_NAME} main.cpp ) target_link_libraries( ${PROJECT_NAME} PUBLIC ImageDev ImageDevExamples ) if ( UNIX ) # Change the output directory if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) set_property( TARGET ${PROJECT_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}" ) else() set_property( TARGET ${PROJECT_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}" ) endif() endif() # Install the ImageDev libraries in the output directory install( FILES ${ImageDev_ALL_BINARIES_DEBUG} DESTINATION ${CMAKE_BINARY_DIR}/Debug CONFIGURATIONS Debug ) install( FILES ${ImageDev_ALL_BINARIES_RELEASE} DESTINATION ${CMAKE_BINARY_DIR}/Release CONFIGURATIONS Release ) # Install the libraries used by the demonstration in the output directory install( DIRECTORY ${ImageDevExamples_BINS_DIRECTORY_DEBUG} DESTINATION ${CMAKE_BINARY_DIR}/Debug CONFIGURATIONS Debug ) install( DIRECTORY ${ImageDevExamples_BINS_DIRECTORY_RELEASE} DESTINATION ${CMAKE_BINARY_DIR}/Release CONFIGURATIONS Release )
- a main.cpp file, for instance with a minimal main function:
int main() { return 0; }
- In the CMakeLists.txt file, replace
- path_to_unzipped_ImageDev and path_to_unzipped_ImageDevExamples by the appropriate paths.
- HelloImageDev by the name of the project to create.
Project generation
- Open CMake.
- Select the sources folder previously created with the "Browse Source..." button.
- Select an empty build folder with the "Browse Build..." button.
- Press the "Configure" button.
- Select the appropriate generator, corresponding to your compiler and architecture.
- If your generator is more recent than Visual Studio 16 2019, you need to specify an optional toolset:
- For Visual Studio 17 2022 with Visual 2017 archives: v141
- For Visual Studio 17 2022 with Visual 2019 archives: v142
- Press the "Finish" button.
- Press the "Generate" button.
Start using ImageDev
To create your first ImageDev processing code, you need to open or create a C++ project generated with the CMake options and add the following directives for including ImageDev, optionally IOLink and IOFormat, headers and namespaces.#include <ImageDev/ImageDev.h> #include <ioformat/IOFormat.h> #include <iolink/view/ImageViewProvider.h> using namespace imagedev; using namespace ioformat; using namespace iolink;You must first build the "INSTALL" project to copy the ImageDev libraries in the output directory.