diff --git a/CMakeLists.txt b/CMakeLists.txt index a238833f1..ea087b6b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,8 @@ if(NOT CMAKE_BUILD_TYPE) "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) endif(NOT CMAKE_BUILD_TYPE) +option(BUILD_TESTING "Build OpenEB's test suite" OFF) + cmake_minimum_required(VERSION 3.5) project(metavision VERSION 4.6.2) diff --git a/README.md b/README.md index 1db9b5b1e..68c011934 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Install the following dependencies: sudo apt update sudo apt -y install apt-utils build-essential software-properties-common wget unzip curl git cmake sudo apt -y install libopencv-dev libboost-all-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler -sudo apt -y install libhdf5-dev hdf5-tools libglew-dev libglfw3-dev libcanberra-gtk-module ffmpeg +sudo apt -y install libhdf5-dev hdf5-tools libglew-dev libglfw3-dev libcanberra-gtk-module ffmpeg ``` Optionally, if you want to run the tests, you need to install Google Gtest and Gmock packages. @@ -191,7 +191,7 @@ or you can deploy the OpenEB files in the system path (`/usr/local/lib`, `/usr/l Note that if you are using a third-party camera, you need to install the plugin provided by the camera vendor and specify the location of the plugin using the `MV_HAL_PLUGIN_PATH` environment variable. -To get started with OpenEB, you can download some [sample recordings](https://docs.prophesee.ai/stable/datasets.html) +To get started with OpenEB, you can download some [sample recordings](https://docs.prophesee.ai/stable/datasets.html) and visualize them with [metavision_viewer](https://docs.prophesee.ai/stable/samples/modules/driver/viewer.html) or you can stream data from your Prophesee-compatible event-based camera. @@ -202,7 +202,7 @@ Running the test suite is a sure-fire way to ensure you did everything well with * Download [the files](https://kdrive.infomaniak.com/app/share/975517/cddcc78a-3480-420f-bc19-17d5b0535ca4) necessary to run the tests. Click `Download` on the top right folder. Beware of the size of the obtained archive which weighs around 1.2 Gb. - * Extract and put the content of this archive to `/datasets`. + * Extract and put the content of this archive to `/datasets`. For instance, the correct path of sequence `gen31_timer.raw` should be `/datasets/openeb/gen31_timer.raw`. * Regenerate the makefiles with the test options enabled: @@ -218,7 +218,7 @@ Running the test suite is a sure-fire way to ensure you did everything well with ## Compiling on Windows -Currently, we support only Windows 10. +Currently, we support only Windows 10. Compilation on other versions of Windows was not tested. For those platforms some adjustments to this guide or to the code itself may be required. @@ -250,7 +250,7 @@ To compile OpenEB, you will need to install some extra tools: * For building only, you can install MS Build Tools (free, part of Windows 10 SDK package) * Download and run ["Build tools for Visual Studio 2022" installer](https://visualstudio.microsoft.com/visual-cpp-build-tools/) * Select "C++ build tools", make sure Windows 10 SDK is checked, and add English Language Pack - * For development, you can also download and run [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/) + * For development, you can also download and run [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/) * install [vcpkg](https://github.com/microsoft/vcpkg) that will be used for installing dependencies: * download and extract [vcpkg version 2023.11.20](https://github.com/microsoft/vcpkg/archive/refs/tags/2023.11.20.zip) * `cd ` @@ -278,7 +278,7 @@ Those can be found in the [vcpkg repository](https://github.com/microsoft/vcpkg/ * Add Python install and script directories in your `PATH` and make sure they are listed before the `WindowsApps` folder which contains a Python alias launching the Microsoft Store. So, if you installed Python 3.8 in the default path, your user `PATH` should contain those three lines in that order: - + ```bash %USERPROFILE%\AppData\Local\Programs\Python\Python38 %USERPROFILE%\AppData\Local\Programs\Python\Python38\Scripts @@ -339,9 +339,9 @@ Open a command prompt inside the `openeb` folder (absolute path to this director 1. Create and open the build directory, where temporary files will be created: `mkdir build && cd build` 2. Generate the makefiles using CMake: `cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=`. - Note that the value passed to the parameter `-DCMAKE_TOOLCHAIN_FILE` must be an absolute path, not a relative one. + Note that the value passed to the parameter `-DCMAKE_TOOLCHAIN_FILE` must be an absolute path, not a relative one. 3. Compile: `cmake --build . --config Release --parallel 4` - + Once the compilation is done, you have two options: you can choose to work directly from the `build` folder or you can deploy the OpenEB files (applications, samples, libraries etc.) in a directory of your choice. @@ -353,13 +353,13 @@ or you can deploy the OpenEB files (applications, samples, libraries etc.) in a ```bash utils\scripts\setup_env.bat ``` - + * Option 2 - deploying in a directory of your choice - * To deploy OpenEB in the default folder (`C:\Program Files\Prophesee`), execute this command + * To deploy OpenEB in the default folder (`C:\Program Files\Prophesee`), execute this command (your console should be launched as an administrator): - ```bash + ```bash cmake --build . --config Release --target install ``` @@ -370,12 +370,12 @@ or you can deploy the OpenEB files (applications, samples, libraries etc.) in a the `PYTHON3_SITE_PACKAGES` variable. Here is an example of a command customizing those two folders: - + ```bash cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DPYTHON3_SITE_PACKAGES= -DBUILD_TESTING=OFF ``` - - After this command, you should launch the actual compilation and installation of OpenEB + + After this command, you should launch the actual compilation and installation of OpenEB (your console should be launched as an administrator): ```bash @@ -389,7 +389,7 @@ or you can deploy the OpenEB files (applications, samples, libraries etc.) in a * append `\lib\metavision\hal\plugins` to `MV_HAL_PLUGIN_PATH` (`C:\Program Files\Prophesee\lib\metavision\hal\plugins` if you used default configuration) * append `\lib\hdf5\plugin` to `HDF5_PLUGIN_PATH` (`C:\Program Files\Prophesee\lib\hdf5\plugin` if you used default configuration) * append `` to `PYTHONPATH` (not needed if you used default configuration) - + #### Compilation using MS Visual Studio @@ -438,7 +438,7 @@ the `MV_HAL_PLUGIN_PATH` environment variable. #### Getting Started -To get started with OpenEB, you can download some [sample recordings](https://docs.prophesee.ai/stable/datasets.html) +To get started with OpenEB, you can download some [sample recordings](https://docs.prophesee.ai/stable/datasets.html) and visualize them with [metavision_viewer](https://docs.prophesee.ai/stable/samples/modules/driver/viewer.html) or you can stream data from your Prophesee-compatible event-based camera. @@ -449,8 +449,8 @@ Running the test suite is a sure-fire way to ensure you did everything well with * Download [the files](https://kdrive.infomaniak.com/app/share/975517/cddcc78a-3480-420f-bc19-17d5b0535ca4) necessary to run the tests. Click `Download` on the top right folder. Beware of the size of the obtained archive which weighs around 1.2 Gb. - - * Extract and put the content of this archive to `/datasets`. + + * Extract and put the content of this archive to `/datasets`. For instance, the correct path of sequence `gen31_timer.raw` should be `/datasets/openeb/gen31_timer.raw`. * To run the test suite you need to reconfigure your build environment using CMake and to recompile diff --git a/sdk/modules/core/cpp/samples/metavision_player/src/main.cpp b/sdk/modules/core/cpp/samples/metavision_player/src/main.cpp index 2df869eaf..a5bfea655 100644 --- a/sdk/modules/core/cpp/samples/metavision_player/src/main.cpp +++ b/sdk/modules/core/cpp/samples/metavision_player/src/main.cpp @@ -97,15 +97,15 @@ bool parse_command_line(int argc, const char *argv[], Parameters &app_params) { } // Check extension of provided output files - if (boost::filesystem::extension(app_params.out_bias_file) != ".bias") { + if (boost::filesystem::path(app_params.out_bias_file).extension() != ".bias") { MV_LOG_ERROR() << "Wrong extension for provided output bias file: supported extension is '.bias'"; return false; } - if (boost::filesystem::extension(app_params.out_png_file) != ".png") { + if (boost::filesystem::path(app_params.out_png_file).extension() != ".png") { MV_LOG_ERROR() << "Wrong extension for provided output PNG file: supported extension is '.png'"; return false; } - if (boost::filesystem::extension(app_params.out_avi_file) != ".avi") { + if (boost::filesystem::path(app_params.out_avi_file).extension() != ".avi") { MV_LOG_ERROR() << "Wrong extension for provided output AVI file: supported extension is '.avi'"; return false; } diff --git a/sdk/modules/driver/cpp/src/biases.cpp b/sdk/modules/driver/cpp/src/biases.cpp index 13b1dbb90..064fa02d7 100644 --- a/sdk/modules/driver/cpp/src/biases.cpp +++ b/sdk/modules/driver/cpp/src/biases.cpp @@ -31,12 +31,12 @@ Biases::~Biases() {} void Biases::set_from_file(const std::string &biases_filename) { // Check extension - const auto extension = boost::filesystem::extension(biases_filename); - if (extension != ".bias") { + const boost::filesystem::path biases_file_path = biases_filename; + if (biases_file_path.extension() != ".bias") { throw CameraException(CameraErrorCode::WrongExtension, "For bias file '" + biases_filename + "' : expected '.bias' extension to set the bias from this file but got '." + - extension + "'"); + biases_file_path.extension().generic_string() + "'"); } // open file @@ -106,12 +106,12 @@ void Biases::set_from_file(const std::string &biases_filename) { } void Biases::save_to_file(const std::string &dest_file) const { - const auto extension = boost::filesystem::extension(dest_file); - if (extension != ".bias") { + const boost::filesystem::path biases_file_path = dest_file; + if (biases_file_path.extension() != ".bias") { throw CameraException(CameraErrorCode::WrongExtension, "For bias file '" + dest_file + "' : expected '.bias' extension to set the bias from this file but got '." + - extension + "'"); + biases_file_path.extension().generic_string() + "'"); } std::ofstream output_file(dest_file); diff --git a/sdk/modules/driver/cpp/src/camera.cpp b/sdk/modules/driver/cpp/src/camera.cpp index 871be915f..fa335a0ad 100644 --- a/sdk/modules/driver/cpp/src/camera.cpp +++ b/sdk/modules/driver/cpp/src/camera.cpp @@ -298,18 +298,18 @@ bool Camera::Private::process_impl() { } bool Camera::Private::start_recording_impl(const std::string &file_path) { - std::string ext = boost::filesystem::extension(file_path); + boost::filesystem::path path_obj(file_path); std::shared_ptr writer; - if (ext == ".raw") { + if (path_obj.extension() == ".raw") { writer = std::make_shared(file_path); - } else if (ext == ".hdf5") { + } else if (path_obj.extension() == ".hdf5") { writer = std::make_shared(file_path); } else { throw CameraException(CameraErrorCode::WrongExtension, - "Unsupported extension for the recording destination " + file_path + "."); + "Unsupported extension for the recording destination " + path_obj.string() + "."); } writer->add_metadata_map_from_camera(*pub_ptr_); - if (ext == ".raw") { + if (path_obj.extension() == ".raw") { if (!raw_data_) { throw CameraException(UnsupportedFeatureErrors::RawRecordingUnavailable, "Cannot record to a RAW file from this type of camera."); @@ -570,24 +570,25 @@ Camera Camera::from_serial(const std::string &serial, const DeviceConfig &config } Camera Camera::from_file(const std::string &file_path, const FileConfigHints &hints) { - if (boost::filesystem::extension(file_path) != "") { - if (!boost::filesystem::exists(file_path)) { + boost::filesystem::path path_obj(file_path); + if (path_obj.has_extension()) { + if (!boost::filesystem::exists(path_obj)) { throw CameraException(CameraErrorCode::FileDoesNotExist, - "Opening file at " + file_path + ": not an existing file."); + "Opening file at " + path_obj.string() + ": not an existing file."); } - if (!boost::filesystem::is_regular_file(file_path)) { + if (!boost::filesystem::is_regular_file(path_obj)) { throw CameraException(CameraErrorCode::NotARegularFile); } } - if (boost::filesystem::extension(file_path) == ".raw") { + if (path_obj.extension() == ".raw") { return Camera(new detail::OfflineRawPrivate(file_path, hints)); - } else if (boost::filesystem::extension(file_path) == ".hdf5") { + } else if (path_obj.extension() == ".hdf5") { #if defined HAS_HDF5 return Camera(new detail::OfflineGenericPrivate(file_path, hints)); #endif - } else if (boost::filesystem::extension(file_path) == ".dat" || boost::filesystem::extension(file_path) == "") { + } else if (path_obj.extension() == ".dat" || path_obj.extension() == "") { return Camera(new detail::OfflineGenericPrivate(file_path, hints)); } diff --git a/sdk/modules/driver/cpp/src/camera_live.cpp b/sdk/modules/driver/cpp/src/camera_live.cpp index ad81a75a1..ee50d25ef 100644 --- a/sdk/modules/driver/cpp/src/camera_live.cpp +++ b/sdk/modules/driver/cpp/src/camera_live.cpp @@ -206,11 +206,11 @@ bool LivePrivate::process_impl(TimingProfilerType *profiler) { } bool LivePrivate::start_recording_impl(const std::string &file_path) { - std::string base_path = boost::filesystem::change_extension(file_path, "").string(); + boost::filesystem::path path_obj(file_path); if (biases_) { - biases_->save_to_file(base_path + ".bias"); + biases_->save_to_file(path_obj.filename().string() + ".bias"); } - return Camera::Private::start_recording_impl(file_path); + return Camera::Private::start_recording_impl(path_obj.filename().string()); } void LivePrivate::save(std::ostream &os) const { diff --git a/sdk/modules/driver/cpp/src/camera_offline_generic.cpp b/sdk/modules/driver/cpp/src/camera_offline_generic.cpp index b69f52bf5..f29d8ef4b 100644 --- a/sdk/modules/driver/cpp/src/camera_offline_generic.cpp +++ b/sdk/modules/driver/cpp/src/camera_offline_generic.cpp @@ -43,7 +43,8 @@ OfflineGenericPrivate::OfflineGenericPrivate(const std::string &file_path, const Private(detail::Config()) { // clang-format off try { - if (boost::filesystem::extension(file_path) == ".hdf5") { + boost::filesystem::path path_obj(file_path); + if (path_obj.extension() == ".hdf5") { file_reader_ = std::make_unique(file_path, hints.time_shift()); } else { file_reader_ = std::make_unique(file_path); diff --git a/sdk/modules/driver/cpp/src/camera_serialization.cpp b/sdk/modules/driver/cpp/src/camera_serialization.cpp index b62e3560c..e7aa3d378 100644 --- a/sdk/modules/driver/cpp/src/camera_serialization.cpp +++ b/sdk/modules/driver/cpp/src/camera_serialization.cpp @@ -655,7 +655,11 @@ std::ostream &save_device(const Device &d, std::ostream &os) { google::protobuf::util::JsonPrintOptions options; options.add_whitespace = true; + #if (GOOGLE_PROTOBUF_VERSION >= 5026000) + options.always_print_fields_with_no_presence = true; + #else options.always_print_primitive_fields = true; + #endif options.preserve_proto_field_names = true; std::string json; diff --git a/sdk/modules/ui/cpp/include/metavision/sdk/ui/utils/opengl_api.h b/sdk/modules/ui/cpp/include/metavision/sdk/ui/utils/opengl_api.h index 200ea27bc..5b6f99741 100644 --- a/sdk/modules/ui/cpp/include/metavision/sdk/ui/utils/opengl_api.h +++ b/sdk/modules/ui/cpp/include/metavision/sdk/ui/utils/opengl_api.h @@ -14,18 +14,27 @@ #ifdef _USE_OPENGL_ES3_ #include +#elif defined(__APPLE__) && !defined(__linux__) +#define GL_SILENCE_DEPRECATION +#include +#else +#if defined(WIN32) +#include +#endif +#include +#include +#endif + +// GLFW needs to be included after OpenGL +#include + // While we keep support for OpenGL, we need to provide a // dummy implementation for Glew init function +#ifndef GLEW_OK #define GLEW_OK 0 inline int glewInit(void) { return GLEW_OK; } -#else // OpenGL -#include -#include #endif -// GLFW need to be included after OpenGL -#include - #endif // METAVISION_SDK_UI_UTILS_OPENGL_API