diff --git a/CMakeLists.txt b/CMakeLists.txt
index 82d4a36b3..6415af981 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,7 @@ endif(NOT CMAKE_BUILD_TYPE)
cmake_minimum_required(VERSION 3.5)
-project(metavision VERSION 4.5.1)
+project(metavision VERSION 4.5.2)
set(PROJECT_VERSION_SUFFIX "")
if(PROJECT_VERSION_SUFFIX STREQUAL "")
@@ -62,10 +62,10 @@ set(GENERATE_FILES_DIRECTORY ${CMAKE_BINARY_DIR}/generated)
file(MAKE_DIRECTORY ${GENERATE_FILES_DIRECTORY})
# Update CMAKE_MODULE_PATH
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) # For find_packages()
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/custom_functions) # For defining custom cmake functions
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/custom_targets) # For defining custom cmake targets
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/cpack) # For cpack
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules) # For find_packages()
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/custom_functions) # For defining custom cmake functions
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/custom_targets) # For defining custom cmake targets
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/cpack) # For cpack
include(CMakeDependentOption)
include(overridden_cmake_functions)
@@ -102,6 +102,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF )
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+include(CheckLanguage)
+check_language(CUDA)
+if (CMAKE_CUDA_COMPILER)
+ enable_language(CUDA)
+endif (CMAKE_CUDA_COMPILER)
+
################################################### Platform specific
if (MSVC)
@@ -364,7 +370,7 @@ include(add_library_version_header)
include(add_cpack_component)
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/cmake/custom_targets_metavision_sdk")
- list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/custom_targets_metavision_sdk)
+ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/custom_targets_metavision_sdk)
include(create_metavision_sdk_source_archives)
endif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/cmake/custom_targets_metavision_sdk")
diff --git a/README.md b/README.md
index 4b6b63207..b03a2a282 100644
--- a/README.md
+++ b/README.md
@@ -120,9 +120,9 @@ Make sure that you install a version of CUDA that is compatible with your GPUs b
Note that, at the moment, we don't support [OpenCL](https://www.khronos.org/opencl/) and AMD GPUs.
-Then, you will need to install [PyTorch 1.13.1](https://pytorch.org/get-started/locally/).
-Retrieve and execute the pip command from the installation guide.
-If the latest Pytorch version doesn't match, please consider looking into the [previous versions section]().
+Then, you need to install [PyTorch 1.13.1](https://pytorch.org).
+Retrieve and execute the pip command of version 1.13.1 from
+the [previous versions install guide section]().
Then install some extra Python libraries:
@@ -133,7 +133,7 @@ python3 -m pip install "numba==0.56.3" "profilehooks==1.12.0" "pytorch_lightning
### Compilation
- 1. Retrieve the code: `git clone https://github.com/prophesee-ai/openeb.git --branch 4.5.1`.
+ 1. Retrieve the code: `git clone https://github.com/prophesee-ai/openeb.git --branch 4.5.2`.
(If you choose to download an archive of OpenEB from GitHub rather than cloning the repository,
you need to ensure that you select a ``Full.Source.Code.*`` archive instead of using
the automatically generated ``Source.Code.*`` archives. This is because the latter do not include
@@ -255,8 +255,6 @@ To compile OpenEB, you will need to install some extra tools:
* `cd `
* `bootstrap-vcpkg.bat`
* install the libraries by running `vcpkg.exe install --triplet x64-windows libusb boost opencv dirent gtest glew glfw3 hdf5[cpp,threadsafe,tools,zlib]`
- * Note that to avoid using `--triplet x64-windows`, which informs vcpkg to install packages for a x64-windows target,
- you can run `setx VCPKG_DEFAULT_TRIPLET x64-windows` (you need to close the command line and re-open it to ensure that this variable is set)
* Finally, download and install [ffmpeg](https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z) and add the `bin` directory to your PATH.
Note that if you are using vcpkg for various projects or multiple versions of OpenEB, you might want to optimize the
@@ -310,9 +308,9 @@ To use Machine Learning features, you need to install some additional dependenci
First, if you have some Nvidia hardware with GPUs, you can optionally install [CUDA (11.6 or 11.7)](https://developer.nvidia.com/cuda-downloads)
and [cuDNN](https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html) to leverage them with pytorch and libtorch.
-Then, you will need to install [PyTorch 1.13.1](https://pytorch.org/get-started/locally/).
-Retrieve and execute the pip command from the installation guide.
-If the latest Pytorch version doesn't match, please consider looking into the [previous versions section]().
+Then, you need to install [PyTorch 1.13.1](https://pytorch.org).
+Retrieve and execute the pip command of version 1.13.1 from
+the [previous versions install guide section]().
Then install some extra Python libraries:
@@ -325,7 +323,7 @@ python -m pip install "numba==0.56.3" "profilehooks==1.12.0" "pytorch_lightning=
First, retrieve the codebase:
```bash
-git clone https://github.com/prophesee-ai/openeb.git --branch 4.5.1
+git clone https://github.com/prophesee-ai/openeb.git --branch 4.5.2
```
Note that if you choose to download an archive of OpenEB from GitHub rather than cloning the repository,
@@ -339,7 +337,7 @@ a necessary submodule.
Open a command prompt inside the `openeb` folder (absolute path to this directory is called `OPENEB_SRC_DIR` in next sections) and do as follows:
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= ..`.
+ 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.
3. Compile: `cmake --build . --config Release --parallel 4`
@@ -357,42 +355,50 @@ or you can deploy the OpenEB files (applications, samples, libraries etc.) in a
* Option 2 - deploying in a directory of your choice
- * To deploy OpenEB, configure the target folder (`OPENEB_INSTALL_DIR`) with `CMAKE_INSTALL_PREFIX` variable
- and the directory where the Python packages will be deployed (`PYTHON3_PACKAGES_INSTALL_DIR`) using the `PYTHON3_SITE_PACKAGES` variable
- when generating the solution in step 2:
+ * To deploy SDK Pro in the default folder (`C:\Program Files\Prophesee`), execute this command
+ (your console should be launched as an administrator):
+ ```bash
+ cmake --build . --config Release --target install
+ ```
+
+ * To deploy OpenEB in another folder, you should generate the solution again (step 2 above)
+ with the additional variable `CMAKE_INSTALL_PREFIX` having the value of your target folder (`OPENEB_INSTALL_DIR`).
+
+ Similarly, to specify where the Python packages will be deployed (``PYTHON3_PACKAGES_INSTALL_DIR``), you should use
+ 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 ..
+ cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DPYTHON3_SITE_PACKAGES= -DBUILD_TESTING=OFF
```
- * You can now launch the actual compilation and installation of the OpenEB files (your console should be launched as an administrator) :
+ After this command, you should launch the actual compilation and installation of OpenEB
+ (your console should be launched as an administrator):
```bash
cmake --build . --config Release --parallel 4
cmake --build . --config Release --target install
```
-
- * You also need to edit the `PATH`, `HDF5_PLUGIN_PATH` and `PYTHONPATH` environment variables:
- * append `\bin` to the `PATH`
- * append `\lib\hdf5\plugin` to the `HDF5_PLUGIN_PATH`
- * append `` to the `PYTHONPATH`
-
- * If you did not customize the install folders when generating the solution, the `PYTHONPATH` environment variable needs
- not be modified and the `OPENEB_INSTALL_DIR` can be replaced by `C:\Program Files\Prophesee` in the previous instructions.
+ * You also need to manually edit some environment variables:
+ * append `\bin` to `PATH` (`C:\Program Files\Prophesee\bin` if you used default configuration)
+ * 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
Open a command prompt inside the `openeb` folder (absolute path to this directory is called `OPENEB_SRC_DIR` in next sections) and do as follows:
1. Create and open the build directory, where temporary files will be created: `mkdir build && cd build`
- 2. Generate the Visual Studio files using CMake: `cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= ..` (adapt to your Visual Studio version).
+ 2. Generate the Visual Studio files using CMake: `cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=` (adapt to your Visual Studio version).
Note that the value passed to the parameter `-DCMAKE_TOOLCHAIN_FILE` must be an absolute path, not a relative one.
3. Open the solution file `metavision.sln`, select the `Release` configuration and build the `ALL_BUILD` project.
-
-
Once the compilation is done, 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.
@@ -417,11 +423,13 @@ for the cameras to be available on Windows. To do so, follow this procedure:
```bash
wdi-simple.exe -n "EVK" -m "Prophesee" -v 0x04b4 -p 0x00f4
-wdi-simple.exe -n "EVK" -m "Prophesee" -v 0x03fd -p 0x5832 -i 00
wdi-simple.exe -n "EVK" -m "Prophesee" -v 0x04b4 -p 0x00f5
wdi-simple.exe -n "EVK" -m "Prophesee" -v 0x04b4 -p 0x00f3
```
+If you own an EVK2 or an RDK2, there are a few additional steps to complete that are detailed in our online documentation
+in the [Camera Plugin section of the OpenEB install guide](https://docs.prophesee.ai/stable/installation/windows_openeb.html#camera-plugins).
+
If you are using a third-party camera, you need to follow the instructions provided by the camera vendor
to install the driver and the camera plugin. Make sure that you reference the location of the plugin in
the `MV_HAL_PLUGIN_PATH` environment variable.
@@ -453,18 +461,16 @@ Running the test suite is a sure-fire way to ensure you did everything well with
```
cd /build
- cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DBUILD_TESTING=ON ..
+ cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DBUILD_TESTING=ON
```
2. Compile: `cmake --build . --config Release --parallel 4`
* Compilation using MS Visual Studio
- 1. Generate the Visual Studio files using CMake (adapt the command to your Visual Studio version):
-
- `cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DBUILD_TESTING=ON ..`
+ 1. Generate the Visual Studio files using CMake (adapt the command to your Visual Studio version and note that `-DCMAKE_TOOLCHAIN_FILE` must be 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.
+ `cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DBUILD_TESTING=ON`
2. Open the solution file `metavision.sln`, select the `Release` configuration and build the `ALL_BUILD` project.
diff --git a/cmake/custom_functions/add_library_version_header.cmake b/cmake/custom_functions/add_library_version_header.cmake
index c1ab23316..9faa30bde 100644
--- a/cmake/custom_functions/add_library_version_header.cmake
+++ b/cmake/custom_functions/add_library_version_header.cmake
@@ -8,8 +8,8 @@
# See the License for the specific language governing permissions and limitations under the License.
set(GIT_BRANCH "main")
-set(GIT_COMMIT_ID "9ec4e835e1cfd4f3bc94b8b390ad5894a4ac0d42")
-set(GIT_COMMIT_DATE "2023-12-21 09:14:06 +0100")
+set(GIT_COMMIT_ID "330aa64e328a2343c85c251e6f483b9c58de7a62")
+set(GIT_COMMIT_DATE "2024-02-09 11:47:53 +0100")
find_program(GIT_SCM git DOC "Git version control" HINTS "C:\\Program Files\\Git\\bin\\")
diff --git a/cmake/custom_functions/lfs_download.cmake b/cmake/custom_functions/lfs_download.cmake
index a07e216c0..004b4b0f5 100644
--- a/cmake/custom_functions/lfs_download.cmake
+++ b/cmake/custom_functions/lfs_download.cmake
@@ -40,7 +40,7 @@ function(lfs_download)
while (NOT success AND retries GREATER 0)
execute_process(
COMMAND git lfs pull --include "${file_or_dir_to_download_comma_separated}"
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE OUTPUT
ERROR_VARIABLE ERROR
RESULT_VARIABLE RESULT
diff --git a/cmake/custom_functions/overridden_cmake_functions.cmake b/cmake/custom_functions/overridden_cmake_functions.cmake
index 6f61e3a46..49cd9eddd 100644
--- a/cmake/custom_functions/overridden_cmake_functions.cmake
+++ b/cmake/custom_functions/overridden_cmake_functions.cmake
@@ -271,10 +271,21 @@ if (WIN32)
# forwards the call to the vcpkg version (which will eventually call the cmake original one)
add_library_vcpkg(${ARGN})
if (NOT LIB_ARGS_OBJECT AND NOT LIB_ARGS_IMPORTED AND NOT LIB_ARGS_ALIAS)
- # if we are builing a DLL, let's add a resources.rc to embed some details (version, etc.)
+ # If we are building a DLL, let's add a resources.rc to embed some details (version, etc.).
+ # To allow Metavision to be used as a submodule, we need to use the PROJECT_SOURCE_DIR variable to indicate
+ # the path to the template of this resource file.
+ # However, the value of this variable will change when this function is used inside Metavision's internal
+ # submodules (e.g. hdf5). To workaround this problem, we make the assumption that this function won't be
+ # called first by Metavision's internal submodules and we initialize this variable in a cache the first time
+ # it is executed.
+ if(NOT DEFINED RESOURCES_FILE_TEMPLATE_PATH)
+ set(RESOURCES_FILE_TEMPLATE_PATH ${PROJECT_SOURCE_DIR}/utils/windows/resources.rc.in CACHE STRING
+ "Path to the template of DLLs' resource file")
+ endif ()
+
set (rc_file_path ${GENERATE_FILES_DIRECTORY}/resources/resources.${ARGV0}.rc)
set (dll_filename "${ARGV0}")
- configure_file(${CMAKE_SOURCE_DIR}/utils/windows/resources.rc.in ${rc_file_path})
+ configure_file(${RESOURCES_FILE_TEMPLATE_PATH} ${rc_file_path})
target_sources(${ARGV0} PRIVATE ${rc_file_path})
endif ()
endfunction ()
diff --git a/cmake/custom_targets/README_metavision_open.md b/cmake/custom_targets/README_metavision_open.md
index 4b6b63207..b03a2a282 100644
--- a/cmake/custom_targets/README_metavision_open.md
+++ b/cmake/custom_targets/README_metavision_open.md
@@ -120,9 +120,9 @@ Make sure that you install a version of CUDA that is compatible with your GPUs b
Note that, at the moment, we don't support [OpenCL](https://www.khronos.org/opencl/) and AMD GPUs.
-Then, you will need to install [PyTorch 1.13.1](https://pytorch.org/get-started/locally/).
-Retrieve and execute the pip command from the installation guide.
-If the latest Pytorch version doesn't match, please consider looking into the [previous versions section]().
+Then, you need to install [PyTorch 1.13.1](https://pytorch.org).
+Retrieve and execute the pip command of version 1.13.1 from
+the [previous versions install guide section]().
Then install some extra Python libraries:
@@ -133,7 +133,7 @@ python3 -m pip install "numba==0.56.3" "profilehooks==1.12.0" "pytorch_lightning
### Compilation
- 1. Retrieve the code: `git clone https://github.com/prophesee-ai/openeb.git --branch 4.5.1`.
+ 1. Retrieve the code: `git clone https://github.com/prophesee-ai/openeb.git --branch 4.5.2`.
(If you choose to download an archive of OpenEB from GitHub rather than cloning the repository,
you need to ensure that you select a ``Full.Source.Code.*`` archive instead of using
the automatically generated ``Source.Code.*`` archives. This is because the latter do not include
@@ -255,8 +255,6 @@ To compile OpenEB, you will need to install some extra tools:
* `cd `
* `bootstrap-vcpkg.bat`
* install the libraries by running `vcpkg.exe install --triplet x64-windows libusb boost opencv dirent gtest glew glfw3 hdf5[cpp,threadsafe,tools,zlib]`
- * Note that to avoid using `--triplet x64-windows`, which informs vcpkg to install packages for a x64-windows target,
- you can run `setx VCPKG_DEFAULT_TRIPLET x64-windows` (you need to close the command line and re-open it to ensure that this variable is set)
* Finally, download and install [ffmpeg](https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z) and add the `bin` directory to your PATH.
Note that if you are using vcpkg for various projects or multiple versions of OpenEB, you might want to optimize the
@@ -310,9 +308,9 @@ To use Machine Learning features, you need to install some additional dependenci
First, if you have some Nvidia hardware with GPUs, you can optionally install [CUDA (11.6 or 11.7)](https://developer.nvidia.com/cuda-downloads)
and [cuDNN](https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html) to leverage them with pytorch and libtorch.
-Then, you will need to install [PyTorch 1.13.1](https://pytorch.org/get-started/locally/).
-Retrieve and execute the pip command from the installation guide.
-If the latest Pytorch version doesn't match, please consider looking into the [previous versions section]().
+Then, you need to install [PyTorch 1.13.1](https://pytorch.org).
+Retrieve and execute the pip command of version 1.13.1 from
+the [previous versions install guide section]().
Then install some extra Python libraries:
@@ -325,7 +323,7 @@ python -m pip install "numba==0.56.3" "profilehooks==1.12.0" "pytorch_lightning=
First, retrieve the codebase:
```bash
-git clone https://github.com/prophesee-ai/openeb.git --branch 4.5.1
+git clone https://github.com/prophesee-ai/openeb.git --branch 4.5.2
```
Note that if you choose to download an archive of OpenEB from GitHub rather than cloning the repository,
@@ -339,7 +337,7 @@ a necessary submodule.
Open a command prompt inside the `openeb` folder (absolute path to this directory is called `OPENEB_SRC_DIR` in next sections) and do as follows:
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= ..`.
+ 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.
3. Compile: `cmake --build . --config Release --parallel 4`
@@ -357,42 +355,50 @@ or you can deploy the OpenEB files (applications, samples, libraries etc.) in a
* Option 2 - deploying in a directory of your choice
- * To deploy OpenEB, configure the target folder (`OPENEB_INSTALL_DIR`) with `CMAKE_INSTALL_PREFIX` variable
- and the directory where the Python packages will be deployed (`PYTHON3_PACKAGES_INSTALL_DIR`) using the `PYTHON3_SITE_PACKAGES` variable
- when generating the solution in step 2:
+ * To deploy SDK Pro in the default folder (`C:\Program Files\Prophesee`), execute this command
+ (your console should be launched as an administrator):
+ ```bash
+ cmake --build . --config Release --target install
+ ```
+
+ * To deploy OpenEB in another folder, you should generate the solution again (step 2 above)
+ with the additional variable `CMAKE_INSTALL_PREFIX` having the value of your target folder (`OPENEB_INSTALL_DIR`).
+
+ Similarly, to specify where the Python packages will be deployed (``PYTHON3_PACKAGES_INSTALL_DIR``), you should use
+ 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 ..
+ cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DCMAKE_INSTALL_PREFIX= -DPYTHON3_SITE_PACKAGES= -DBUILD_TESTING=OFF
```
- * You can now launch the actual compilation and installation of the OpenEB files (your console should be launched as an administrator) :
+ After this command, you should launch the actual compilation and installation of OpenEB
+ (your console should be launched as an administrator):
```bash
cmake --build . --config Release --parallel 4
cmake --build . --config Release --target install
```
-
- * You also need to edit the `PATH`, `HDF5_PLUGIN_PATH` and `PYTHONPATH` environment variables:
- * append `\bin` to the `PATH`
- * append `\lib\hdf5\plugin` to the `HDF5_PLUGIN_PATH`
- * append `` to the `PYTHONPATH`
-
- * If you did not customize the install folders when generating the solution, the `PYTHONPATH` environment variable needs
- not be modified and the `OPENEB_INSTALL_DIR` can be replaced by `C:\Program Files\Prophesee` in the previous instructions.
+ * You also need to manually edit some environment variables:
+ * append `\bin` to `PATH` (`C:\Program Files\Prophesee\bin` if you used default configuration)
+ * 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
Open a command prompt inside the `openeb` folder (absolute path to this directory is called `OPENEB_SRC_DIR` in next sections) and do as follows:
1. Create and open the build directory, where temporary files will be created: `mkdir build && cd build`
- 2. Generate the Visual Studio files using CMake: `cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= ..` (adapt to your Visual Studio version).
+ 2. Generate the Visual Studio files using CMake: `cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY=` (adapt to your Visual Studio version).
Note that the value passed to the parameter `-DCMAKE_TOOLCHAIN_FILE` must be an absolute path, not a relative one.
3. Open the solution file `metavision.sln`, select the `Release` configuration and build the `ALL_BUILD` project.
-
-
Once the compilation is done, 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.
@@ -417,11 +423,13 @@ for the cameras to be available on Windows. To do so, follow this procedure:
```bash
wdi-simple.exe -n "EVK" -m "Prophesee" -v 0x04b4 -p 0x00f4
-wdi-simple.exe -n "EVK" -m "Prophesee" -v 0x03fd -p 0x5832 -i 00
wdi-simple.exe -n "EVK" -m "Prophesee" -v 0x04b4 -p 0x00f5
wdi-simple.exe -n "EVK" -m "Prophesee" -v 0x04b4 -p 0x00f3
```
+If you own an EVK2 or an RDK2, there are a few additional steps to complete that are detailed in our online documentation
+in the [Camera Plugin section of the OpenEB install guide](https://docs.prophesee.ai/stable/installation/windows_openeb.html#camera-plugins).
+
If you are using a third-party camera, you need to follow the instructions provided by the camera vendor
to install the driver and the camera plugin. Make sure that you reference the location of the plugin in
the `MV_HAL_PLUGIN_PATH` environment variable.
@@ -453,18 +461,16 @@ Running the test suite is a sure-fire way to ensure you did everything well with
```
cd /build
- cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DBUILD_TESTING=ON ..
+ cmake .. -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DBUILD_TESTING=ON
```
2. Compile: `cmake --build . --config Release --parallel 4`
* Compilation using MS Visual Studio
- 1. Generate the Visual Studio files using CMake (adapt the command to your Visual Studio version):
-
- `cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DBUILD_TESTING=ON ..`
+ 1. Generate the Visual Studio files using CMake (adapt the command to your Visual Studio version and note that `-DCMAKE_TOOLCHAIN_FILE` must be 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.
+ `cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=\cmake\toolchains\vcpkg.cmake -DVCPKG_DIRECTORY= -DBUILD_TESTING=ON`
2. Open the solution file `metavision.sln`, select the `Release` configuration and build the `ALL_BUILD` project.
diff --git a/cmake/custom_targets/cmake_uninstall.cmake.in b/cmake/custom_targets/cmake_uninstall.cmake.in
index 12e6b04e5..047f8da64 100644
--- a/cmake/custom_targets/cmake_uninstall.cmake.in
+++ b/cmake/custom_targets/cmake_uninstall.cmake.in
@@ -7,11 +7,11 @@
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
-if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
- message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
-endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
+ message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
+endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
-file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
list(REVERSE files)
foreach (file ${files})
diff --git a/cmake/custom_targets/create_metavision_open_archive_folder.cmake b/cmake/custom_targets/create_metavision_open_archive_folder.cmake
index b8f9aba32..e556a606f 100644
--- a/cmake/custom_targets/create_metavision_open_archive_folder.cmake
+++ b/cmake/custom_targets/create_metavision_open_archive_folder.cmake
@@ -35,7 +35,7 @@ list(APPEND HAL_OPEN_PLUGIN_FILES ${HAL_OPEN_PLUGIN_INCLUDES} ${HAL_OPEN_PLUGIN_
list_transform_prepend (HAL_OPEN_PLUGIN_FILES hal_psee_plugins/)
# Add the files and folders needed to compile open :
-foreach (file_or_dir CMakeLists.txt licensing/LICENSE_OPEN .gitignore conftest.py pytest.ini cmake standalone_samples hal ${HAL_OPEN_PLUGIN_FILES} utils/python/metavision_utils utils/cpp utils/scripts utils/windows/resources.rc.in utils/CMakeLists.txt sdk/cmake sdk/CMakeLists.txt sdk/modules/CMakeLists.txt)
+foreach (file_or_dir CMakeLists.txt licensing/LICENSE_OPEN .gitignore conftest.py pytest.ini cmake standalone_samples hal ${HAL_OPEN_PLUGIN_FILES} utils/python/metavision_utils utils/cpp utils/scripts utils/windows/resources.rc.in utils/windows/vcpkg-openeb.json utils/CMakeLists.txt sdk/cmake sdk/CMakeLists.txt sdk/modules/CMakeLists.txt)
if (EXISTS "${PROJECT_SOURCE_DIR}/${file_or_dir}")
get_filename_component(dest "${OUTPUT_DIR}/${file_or_dir}" DIRECTORY)
file(COPY "${PROJECT_SOURCE_DIR}/${file_or_dir}"
@@ -53,6 +53,14 @@ file(COPY "${PROJECT_SOURCE_DIR}/utils/github_actions/openeb/mergify.yml"
DESTINATION "${OUTPUT_DIR}/.github"
)
+file(COPY "${PROJECT_SOURCE_DIR}/utils/jenkins/windows/vcpkg.json"
+ DESTINATION "${OUTPUT_DIR}/utils/windows"
+)
+
+file(COPY "${PROJECT_SOURCE_DIR}/utils/jenkins/containers/Dockerfile.OpenEB"
+ DESTINATION "${OUTPUT_DIR}/utils/containers"
+)
+
# Remove SDK targets
file(REMOVE_RECURSE "${OUTPUT_DIR}/cmake/custom_targets_metavision_sdk")
file(REMOVE "${OUTPUT_DIR}/cmake/custom_functions/create_addon_module_archive_folder.cmake")
diff --git a/cmake/custom_targets/uninstall.cmake b/cmake/custom_targets/uninstall.cmake
index ec4b2c581..c3a263b66 100644
--- a/cmake/custom_targets/uninstall.cmake
+++ b/cmake/custom_targets/uninstall.cmake
@@ -7,11 +7,13 @@
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
-# Define uninstall target
-configure_file(
- "${CMAKE_CURRENT_LIST_DIR}/cmake_uninstall.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
- IMMEDIATE @ONLY)
+if (NOT TARGET uninstall)
+ # Define uninstall target
+ configure_file(
+ "${CMAKE_CURRENT_LIST_DIR}/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
-add_custom_target(uninstall
- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
+ add_custom_target(uninstall
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
+endif ()
diff --git a/hal/cpp/samples/metavision_hal_sample_plugin/test/hal_sample_plugin_gtest.cpp b/hal/cpp/samples/metavision_hal_sample_plugin/test/hal_sample_plugin_gtest.cpp
index 784930484..69d1a35a5 100644
--- a/hal/cpp/samples/metavision_hal_sample_plugin/test/hal_sample_plugin_gtest.cpp
+++ b/hal/cpp/samples/metavision_hal_sample_plugin/test/hal_sample_plugin_gtest.cpp
@@ -167,7 +167,6 @@ TEST_F(HalSamplePlugin_GTest, record_and_read_back) {
});
i_events_stream->start();
short ret = i_events_stream->wait_next_buffer();
- long n_bytes(0);
while (ret > 0) { // To be sure to record something
auto raw_data = i_events_stream->get_latest_raw_data();
i_eventsstreamdecoder->decode(raw_data->data(), raw_data->data() + raw_data->size());
diff --git a/hal/cpp/samples/metavision_hal_showcase/metavision_hal_showcase.cpp b/hal/cpp/samples/metavision_hal_showcase/metavision_hal_showcase.cpp
index 854b3a384..72f2f0a44 100644
--- a/hal/cpp/samples/metavision_hal_showcase/metavision_hal_showcase.cpp
+++ b/hal/cpp/samples/metavision_hal_showcase/metavision_hal_showcase.cpp
@@ -301,7 +301,7 @@ int main(int argc, char *argv[]) {
auto crop = tokenize(crop_region_coord, ",");
if (crop.size() < 4) {
throw std::runtime_error{
- "Failed to parse Crop Region coords (,,,[,])"};
+ "Failed to parse Crop Region coordinates (,,,[,])"};
}
bool reset_orig = crop.size() == 5 ? crop[4] : false;
digital_crop->set_window_region({crop[0], crop[1], crop[2], crop[3]}, reset_orig);
@@ -363,7 +363,9 @@ int main(int argc, char *argv[]) {
auto raw_data = i_eventsstream->get_latest_raw_data();
// This will trigger callbacks set on decoders: in our case EventAnalyzer.process_events
- i_eventsstreamdecoder->decode(raw_data->data(), raw_data->data() + raw_data->size());
+ if (raw_data) {
+ i_eventsstreamdecoder->decode(raw_data->data(), raw_data->data() + raw_data->size());
+ }
/// [buffer]
}
});
diff --git a/hal/cpp/src/facilities/i_events_stream.cpp b/hal/cpp/src/facilities/i_events_stream.cpp
index 8a1aaeae7..077f0310e 100644
--- a/hal/cpp/src/facilities/i_events_stream.cpp
+++ b/hal/cpp/src/facilities/i_events_stream.cpp
@@ -134,7 +134,7 @@ bool check_magic_number_presence(std::ifstream &input_index_file) {
const auto start_pos = input_index_file.tellg();
// Seek to last bookmark pos
input_index_file.clear();
- if (!input_index_file.seekg(-BookmarkPackedSize, std::ios::end)) {
+ if (!input_index_file.seekg(-static_cast(BookmarkPackedSize), std::ios::end)) {
return false;
}
diff --git a/hal/cpp/src/utils/resources_folder.cpp b/hal/cpp/src/utils/resources_folder.cpp
index 328d8a073..5253a255d 100644
--- a/hal/cpp/src/utils/resources_folder.cpp
+++ b/hal/cpp/src/utils/resources_folder.cpp
@@ -30,7 +30,6 @@ std::string read_registry_subkey_hklm(LPCSTR subkey, LPCSTR registry_value_name)
std::string result("");
HKEY hKeyExt;
- DWORD dwDisposition;
long ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, subkey, 0, KEY_QUERY_VALUE, &hKeyExt);
if (ret == ERROR_SUCCESS) {
diff --git a/hal/python/tests/CMakeLists.txt b/hal/python/tests/CMakeLists.txt
index 0c778b96c..ad59ebf8a 100644
--- a/hal/python/tests/CMakeLists.txt
+++ b/hal/python/tests/CMakeLists.txt
@@ -11,7 +11,7 @@ get_pybind_pythonpath(PYTHON3_PYTHON_PATH)
add_pytest(NAME metavision-hal-python-bindings-test
PATH ${CMAKE_CURRENT_SOURCE_DIR}
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
HAL_PLUGIN_PATH "${PROJECT_BINARY_DIR}/hal/cpp/test/plugins"
PYTHONPATH ${PYTHON3_PYTHON_PATH}
)
diff --git a/hal_psee_plugins/include/devices/genx320/genx320mp_cx3_issd.h b/hal_psee_plugins/include/devices/genx320/genx320mp_cx3_issd.h
index 8027e9128..4484ea050 100644
--- a/hal_psee_plugins/include/devices/genx320/genx320mp_cx3_issd.h
+++ b/hal_psee_plugins/include/devices/genx320/genx320mp_cx3_issd.h
@@ -8,20 +8,20 @@
**********************************************************************************************************************/
// ISSD sequences generated by psee_issd_convert.
-/* Manually edited */
// Parameters:
-// issd_csv_format_version=1.0
-// system=evk3_genx320_cd
+// issd_csv_format_version=1.1
+// system=PseeEvk3GenX320
// operator=Prophesee
// dry_run=False
// no_system=False
// strip_prefix=False
// sensor_version=None
// args=-s evk3_genx320_cd
-// sensor=PseeEvk3GenX320
-// date=2023-11-23T16:23:11
-// psee_issd_version=1.3.0.311+ga31704ae2.d20230011
-// psee_sensor_lib_version=1.3.0.311+ga31704ae2.d20230011
+// sensor=GenX320Sensor
+// date=2024-01-29T17:38:04
+// issd_trace_recoder_version=0.0.1.dev2+g633913d82.d20240126
+// psee_sensor_lib_version=3.5.1.109+gda565e888.d20240024
+// psee_biases_genx320_version=2.0.0
// issd_data_format_version=1.0
#include
@@ -38,13 +38,13 @@ const std::vector issd_genx320mp_cx3_init = {
RegisterOperation::Write(0x0000F004, 0x00000000),
RegisterOperation::Delay(10000),
// RegisterOperation::Read(0x0000F010, 0xCAFEBABE, 0xFFFFFFFF),
- RegisterOperation::Write(0x0000F010, 0x00001000),
- RegisterOperation::Write(0x0000F008, 0x10000000),
- RegisterOperation::Write(0x0000F010, 0x00000000),
- RegisterOperation::Write(0x0000F008, 0x10000001),
- RegisterOperation::Write(0x0000F010, 0x00002710),
- RegisterOperation::Write(0x0000F008, 0x10000002),
- RegisterOperation::Write(0x0000F008, 0xC31057D4),
+ RegisterOperation::Write(0x0000B010, 0x00000000),
+ RegisterOperation::Write(0x0000B000, 0x1000C003),
+ RegisterOperation::Write(0x0000704C, 0x00002710),
+ RegisterOperation::Write(0x00007100, 0x0000FFFF),
+ RegisterOperation::Write(0x000000B8, 0x00000020),
+ RegisterOperation::Write(0x000000C0, 0x000000B8),
+ RegisterOperation::Write(0x0000B000, 0x1000C003),
RegisterOperation::Write(0x0000B000, 0x10008803),
RegisterOperation::Write(0x0000B024, 0x80003E80),
RegisterOperation::Write(0x00001208, 0x00000030),
@@ -54,12 +54,12 @@ const std::vector issd_genx320mp_cx3_init = {
RegisterOperation::Write(0x0000110C, 0x01010015),
RegisterOperation::Write(0x00001130, 0x01010014),
RegisterOperation::Write(0x00001000, 0x0301003D),
- RegisterOperation::Write(0x00001004, 0x0301001D),
+ RegisterOperation::Write(0x00001004, 0x03010022),
RegisterOperation::Write(0x00001008, 0x0101003F),
- RegisterOperation::Write(0x00001100, 0x03010000),
+ RegisterOperation::Write(0x00001100, 0x03010028),
RegisterOperation::Write(0x00001104, 0x01010019),
RegisterOperation::Write(0x00001108, 0x01010033),
- RegisterOperation::Write(0x0000110C, 0x01010015),
+ RegisterOperation::Write(0x0000110C, 0x0101001C),
RegisterOperation::Write(0x00001110, 0x01010039),
RegisterOperation::Write(0x00001114, 0x0309000A),
RegisterOperation::Write(0x00001118, 0x03010038),
diff --git a/hal_psee_plugins/psee_hw_layer_headers/include/metavision/psee_hw_layer/boards/utils/psee_libusb_data_transfer.h b/hal_psee_plugins/psee_hw_layer_headers/include/metavision/psee_hw_layer/boards/utils/psee_libusb_data_transfer.h
index b66455954..a1be532fa 100644
--- a/hal_psee_plugins/psee_hw_layer_headers/include/metavision/psee_hw_layer/boards/utils/psee_libusb_data_transfer.h
+++ b/hal_psee_plugins/psee_hw_layer_headers/include/metavision/psee_hw_layer/boards/utils/psee_libusb_data_transfer.h
@@ -50,9 +50,9 @@ class PseeLibUSBDataTransfer : public Metavision::DataTransfer {
std::atomic active_bulks_transfers_{0};
// USB Commands
- libusb_transfer *contruct_async_bulk_transfer(unsigned char *buf, int packet_size,
- libusb_transfer_cb_fn async_bulk_cb, void *user_data,
- unsigned int timeout);
+ libusb_transfer *construct_async_bulk_transfer(unsigned char *buf, int packet_size,
+ libusb_transfer_cb_fn async_bulk_cb, void *user_data,
+ unsigned int timeout);
static void free_async_bulk_transfer(libusb_transfer *transfer);
static int submit_transfer(libusb_transfer *transfer);
void prepare_async_bulk_transfer(libusb_transfer *transfer, unsigned char *buf, int packet_size,
diff --git a/hal_psee_plugins/resources/biases/genx320mp_CD_standard.bias b/hal_psee_plugins/resources/biases/genx320mp_CD_standard.bias
index c6053ef81..037c6e31d 100644
--- a/hal_psee_plugins/resources/biases/genx320mp_CD_standard.bias
+++ b/hal_psee_plugins/resources/biases/genx320mp_CD_standard.bias
@@ -1,6 +1,6 @@
-29 % bias_fo
-0 % bias_hpf
+34 % bias_fo
+40 % bias_hpf
25 % bias_diff_on
-21 % bias_diff_off
+28 % bias_diff_off
51 % bias_diff
10 % bias_refr
\ No newline at end of file
diff --git a/hal_psee_plugins/src/boards/rawfile/psee_raw_file_header.cpp b/hal_psee_plugins/src/boards/rawfile/psee_raw_file_header.cpp
index 567fd152c..2dc18980a 100644
--- a/hal_psee_plugins/src/boards/rawfile/psee_raw_file_header.cpp
+++ b/hal_psee_plugins/src/boards/rawfile/psee_raw_file_header.cpp
@@ -119,7 +119,7 @@ I_HW_Identification::SensorInfo PseeRawFileHeader::get_sensor_info() const {
sensor_info.major_version_ = std::stoi(str);
std::getline(sensor, str, '.');
sensor_info.minor_version_ = std::stoi(str);
- } catch (std::exception &e) {}
+ } catch (const std::exception &) {}
sensor_info.name_ = get_field(sensor_name_key);
if (sensor_info.name_.empty()) {
diff --git a/hal_psee_plugins/src/boards/utils/psee_libusb_data_transfer.cpp b/hal_psee_plugins/src/boards/utils/psee_libusb_data_transfer.cpp
index 28241e522..feb45f375 100644
--- a/hal_psee_plugins/src/boards/utils/psee_libusb_data_transfer.cpp
+++ b/hal_psee_plugins/src/boards/utils/psee_libusb_data_transfer.cpp
@@ -155,8 +155,8 @@ PseeLibUSBDataTransfer::UserParamForAsyncBulkCallback::UserParamForAsyncBulkCall
const std::shared_ptr &dev, PseeLibUSBDataTransfer &libusb_data_transfer) :
dev_(dev), libusb_data_transfer_(libusb_data_transfer) {
buf_ = libusb_data_transfer.get_buffer();
- transfer_ = libusb_data_transfer.contruct_async_bulk_transfer(buf_->data(), libusb_data_transfer.packet_size_,
- async_bulk_cb, this, timeout_);
+ transfer_ = libusb_data_transfer.construct_async_bulk_transfer(buf_->data(), libusb_data_transfer.packet_size_,
+ async_bulk_cb, this, timeout_);
}
PseeLibUSBDataTransfer::UserParamForAsyncBulkCallback::~UserParamForAsyncBulkCallback() {
@@ -273,9 +273,9 @@ void PseeLibUSBDataTransfer::prepare_async_bulk_transfer(libusb_transfer *transf
transfer->flags &= ~LIBUSB_TRANSFER_FREE_TRANSFER;
}
-libusb_transfer *PseeLibUSBDataTransfer::contruct_async_bulk_transfer(unsigned char *buf, int packet_size,
- libusb_transfer_cb_fn async_bulk_cb,
- void *user_data, unsigned int timeout) {
+libusb_transfer *PseeLibUSBDataTransfer::construct_async_bulk_transfer(unsigned char *buf, int packet_size,
+ libusb_transfer_cb_fn async_bulk_cb,
+ void *user_data, unsigned int timeout) {
if (!dev_) {
return nullptr;
}
@@ -318,7 +318,7 @@ void PseeLibUSBDataTransfer::flush() {
break;
}
} while (bytes_cnt > 0);
- } catch (const std::system_error &e) {}
+ } catch (const std::system_error &) {}
MV_HAL_LOG_TRACE() << "Total of " << total_flush << " bytes flushed";
}
diff --git a/hal_psee_plugins/src/devices/gen41/gen41_roi_command.cpp b/hal_psee_plugins/src/devices/gen41/gen41_roi_command.cpp
index 70fd54784..d7ef83a23 100644
--- a/hal_psee_plugins/src/devices/gen41/gen41_roi_command.cpp
+++ b/hal_psee_plugins/src/devices/gen41/gen41_roi_command.cpp
@@ -51,7 +51,7 @@ void Gen41ROICommand::write_ROI(const std::vector &vroiparams) {
uint32_t param_ind = 0;
uint32_t col_td_ind, row_td_ind;
roi_save_ = vroiparams;
- uint32_t td_roi_x00_addr, td_roi_x39_addr, td_roi_x40_addr;
+ uint32_t td_roi_x00_addr, td_roi_x39_addr;
uint32_t td_roi_y00_addr, td_roi_y22_addr;
td_roi_x00_addr = (*register_map_)[sensor_prefix_ + "roi/td_roi_x00"].get_address();
@@ -62,7 +62,7 @@ void Gen41ROICommand::write_ROI(const std::vector &vroiparams) {
uint32_t xsize = ((td_roi_x39_addr - td_roi_x00_addr) / roi_step) + 1;
uint32_t ysize = ((td_roi_y22_addr - td_roi_y00_addr) / roi_step) + 1;
if (vroiparams.size() != (xsize + ysize)) {
- MV_HAL_LOG_WARNING() << "Error setting roi for Gen 41 sensor.";
+ MV_HAL_LOG_WARNING() << "Error setting ROI.";
}
// setting x registers
@@ -103,39 +103,38 @@ bool Gen41ROICommand::enable(bool state) {
}
bool Gen41ROICommand::write_ROI_windows(const std::vector &windows) {
- if (windows.empty()) {
- return true;
- }
-
- // Only one ROI supported in window mode
- auto &window = windows[0];
-
- if (mode_ == Mode::ROI) {
- (*register_map_)[sensor_prefix_ + "roi_win_start_addr"]["roi_win_start_x"].write_value(window.x);
- (*register_map_)[sensor_prefix_ + "roi_win_start_addr"]["roi_win_start_y"].write_value(window.y);
- (*register_map_)[sensor_prefix_ + "roi_win_end_addr"]["roi_win_end_x"].write_value(window.x + window.width);
- (*register_map_)[sensor_prefix_ + "roi_win_end_addr"]["roi_win_end_y"].write_value(window.y + window.height);
-
- (*register_map_)[sensor_prefix_ + "roi_win_ctrl"]["roi_master_en"].write_value(1);
- while (!(*register_map_)[sensor_prefix_ + "roi_win_ctrl"]["roi_win_done"].read_value()) {
- }
- } else {
- // RONI window mode doesn't behave as expected, so use lines to setup a proper RONI window
- std::vector cols(device_width_, true);
- std::vector rows(device_height_, true);
-
- for (int i = window.x; i < window.x + window.width; ++i) {
- cols[i] = false;
- }
- for (int i = window.y; i < window.y + window.height; ++i) {
- rows[i] = false;
- }
-
- auto windows = lines_to_windows(cols, rows);
- write_ROI(create_ROIs(windows));
- }
-
- return true;
+ if (windows.empty()) {
+ return true;
+ }
+
+ // Only one ROI supported in window mode
+ auto &window = windows[0];
+
+ if (mode_ == Mode::ROI) {
+ (*register_map_)[sensor_prefix_ + "roi_win_start_addr"]["roi_win_start_x"].write_value(window.x);
+ (*register_map_)[sensor_prefix_ + "roi_win_start_addr"]["roi_win_start_y"].write_value(window.y);
+ (*register_map_)[sensor_prefix_ + "roi_win_end_addr"]["roi_win_end_x"].write_value(window.x + window.width);
+ (*register_map_)[sensor_prefix_ + "roi_win_end_addr"]["roi_win_end_y"].write_value(window.y + window.height);
+
+ (*register_map_)[sensor_prefix_ + "roi_win_ctrl"]["roi_master_en"].write_value(1);
+ while (!(*register_map_)[sensor_prefix_ + "roi_win_ctrl"]["roi_win_done"].read_value()) {}
+ } else {
+ // RONI window mode doesn't behave as expected, so use lines to setup a proper RONI window
+ std::vector cols(device_width_, true);
+ std::vector rows(device_height_, true);
+
+ for (int i = window.x; i < window.x + window.width; ++i) {
+ cols[i] = false;
+ }
+ for (int i = window.y; i < window.y + window.height; ++i) {
+ rows[i] = false;
+ }
+
+ auto windows = lines_to_windows(cols, rows);
+ write_ROI(create_ROIs(windows));
+ }
+
+ return true;
}
bool Gen41ROICommand::is_enabled() const {
diff --git a/hal_psee_plugins/src/devices/genx320/genx320_roi_driver.cpp b/hal_psee_plugins/src/devices/genx320/genx320_roi_driver.cpp
index d8cf386f5..730615c71 100644
--- a/hal_psee_plugins/src/devices/genx320/genx320_roi_driver.cpp
+++ b/hal_psee_plugins/src/devices/genx320/genx320_roi_driver.cpp
@@ -416,7 +416,7 @@ bool GenX320RoiDriver::enable(bool state) {
(*register_map_)[sensor_prefix_ + "roi_win_x0"].write_value(
vfield{{"roi_win_start_x", main_window_.x}, {"roi_win_end_p1_x", main_window_.x + main_window_.width}});
(*register_map_)[sensor_prefix_ + "roi_win_y0"].write_value(vfield{
- {"roi_win_start_y", main_window_.y}, {"roi_win_end_p1_y", main_window_.x + main_window_.height}});
+ {"roi_win_start_y", main_window_.y}, {"roi_win_end_p1_y", main_window_.y + main_window_.height}});
apply_windows(roi_window_cnt_);
} else {
diff --git a/hal_psee_plugins/src/devices/psee-video/tz_psee_video.cpp b/hal_psee_plugins/src/devices/psee-video/tz_psee_video.cpp
index 99666fb11..b6cc838fc 100644
--- a/hal_psee_plugins/src/devices/psee-video/tz_psee_video.cpp
+++ b/hal_psee_plugins/src/devices/psee-video/tz_psee_video.cpp
@@ -22,7 +22,7 @@ TzPseeVideo::TzPseeVideo(std::shared_ptr cmd, uint32_t dev
TzDevice(cmd, dev_id, parent), TzPseeFpgaDevice() {
try {
destroy();
- } catch (const std::system_error &e) {}
+ } catch (const std::system_error &) {}
try {
initialize();
} catch (const std::system_error &e) { MV_HAL_LOG_TRACE() << name << "did not enable:" << e.what(); }
@@ -31,7 +31,7 @@ TzPseeVideo::TzPseeVideo(std::shared_ptr cmd, uint32_t dev
TzPseeVideo::~TzPseeVideo() {
try {
destroy();
- } catch (const std::system_error &e) {}
+ } catch (const std::system_error &) {}
}
void TzPseeVideo::spawn_facilities(DeviceBuilder &device_builder, const DeviceConfig &device_config) {}
@@ -43,7 +43,7 @@ std::list TzPseeVideo::get_supported_formats() const {
try {
cmd->transfer_tz_frame(format);
formats.push_back(StreamFormat(format.get_strings()[0]));
- } catch (const std::system_error &e) { formats.push_back(StreamFormat("EVT3;height=720;width=1280")); }
+ } catch (const std::system_error &) { formats.push_back(StreamFormat("EVT3;height=720;width=1280")); }
return formats;
}
diff --git a/hal_psee_plugins/src/devices/treuzell/tz_device_builder.cpp b/hal_psee_plugins/src/devices/treuzell/tz_device_builder.cpp
index 6d5f90eba..55ff70715 100644
--- a/hal_psee_plugins/src/devices/treuzell/tz_device_builder.cpp
+++ b/hal_psee_plugins/src/devices/treuzell/tz_device_builder.cpp
@@ -58,7 +58,7 @@ std::vector TzDeviceBuilder::get_build_fun(std::shar
TzDeviceStringsCtrlFrame name(TZ_PROP_DEVICE_NAME, dev_id);
cmd->transfer_tz_frame(name);
name_str = name.get_strings()[0];
- } catch (const std::system_error &e2) { name_str = "device" + std::to_string(dev_id); }
+ } catch (const std::system_error &) { name_str = "device" + std::to_string(dev_id); }
} catch (const std::system_error &e) {
// On some old devices (treuzell-kernel 1.4.0, cx3 3.0.0), a compatibility string was used as name
try {
@@ -66,7 +66,7 @@ std::vector TzDeviceBuilder::get_build_fun(std::shar
cmd->transfer_tz_frame(name);
compat_str = name.get_strings();
name_str = name.get_strings()[0];
- } catch (const std::system_error &e2) {
+ } catch (const std::system_error &) {
MV_HAL_LOG_WARNING() << "Failed to get compatibility string from treuzell device" << dev_id << e.what();
return build_fun;
}
diff --git a/hal_psee_plugins/src/utils/psee_format.cpp b/hal_psee_plugins/src/utils/psee_format.cpp
index af6791e04..5a33658a5 100644
--- a/hal_psee_plugins/src/utils/psee_format.cpp
+++ b/hal_psee_plugins/src/utils/psee_format.cpp
@@ -77,7 +77,7 @@ std::unique_ptr StreamFormat::geometry() const {
if (!width || !height) {
throw std::invalid_argument("Format is missing a valid geometry");
}
- } catch (std::out_of_range &e) {
+ } catch (const std::out_of_range &) {
// Here we catch throws on map::at
throw std::invalid_argument("Format has no geometry");
}
diff --git a/hal_psee_plugins/test/i_events_stream_gtest.cpp b/hal_psee_plugins/test/i_events_stream_gtest.cpp
index ef20e029e..b2573a14b 100644
--- a/hal_psee_plugins/test/i_events_stream_gtest.cpp
+++ b/hal_psee_plugins/test/i_events_stream_gtest.cpp
@@ -324,7 +324,7 @@ TEST_F_WITH_DATASET(I_EventsStream_GTest, valid_index_file) {
EXPECT_EQ(ts_shifts[i], index_header.get_field("ts_shift_us"));
index_file.clear();
- index_file.seekg(-magic_number.size(), std::ios::end);
+ index_file.seekg(-static_cast(magic_number.size()), std::ios::end);
std::array buf;
ASSERT_TRUE(index_file.read(buf.data(), magic_number.size()));
for (size_t i = 0; i < magic_number.size(); ++i) {
@@ -733,9 +733,9 @@ TEST_F_WITH_DATASET(I_EventsStream_GTest, decode_evt3_nevents_monotonous_timesta
previous_ts_last = current_ts_last;
}
- cur_raw_ptr = raw_buffer_decode_to;
- raw_buffer_decode_to = std::min(cur_raw_ptr + raw_data_to_decode_count,
- raw_buffer->data() + raw_buffer->size());
+ cur_raw_ptr = raw_buffer_decode_to;
+ raw_buffer_decode_to =
+ std::min(cur_raw_ptr + raw_data_to_decode_count, raw_buffer->data() + raw_buffer->size());
}
}
}
diff --git a/sdk/cmake/MetavisionSDKConfig.cmake.in b/sdk/cmake/MetavisionSDKConfig.cmake.in
index a3000560c..f72ef9bc2 100644
--- a/sdk/cmake/MetavisionSDKConfig.cmake.in
+++ b/sdk/cmake/MetavisionSDKConfig.cmake.in
@@ -345,16 +345,16 @@ endforeach()
############################################################################
function(_find_MetavisionSDK_component component_name)
- # The configuration files for the components are to be looked for in path ${MetavisionSDK_COMPONENTS_CONFIG_PATH}/${_comp},
+ # The configuration files for the components are to be looked for in path ${MetavisionSDK_COMPONENTS_CONFIG_PATH}/${component_name},
# and their config file is named "MetavisionSDK_${_comp}Config.cmake", so we can use the cmake built-in function find_package()
# to check if we can find the component
- _get_MetavisionSDK_component_filepath("${_comp}" DIRECTORY MetavisionSDK_${_comp}_DIR)
- find_package(MetavisionSDK_${_comp}
+ _get_MetavisionSDK_component_filepath("${component_name}" DIRECTORY MetavisionSDK_${component_name}_DIR)
+ find_package(MetavisionSDK_${component_name}
NO_DEFAULT_PATH
QUIET)
- set(MetavisionSDK_${_comp}_FOUND ${MetavisionSDK_${_comp}_FOUND} PARENT_SCOPE)
- set(MetavisionSDK_${_comp}_VERSION ${MetavisionSDK_${_comp}_VERSION} PARENT_SCOPE)
- set(MetavisionSDK_${_comp}_REASON_NOT_FOUND ${MetavisionSDK_${_comp}_REASON_NOT_FOUND} PARENT_SCOPE)
+ set(MetavisionSDK_${component_name}_FOUND ${MetavisionSDK_${component_name}_FOUND} PARENT_SCOPE)
+ set(MetavisionSDK_${component_name}_VERSION ${MetavisionSDK_${component_name}_VERSION} PARENT_SCOPE)
+ set(MetavisionSDK_${component_name}_REASON_NOT_FOUND ${MetavisionSDK_${component_name}_REASON_NOT_FOUND} PARENT_SCOPE)
endfunction(_find_MetavisionSDK_component)
# Find required components
diff --git a/sdk/modules/base/python/bindings/generic_header_python.cpp b/sdk/modules/base/python/bindings/generic_header_python.cpp
index 1d57d0d8b..f0acbc397 100644
--- a/sdk/modules/base/python/bindings/generic_header_python.cpp
+++ b/sdk/modules/base/python/bindings/generic_header_python.cpp
@@ -30,7 +30,7 @@ void export_generic_header(py::module &m) {
for (const auto &pair : dict) {
try {
header->set_field(pair.first.cast(), pair.second.cast());
- } catch (const py::cast_error &e) {
+ } catch (const py::cast_error &) {
std::cerr << "Error while building a RawFileHeader from a dictionary: the input dictionary "
"must contain only string type for both keys and values. Failed to add field "
"to header."
diff --git a/sdk/modules/core/cpp/include/metavision/sdk/core/algorithms/async_algorithm.h b/sdk/modules/core/cpp/include/metavision/sdk/core/algorithms/async_algorithm.h
index ee97d95aa..85dba513b 100644
--- a/sdk/modules/core/cpp/include/metavision/sdk/core/algorithms/async_algorithm.h
+++ b/sdk/modules/core/cpp/include/metavision/sdk/core/algorithms/async_algorithm.h
@@ -54,11 +54,15 @@ class AsyncAlgorithm {
/// Processing policies that define the state to rely on to call the asynchronous process (process_async).
///
/// N_EVENTS: event count processing policy. Relies on the number of events processed.
+ ///
/// N_US: time slice processing policy. Relies on the timestamp of the input events. A time slice T holds events
/// between [(n-1)*T; n*T[.
+ ///
/// MIXED: a mix between N_US and N_EVENTS processing policy. In this policy, the time slice has priority over the
/// events count.
+ ///
/// SYNC: synchronous condition. process_async is called at the end of the process_events method.
+ ///
/// EXTERNAL: Relies on an external condition. process_async is called at each flush call.
enum class Processing { N_EVENTS, N_US, MIXED, SYNC, EXTERNAL };
diff --git a/sdk/modules/core/cpp/include/metavision/sdk/core/utils/detail/data_synchronizer_from_triggers_impl.h b/sdk/modules/core/cpp/include/metavision/sdk/core/utils/detail/data_synchronizer_from_triggers_impl.h
index ad5a8d755..a4b5a282f 100644
--- a/sdk/modules/core/cpp/include/metavision/sdk/core/utils/detail/data_synchronizer_from_triggers_impl.h
+++ b/sdk/modules/core/cpp/include/metavision/sdk/core/utils/detail/data_synchronizer_from_triggers_impl.h
@@ -40,7 +40,7 @@ void DataSynchronizerFromTriggers::index_triggers(ExtTriggerIterator trigger_it,
std::lock_guard lock(triggers_updated_mutex_);
for (; trigger_it != trigger_it_end; ++trigger_it, ++indexed_trigger_inserter_it) {
// Consider the trigger only if polarity matches the reference one
- if (trigger_it->p != parameters_.reference_polarity_) {
+ if (trigger_it->p != (parameters_.reference_polarity_ ? 1 : 0)) {
continue;
}
diff --git a/sdk/modules/core/cpp/samples/metavision_composed_viewer/metavision_composed_viewer.cpp b/sdk/modules/core/cpp/samples/metavision_composed_viewer/metavision_composed_viewer.cpp
index 1c3273857..983cdde1f 100644
--- a/sdk/modules/core/cpp/samples/metavision_composed_viewer/metavision_composed_viewer.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_composed_viewer/metavision_composed_viewer.cpp
@@ -27,7 +27,7 @@ namespace po = boost::program_options;
/// [PIPELINE_COMPOSED_BEGIN]
int main(int argc, char *argv[]) {
- std::string in_file_path;
+ std::string event_file_path;
const std::string program_desc("Code sample demonstrating how to use Metavision SDK CV to filter events\n"
"and show a frame combining unfiltered and filtered events.\n");
@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("input-file,i", po::value(&in_file_path), "Path to input file. If not specified, the camera live stream is used.")
+ ("input-event-file,i", po::value(&event_file_path), "Path to input event file (RAW or HDF5). If not specified, the camera live stream is used.")
;
// clang-format on
@@ -62,8 +62,8 @@ int main(int argc, char *argv[]) {
// Construct a camera from a file or a live stream
Metavision::Camera cam;
- if (!in_file_path.empty()) {
- cam = Metavision::Camera::from_file(in_file_path);
+ if (!event_file_path.empty()) {
+ cam = Metavision::Camera::from_file(event_file_path);
} else {
cam = Metavision::Camera::from_first_available();
}
diff --git a/sdk/modules/core/cpp/samples/metavision_csv_viewer/metavision_csv_viewer.cpp b/sdk/modules/core/cpp/samples/metavision_csv_viewer/metavision_csv_viewer.cpp
index b5bafa291..058e651ac 100644
--- a/sdk/modules/core/cpp/samples/metavision_csv_viewer/metavision_csv_viewer.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_csv_viewer/metavision_csv_viewer.cpp
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -35,8 +36,13 @@ class CSVReadingStage : public Metavision::BaseStage {
public:
CSVReadingStage(const std::string &filename) : ifs_(filename) {
if (!ifs_.is_open()) {
+ MV_LOG_ERROR() << "Unable to open " << filename;
throw std::runtime_error("Unable to open " + filename);
}
+ if (!parse_csv_header()) {
+ MV_LOG_ERROR() << "Error while parsing header of " << filename;
+ throw std::runtime_error("Error while parsing header of " + filename);
+ }
cur_cd_buffer_ = cd_buffer_pool_.acquire();
cur_cd_buffer_->clear();
@@ -87,7 +93,49 @@ class CSVReadingStage : public Metavision::BaseStage {
}
/// [PIPELINE_USAGE_READ_END]
+ std::optional get_width() const {
+ return width_;
+ }
+ std::optional get_height() const {
+ return height_;
+ }
+
private:
+ bool read_cd_csv_header_line() {
+ std::string line;
+ if (std::getline(ifs_, line)) {
+ std::istringstream iss(line);
+ std::string key, value;
+ std::vector values;
+ iss.ignore(1); // ignore leading '%'
+ std::getline(iss, key, ':');
+ while (std::getline(iss, value, ',')) {
+ values.push_back(value);
+ }
+ if (key == "geometry") {
+ if (values.size() == 2) {
+ width_ = std::stoi(values[0]);
+ height_ = std::stoi(values[1]);
+ } else {
+ MV_LOG_ERROR() << "Ignoring invalid header line for key geometry, expected "
+ "\"%geometry:,\", got: \""
+ << line << "\"";
+ }
+ }
+ }
+ return ifs_.good();
+ }
+
+ bool parse_csv_header() {
+ while (ifs_.peek() == '%') {
+ if (!read_cd_csv_header_line()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ std::optional width_, height_;
std::atomic done_;
std::thread reading_thread_;
std::ifstream ifs_;
@@ -111,8 +159,8 @@ int main(int argc, char *argv[]) {
options_desc.add_options()
("help,h", "Produce help message.")
("input-csv-file,i", po::value(&in_csv_file_path)->required(), "Path to input CSV file")
- ("width", po::value(&width)->default_value(640), "Width of the sensor associated to the CSV file")
- ("height", po::value(&height)->default_value(480), "Height of the sensor associated to the CSV file")
+ ("width", po::value(&width)->default_value(1280), "Width of the sensor associated to the CSV file")
+ ("height", po::value(&height)->default_value(720), "Height of the sensor associated to the CSV file")
;
// clang-format on
@@ -142,7 +190,14 @@ int main(int argc, char *argv[]) {
Metavision::Pipeline p(true);
// 0) Stage producing events from a CSV file
- auto &csv_stage = p.add_stage(std::make_unique(in_csv_file_path));
+ auto csv_reader = std::make_unique(in_csv_file_path);
+ if (auto width_opt = csv_reader->get_width()) {
+ width = *width_opt;
+ }
+ if (auto height_opt = csv_reader->get_height()) {
+ height = *height_opt;
+ }
+ auto &csv_stage = p.add_stage(std::move(csv_reader));
// 1) Stage generating a frame with events previously produced using accumulation time of 10ms
auto &frame_stage = p.add_stage(std::make_unique(width, height, 10), csv_stage);
diff --git a/sdk/modules/core/cpp/samples/metavision_event_frame_generation/metavision_event_frame_generation.cpp b/sdk/modules/core/cpp/samples/metavision_event_frame_generation/metavision_event_frame_generation.cpp
index d4253e8ba..b1c436c07 100644
--- a/sdk/modules/core/cpp/samples/metavision_event_frame_generation/metavision_event_frame_generation.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_event_frame_generation/metavision_event_frame_generation.cpp
@@ -32,7 +32,7 @@ int main(int argc, char *argv[]) {
//////////////////////////////////////////////
// Parse command line options
//////////////////////////////////////////////
- std::string in_file_path, out_file_path, out_video_path;
+ std::string event_file_path, out_file_path, out_video_path;
bool enable_histo, enable_diff, diff_allow_rollover, histo_packed, disable_display;
unsigned int histo_bit_size_neg, histo_bit_size_pos, diff_bit_size;
int nevents;
@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("input-file,i", po::value(&in_file_path)->required(), "Path to input file.")
+ ("input-event-file,i", po::value(&event_file_path)->required(), "Path to input file.")
("output-file,o", po::value(&out_file_path)->default_value(""), "If specified, path to the event frame RAW file to be generated from the input event stream.")
("output-video,v", po::value(&out_video_path)->default_value(""), "If specified, path to the video to be generated from the visualization.")
("period,p", po::value(&period_us)->default_value(10000), "Period for the generation of the event frames, in us. If negative, only event numbers will be used.")
@@ -114,7 +114,7 @@ int main(int argc, char *argv[]) {
// Instantiate Camera object from provided recording
Metavision::Camera camera;
try {
- camera = Metavision::Camera::from_file(in_file_path, Metavision::FileConfigHints().real_time_playback(true));
+ camera = Metavision::Camera::from_file(event_file_path, Metavision::FileConfigHints().real_time_playback(true));
} catch (Metavision::CameraException &e) {
MV_LOG_ERROR() << e.what();
diff --git a/sdk/modules/core/cpp/samples/metavision_event_frame_gpu_loading/CMakeLists.txt b/sdk/modules/core/cpp/samples/metavision_event_frame_gpu_loading/CMakeLists.txt
index 73f3b56c9..e702ec3c2 100644
--- a/sdk/modules/core/cpp/samples/metavision_event_frame_gpu_loading/CMakeLists.txt
+++ b/sdk/modules/core/cpp/samples/metavision_event_frame_gpu_loading/CMakeLists.txt
@@ -7,16 +7,11 @@
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
-include(CheckLanguage)
-
set(cuda_source_files convert_event_frame.cu convert_event_frame.h)
set(sample metavision_event_frame_gpu_loading)
set(source_files ${sample}.cpp)
-check_language(CUDA)
if (CMAKE_CUDA_COMPILER)
- enable_language(CUDA)
-
add_library(cuda_event_frame_convert STATIC ${cuda_source_files})
set_target_properties(cuda_event_frame_convert PROPERTIES CUDA_SEPARABLE_COMPILATION ON CUDA_RESOLVE_DEVICE_SYMBOLS ON)
diff --git a/sdk/modules/core/cpp/samples/metavision_event_frame_gpu_loading/metavision_event_frame_gpu_loading.cpp b/sdk/modules/core/cpp/samples/metavision_event_frame_gpu_loading/metavision_event_frame_gpu_loading.cpp
index bc7da927c..501aefd36 100644
--- a/sdk/modules/core/cpp/samples/metavision_event_frame_gpu_loading/metavision_event_frame_gpu_loading.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_event_frame_gpu_loading/metavision_event_frame_gpu_loading.cpp
@@ -74,7 +74,7 @@ static float *process_event_frame_on_gpu(const Metavision::RawEventFrameDiff &di
}
int main(int argc, char *argv[]) {
- std::string in_file_path;
+ std::string event_file_path;
std::string output_dir;
const std::string program_desc("Sample preprocessing Raw event frame on a GPU using CUDA");
@@ -83,8 +83,8 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("input-file,i", po::value(&in_file_path)->required(), "Path to input file.")
- ("output-dir,o", po::value(&output_dir)->required(), "Output directory to store frames.");
+ ("input-event-file,i", po::value(&event_file_path)->required(), "Path to input event file (RAW or HDF5).")
+ ("output-dir,o", po::value(&output_dir)->required(), "Output directory to store frames.");
// clang-format on
po::variables_map vm;
po::store(po::command_line_parser(argc, argv).options(options_desc).run(), vm);
@@ -117,7 +117,7 @@ int main(int argc, char *argv[]) {
Metavision::Camera camera;
try {
- camera = Metavision::Camera::from_file(in_file_path, Metavision::FileConfigHints().real_time_playback(false));
+ camera = Metavision::Camera::from_file(event_file_path, Metavision::FileConfigHints().real_time_playback(false));
} catch (Metavision::CameraException &e) {
MV_LOG_ERROR() << e.what();
return 1;
diff --git a/sdk/modules/core/cpp/samples/metavision_file_to_video/metavision_file_to_video.cpp b/sdk/modules/core/cpp/samples/metavision_file_to_video/metavision_file_to_video.cpp
index 40fb36f05..556a3b87c 100644
--- a/sdk/modules/core/cpp/samples/metavision_file_to_video/metavision_file_to_video.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_file_to_video/metavision_file_to_video.cpp
@@ -33,7 +33,7 @@ void remove_file(const std::string &filepath) {
}
int main(int argc, char *argv[]) {
- std::string in_file_path;
+ std::string in_event_file_path;
std::string out_video_file_path;
uint32_t accumulation_time;
@@ -57,7 +57,7 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("input-file,i", po::value(&in_file_path)->required(), "Path to input file.")
+ ("input-event-file,i", po::value(&in_event_file_path)->required(), "Path to input event file (RAW or HDF5).")
("output-video-file,o", po::value(&out_video_file_path), "Path to output AVI file. If not provided, the base name of the input file will be used. The output video fps is fixed to 30.")
("accumulation-time,a", po::value(&accumulation_time)->default_value(10000), "Accumulation time (in us).")
("slow-motion-factor,s", po::value(&slow_motion_factor)->default_value(1.), "Slow motion factor (or fast for value lower than 1) to apply to generate the video.")
@@ -83,7 +83,7 @@ int main(int argc, char *argv[]) {
// Use the input filename as the output video name, if the output video name is empty
if (out_video_file_path.empty()) {
- out_video_file_path = std::regex_replace(in_file_path, std::regex("\\.[^.]*$"), ".avi");
+ out_video_file_path = std::regex_replace(in_event_file_path, std::regex("\\.[^.]*$"), ".avi");
}
if (slow_motion_factor <= 0) {
@@ -94,7 +94,7 @@ int main(int argc, char *argv[]) {
Metavision::Camera camera;
try {
- camera = Metavision::Camera::from_file(in_file_path, Metavision::FileConfigHints().real_time_playback(false));
+ camera = Metavision::Camera::from_file(in_event_file_path, Metavision::FileConfigHints().real_time_playback(false));
} catch (Metavision::CameraException &e) {
MV_LOG_ERROR() << e.what();
return 1;
diff --git a/sdk/modules/core/cpp/samples/metavision_filtering/metavision_filtering.cpp b/sdk/modules/core/cpp/samples/metavision_filtering/metavision_filtering.cpp
index cf4945ca6..35ea60f27 100644
--- a/sdk/modules/core/cpp/samples/metavision_filtering/metavision_filtering.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_filtering/metavision_filtering.cpp
@@ -27,7 +27,7 @@ namespace po = boost::program_options;
/// [PIPELINE_FILTERING_BEGIN]
int main(int argc, char *argv[]) {
- std::string in_file_path;
+ std::string event_file_path;
const std::string short_program_desc("Code sample showing how the pipeline utility can be used to "
"create a simple application to filter and display events.\n");
@@ -43,7 +43,7 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("input-file,i", po::value(&in_file_path), "Path to input file. If not specified, the camera live stream is used.")
+ ("input-event-file,i", po::value(&event_file_path), "Path to input event file (RAW or HDF5). If not specified, the camera live stream is used.")
;
// clang-format on
@@ -71,8 +71,8 @@ int main(int argc, char *argv[]) {
// Construct a camera from a recording or a live stream
Metavision::Camera cam;
- if (!in_file_path.empty()) {
- cam = Metavision::Camera::from_file(in_file_path);
+ if (!event_file_path.empty()) {
+ cam = Metavision::Camera::from_file(event_file_path);
} else {
cam = Metavision::Camera::from_first_available();
}
diff --git a/sdk/modules/core/cpp/samples/metavision_player/inc/params.h b/sdk/modules/core/cpp/samples/metavision_player/inc/params.h
index 4510dc243..79cb9518d 100644
--- a/sdk/modules/core/cpp/samples/metavision_player/inc/params.h
+++ b/sdk/modules/core/cpp/samples/metavision_player/inc/params.h
@@ -16,7 +16,7 @@
struct Parameters {
// Input.
std::string in_bias_file;
- std::string in_raw_file;
+ std::string event_file_path;
// Parameters for the exported files.
std::string out_bias_file;
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 60c7fa90a..2df869eaf 100644
--- a/sdk/modules/core/cpp/samples/metavision_player/src/main.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_player/src/main.cpp
@@ -75,7 +75,7 @@ bool parse_command_line(int argc, const char *argv[], Parameters &app_params) {
("output-avi-framerate,f", po::value(&app_params.out_avi_fps)->default_value(25), "Frame rate of the output AVI file.")
("output-raw-basename,o", po::value(&app_params.out_raw_basename)->default_value((docs_path / "out").string()),
"Path and base name of the output RAW file for exporting. Each file will have the name /_.raw, where represents the day and time the file was recorded.")
- ("input-raw-file,i", po::value(&app_params.in_raw_file), "Path to input RAW file. If not specified, the camera live stream is used.")
+ ("input-event-file,i", po::value(&app_params.event_file_path), "Path to input event file (RAW or HDF5). If not specified, the camera live stream is used.")
;
// clang-format on
diff --git a/sdk/modules/core/cpp/samples/metavision_player/src/viewer.cpp b/sdk/modules/core/cpp/samples/metavision_player/src/viewer.cpp
index ece917ea5..fea30a8fe 100644
--- a/sdk/modules/core/cpp/samples/metavision_player/src/viewer.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_player/src/viewer.cpp
@@ -34,7 +34,7 @@ void Viewer::setup_camera() {
camera_ = Metavision::Camera();
// Live camera.
- if (parameters_.in_raw_file.empty()) {
+ if (parameters_.event_file_path.empty()) {
camera_ = Metavision::Camera::from_first_available();
// Set biases if file specified.
@@ -44,7 +44,7 @@ void Viewer::setup_camera() {
}
// RAW file.
else {
- camera_ = Metavision::Camera::from_file(parameters_.in_raw_file);
+ camera_ = Metavision::Camera::from_file(parameters_.event_file_path);
}
// Get sensor size
@@ -74,12 +74,12 @@ void Viewer::start() {
setup_camera();
camera_.start();
- bool live = parameters_.in_raw_file.empty();
+ bool live = parameters_.event_file_path.empty();
view_.reset(new CameraView(camera_, event_buffer_, parameters_, live));
}
bool Viewer::update() {
- if (parameters_.in_raw_file.empty() && parameters_.show_biases) {
+ if (parameters_.event_file_path.empty() && parameters_.show_biases) {
// Handle specific case of trying to set biases when using an IMX636 or a GenX320 camera
if ((camera_.generation().version_major() == 4 && camera_.generation().version_minor() == 2) ||
(camera_.generation().version_major() == 320 && camera_.generation().version_minor() == 0)) {
@@ -116,7 +116,7 @@ bool Viewer::update() {
view_.reset(new AnalysisView(*view_));
}
} else {
- bool live = parameters_.in_raw_file.empty();
+ bool live = parameters_.event_file_path.empty();
if (live) {
// When using a live camera, recreate it from scratch at start
// and reset the timestamp
diff --git a/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started.cpp b/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started.cpp
index a3492938f..5d618466b 100644
--- a/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started.cpp
@@ -132,7 +132,7 @@ int main(int argc, char *argv[]) {
const double length_in_seconds = event_analyzer.global_max_t / 1000000.0;
std::cout << "There were " << event_analyzer.global_counter << " events in total." << std::endl;
std::cout << "The total duration was " << length_in_seconds << " seconds." << std::endl;
- if (length_in_seconds >= 1) { // no need to print this statistics if the video was too short
+ if (length_in_seconds >= 1) { // no need to print this statistics if the total duration was too short
std::cout << "There were " << event_analyzer.global_counter / length_in_seconds
<< " events per second on average." << std::endl;
}
diff --git a/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v3.cpp b/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v3.cpp
index 7e056e3c0..568884b92 100644
--- a/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v3.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v3.cpp
@@ -85,7 +85,7 @@ int main(int argc, char *argv[]) {
double length_in_seconds = event_analyzer.global_max_t / 1000000.0;
std::cout << "There were " << event_analyzer.global_counter << " events in total." << std::endl;
std::cout << "The total duration was " << length_in_seconds << " seconds." << std::endl;
- if (length_in_seconds >= 1) { // no need to print this statistics if the video was too short
+ if (length_in_seconds >= 1) { // no need to print this statistics if the total duration was too short
std::cout << "There were " << event_analyzer.global_counter / (event_analyzer.global_max_t / 1000000.0)
<< " events per seconds on average." << std::endl;
}
diff --git a/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v4.cpp b/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v4.cpp
index 0fcda357d..3a54fd7e9 100644
--- a/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v4.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v4.cpp
@@ -124,7 +124,7 @@ int main(int argc, char *argv[]) {
const double length_in_seconds = event_analyzer.global_max_t / 1000000.0;
std::cout << "There were " << event_analyzer.global_counter << " events in total." << std::endl;
std::cout << "The total duration was " << length_in_seconds << " seconds." << std::endl;
- if (length_in_seconds >= 1) { // no need to print this statistics if the video was too short
+ if (length_in_seconds >= 1) { // no need to print this statistics if the total duration was too short
std::cout << "There were " << event_analyzer.global_counter / length_in_seconds
<< " events per second on average." << std::endl;
}
diff --git a/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v5.cpp b/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v5.cpp
index a3492938f..5d618466b 100644
--- a/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v5.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_sdk_get_started/metavision_sdk_get_started_v5.cpp
@@ -132,7 +132,7 @@ int main(int argc, char *argv[]) {
const double length_in_seconds = event_analyzer.global_max_t / 1000000.0;
std::cout << "There were " << event_analyzer.global_counter << " events in total." << std::endl;
std::cout << "The total duration was " << length_in_seconds << " seconds." << std::endl;
- if (length_in_seconds >= 1) { // no need to print this statistics if the video was too short
+ if (length_in_seconds >= 1) { // no need to print this statistics if the total duration was too short
std::cout << "There were " << event_analyzer.global_counter / length_in_seconds
<< " events per second on average." << std::endl;
}
diff --git a/sdk/modules/core/cpp/samples/metavision_time_surface/metavision_time_surface.cpp b/sdk/modules/core/cpp/samples/metavision_time_surface/metavision_time_surface.cpp
index 59b3cbef1..b911ed638 100644
--- a/sdk/modules/core/cpp/samples/metavision_time_surface/metavision_time_surface.cpp
+++ b/sdk/modules/core/cpp/samples/metavision_time_surface/metavision_time_surface.cpp
@@ -23,8 +23,8 @@ namespace po = boost::program_options;
int main(int argc, char *argv[]) {
std::string serial;
- std::string biases_file;
- std::string in_file_path;
+ std::string cam_config_path;
+ std::string event_file_path;
uint32_t delta_ts;
const std::string short_program_desc(
@@ -34,10 +34,10 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("serial,s", po::value(&serial),"Serial ID of the camera. This flag is incompatible with flag '--input-file'.")
- ("input-file,i", po::value(&in_file_path), "Path to input file. If not specified, the camera live stream is used.")
- ("biases,b", po::value(&biases_file), "Path to a biases file. If not specified, the camera will be configured with the default biases.")
- ("accumulation-time,a", po::value(&delta_ts)->default_value(10000), "Accumulation time for which to display the Time Surface.")
+ ("serial,s", po::value(&serial),"Serial ID of the camera. This flag is incompatible with flag '--input-event-file'.")
+ ("input-event-file,i", po::value(&event_file_path), "Path to input event file (RAW or HDF5). If not specified, the camera live stream is used.")
+ ("input-camera-config,j", po::value(&cam_config_path), "Path to a JSON file containing camera config settings to restore a camera state. Only works for live cameras.")
+ ("accumulation-time,a", po::value(&delta_ts)->default_value(10000), "Accumulation time for which to display the Time Surface.")
;
// clang-format on
@@ -61,15 +61,15 @@ int main(int argc, char *argv[]) {
Metavision::Camera camera;
// if the filename is set, then read from the file
- if (!in_file_path.empty()) {
+ if (!event_file_path.empty()) {
if (!serial.empty()) {
- MV_LOG_ERROR() << "Options --serial and --input-file are not compatible.";
+ MV_LOG_ERROR() << "Options --serial and --input-event-file are not compatible.";
return 1;
}
try {
camera =
- Metavision::Camera::from_file(in_file_path, Metavision::FileConfigHints().real_time_playback(true));
+ Metavision::Camera::from_file(event_file_path, Metavision::FileConfigHints().real_time_playback(true));
} catch (Metavision::CameraException &e) {
MV_LOG_ERROR() << e.what();
@@ -84,8 +84,8 @@ int main(int argc, char *argv[]) {
camera = Metavision::Camera::from_first_available();
}
- if (biases_file != "") {
- camera.biases().set_from_file(biases_file);
+ if (!cam_config_path.empty()) {
+ camera.load(cam_config_path);
}
} catch (Metavision::CameraException &e) {
MV_LOG_ERROR() << e.what();
diff --git a/sdk/modules/core/cpp/tests/threaded_process_gtest.cpp b/sdk/modules/core/cpp/tests/threaded_process_gtest.cpp
index 44a6c834a..b04f8f19c 100644
--- a/sdk/modules/core/cpp/tests/threaded_process_gtest.cpp
+++ b/sdk/modules/core/cpp/tests/threaded_process_gtest.cpp
@@ -230,7 +230,6 @@ TEST_F(ThreadedProcess_GTest, calling_stop_without_abort_prevents_adding_new_tas
TEST_F(ThreadedProcess_GTest, calling_stop_does_not_run_pending_tasks) {
// GIVEN a threaded process
Metavision::ThreadedProcess threaded_process;
- bool tester;
std::condition_variable proceed_cond;
std::mutex proceed_mutex;
bool proceed{false};
diff --git a/sdk/modules/core/python/pypkg/metavision_core/event_io/events_iterator.py b/sdk/modules/core/python/pypkg/metavision_core/event_io/events_iterator.py
index fbf8d3806..89591bd74 100644
--- a/sdk/modules/core/python/pypkg/metavision_core/event_io/events_iterator.py
+++ b/sdk/modules/core/python/pypkg/metavision_core/event_io/events_iterator.py
@@ -19,8 +19,8 @@
class EventsIterator(object):
"""
- EventsIterator is a small convenience class to iterate through either a camera, a DAT file, a RAW file
- or a H5 file containing events.
+ EventsIterator is a small convenience class to iterate through either a camera, a RAW file,
+ an HDF5 event file or a DAT file.
Note that, as every Python iterator, you can consume an EventsIterator only once.
diff --git a/sdk/modules/core/python/pypkg/metavision_core/event_io/h5_io.py b/sdk/modules/core/python/pypkg/metavision_core/event_io/h5_io.py
index a19a331ff..b478a2ddb 100644
--- a/sdk/modules/core/python/pypkg/metavision_core/event_io/h5_io.py
+++ b/sdk/modules/core/python/pypkg/metavision_core/event_io/h5_io.py
@@ -146,7 +146,7 @@ def __iter__(self):
class HDF5EventsReader(object):
"""
- Reads & Seeks into a hdf5 file of compressed event packets.
+ Reads & Seeks into an HDF5 file of compressed event packets.
Args:
src_name (str): input path
diff --git a/sdk/modules/core/python/pypkg/metavision_core/event_io/py_reader.py b/sdk/modules/core/python/pypkg/metavision_core/event_io/py_reader.py
index 7a5b43e0f..f9a69ada2 100644
--- a/sdk/modules/core/python/pypkg/metavision_core/event_io/py_reader.py
+++ b/sdk/modules/core/python/pypkg/metavision_core/event_io/py_reader.py
@@ -53,7 +53,7 @@ def __init__(self, event_file):
self._ev_count = (self._end - self._start) // self._ev_size
self.current_time = 0
if self._ev_count == 0:
- print("WARNING: The events file is empty!!!")
+ print("WARNING: The event file is empty!!!")
self.done = True
self.duration_s = 0
else:
diff --git a/sdk/modules/core/python/samples/CMakeLists.txt b/sdk/modules/core/python/samples/CMakeLists.txt
index 4fa89f935..b301af2aa 100644
--- a/sdk/modules/core/python/samples/CMakeLists.txt
+++ b/sdk/modules/core/python/samples/CMakeLists.txt
@@ -10,9 +10,9 @@
add_subdirectory(metavision_adaptive_rate)
add_subdirectory(metavision_csv_viewer)
add_subdirectory(metavision_event_frame_viewer)
+add_subdirectory(metavision_file_to_csv)
add_subdirectory(metavision_filtering)
add_subdirectory(metavision_interop)
-add_subdirectory(metavision_raw_to_csv)
add_subdirectory(metavision_sdk_get_started)
add_subdirectory(metavision_simple_recorder)
add_subdirectory(metavision_simple_viewer)
diff --git a/sdk/modules/core/python/samples/metavision_csv_viewer/metavision_csv_viewer.py b/sdk/modules/core/python/samples/metavision_csv_viewer/metavision_csv_viewer.py
index 7e4e089d2..c740ce062 100644
--- a/sdk/modules/core/python/samples/metavision_csv_viewer/metavision_csv_viewer.py
+++ b/sdk/modules/core/python/samples/metavision_csv_viewer/metavision_csv_viewer.py
@@ -36,9 +36,9 @@ def parse_args():
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i', '--input-csv-file', dest='input_path', type=str,
help="Path to input CSV file.", required=True)
- parser.add_argument('--width', dest='width', type=int, default=640,
+ parser.add_argument('--width', dest='width', type=int, default=1280,
help="Width of the sensor associated to the CSV file.")
- parser.add_argument('--height', dest='height', type=int, default=480,
+ parser.add_argument('--height', dest='height', type=int, default=720,
help="Height of the sensor associated to the CSV file.")
args = parser.parse_args()
return args
@@ -50,6 +50,21 @@ def main():
print("Code sample demonstrating how to use Metavision SDK to display events from a CSV file.")
+ # Parse CSV header starting with '%' if any
+ n_header_lines = 0
+ with open(args.input_path) as input_file:
+ while True:
+ line = input_file.readline()
+ if not line.startswith("%"):
+ break
+ n_header_lines += 1
+ if line[:10]=="%geometry:": # "%geometry:,"
+ dimensions = [int(str) for str in line[10:].split(",")]
+ if len(dimensions)==2:
+ args.width = dimensions[0]
+ args.height = dimensions[1]
+ print(f"Parsed input stream dimensions from CSV header: width={args.width}, height={args.height}")
+
# Event Frame Generator
event_frame_gen = PeriodicFrameGenerationAlgorithm(args.width, args.height, accumulation_time_us)
@@ -72,7 +87,7 @@ def keyboard_cb(key, scancode, action, mods):
# Parse CSV using Pandas
reader = pd.read_csv(args.input_path, delimiter=',', chunksize=events_chunksize, header=None, names=[
- 'x', 'y', 'p', 't'], dtype={'x': np.ushort, 'y': np.ushort, 'p': np.short, 't': np.longlong})
+ 'x', 'y', 'p', 't'], dtype={'x': np.ushort, 'y': np.ushort, 'p': np.short, 't': np.longlong}, skiprows=n_header_lines)
events_buf = EventCDBuffer(events_chunksize)
np_evs = events_buf.numpy()
# Read CSV by chunks
diff --git a/sdk/modules/core/python/samples/metavision_raw_to_csv/CMakeLists.txt b/sdk/modules/core/python/samples/metavision_file_to_csv/CMakeLists.txt
similarity index 91%
rename from sdk/modules/core/python/samples/metavision_raw_to_csv/CMakeLists.txt
rename to sdk/modules/core/python/samples/metavision_file_to_csv/CMakeLists.txt
index 9f6dbe404..87f73465b 100644
--- a/sdk/modules/core/python/samples/metavision_raw_to_csv/CMakeLists.txt
+++ b/sdk/modules/core/python/samples/metavision_file_to_csv/CMakeLists.txt
@@ -7,7 +7,7 @@
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
-install(FILES metavision_raw_to_csv.py
- DESTINATION share/metavision/sdk/core/python_samples/metavision_raw_to_csv
+install(FILES metavision_file_to_csv.py
+ DESTINATION share/metavision/sdk/core/python_samples/metavision_file_to_csv
COMPONENT metavision-sdk-core-python-samples
)
\ No newline at end of file
diff --git a/sdk/modules/core/python/samples/metavision_raw_to_csv/metavision_raw_to_csv.py b/sdk/modules/core/python/samples/metavision_file_to_csv/metavision_file_to_csv.py
similarity index 82%
rename from sdk/modules/core/python/samples/metavision_raw_to_csv/metavision_raw_to_csv.py
rename to sdk/modules/core/python/samples/metavision_file_to_csv/metavision_file_to_csv.py
index c3a711527..c871f34ff 100644
--- a/sdk/modules/core/python/samples/metavision_raw_to_csv/metavision_raw_to_csv.py
+++ b/sdk/modules/core/python/samples/metavision_file_to_csv/metavision_file_to_csv.py
@@ -21,7 +21,7 @@ def parse_args():
"""Parse command line arguments."""
parser = argparse.ArgumentParser(description='Metavision RAW or DAT to CSV.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
- parser.add_argument('-i', '--input-file', dest='input_path', required=True, help="Path to input RAW/DAT file")
+ parser.add_argument('-i', '--input-event-file', dest='event_file_path', required=True, help="ath to input event file (RAW or HDF5)")
parser.add_argument('-o', '--output-dir', required=True, help="Path to csv output directory")
parser.add_argument('-s', '--start-ts', type=int, default=0, help="start time in microsecond")
parser.add_argument('-d', '--max-duration', type=int, default=1e6 * 60, help="maximum duration in microsecond")
@@ -33,12 +33,12 @@ def parse_args():
def main():
args = parse_args()
- if os.path.isfile(args.input_path):
- output_file = os.path.join(args.output_dir, os.path.basename(args.input_path)[:-4] + ".csv")
+ if os.path.isfile(args.event_file_path):
+ output_file = os.path.join(args.output_dir, os.path.basename(args.event_file_path)[:-4] + ".csv")
else:
- raise TypeError(f'Fail to access file: {args.input_path}')
+ raise TypeError(f'Fail to access file: {args.event_file_path}')
- mv_iterator = EventsIterator(input_path=args.input_path, delta_t=args.delta_t, start_ts=args.start_ts,
+ mv_iterator = EventsIterator(input_path=args.event_file_path, delta_t=args.delta_t, start_ts=args.start_ts,
max_duration=args.max_duration)
with open(output_file, 'w') as csv_file:
diff --git a/sdk/modules/core/python/samples/metavision_filtering/metavision_filtering.py b/sdk/modules/core/python/samples/metavision_filtering/metavision_filtering.py
index c278ed175..213968208 100644
--- a/sdk/modules/core/python/samples/metavision_filtering/metavision_filtering.py
+++ b/sdk/modules/core/python/samples/metavision_filtering/metavision_filtering.py
@@ -33,8 +33,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Metavision Filtering sample.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
- '-i', '--input-raw-file', dest='input_path', default="",
- help="Path to input RAW file. If not specified, the live stream of the first available camera is used. "
+ '-i', '--input-event-file', dest='event_file_path', default="",
+ help="Path to input event file (RAW or HDF5). If not specified, the camera live stream is used. "
"If it's a camera serial number, it will try to open that camera instead.")
parser.add_argument(
'-r', '--replay_factor', type=float, default=1,
@@ -55,9 +55,9 @@ def main():
" - A: Show all events\n"
" - Q/Escape: Quit the application\n")
- # Events iterator on Camera or RAW file
- mv_iterator = EventsIterator(input_path=args.input_path, delta_t=1000)
- if args.replay_factor > 0 and not is_live_camera(args.input_path):
+ # Events iterator on Camera or event file
+ mv_iterator = EventsIterator(input_path=args.event_file_path, delta_t=1000)
+ if args.replay_factor > 0 and not is_live_camera(args.event_file_path):
mv_iterator = LiveReplayEventsIterator(mv_iterator, replay_factor=args.replay_factor)
height, width = mv_iterator.get_size() # Camera Geometry
diff --git a/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started.py b/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started.py
index 5b209e252..f6703d24d 100644
--- a/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started.py
+++ b/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started.py
@@ -25,8 +25,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Metavision SDK Get Started sample.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
- '-i', '--input-raw-file', dest='input_path', default="",
- help="Path to input RAW file. If not specified, the live stream of the first available camera is used. "
+ '-i', '--input-event-file', dest='event_file_path', default="",
+ help="Path to input event file (RAW or HDF5). If not specified, the camera live stream is used. "
"If it's a camera serial number, it will try to open that camera instead.")
args = parser.parse_args()
return args
@@ -36,8 +36,8 @@ def main():
""" Main """
args = parse_args()
- # Events iterator on Camera or RAW file
- mv_iterator = EventsIterator(input_path=args.input_path, delta_t=1000)
+ # Events iterator on Camera or event file
+ mv_iterator = EventsIterator(input_path=args.event_file_path, delta_t=1000)
height, width = mv_iterator.get_size() # Camera Geometry
# Window - Graphical User Interface
@@ -92,7 +92,7 @@ def on_cd_frame_cb(ts, cd_frame):
duration_seconds = global_max_t / 1.0e6
print(f"There were {global_counter} events in total.")
print(f"The total duration was {duration_seconds:.2f} seconds.")
- if duration_seconds >= 1: # No need to print this statistics if the video was too short
+ if duration_seconds >= 1: # No need to print this statistics if the total duration was too short
print(f"There were {global_counter / duration_seconds :.2f} events per second on average.")
diff --git a/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started_v1.py b/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started_v1.py
index 707332931..7a7fcaaa7 100644
--- a/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started_v1.py
+++ b/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started_v1.py
@@ -21,8 +21,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Metavision SDK Get Started sample.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
- '-i', '--input-raw-file', dest='input_path', default="",
- help="Path to input RAW file. If not specified, the live stream of the first available camera is used. "
+ '-i', '--input-event-file', dest='event_file_path', default="",
+ help="Path to input event file (RAW or HDF5). If not specified, the camera live stream is used. "
"If it's a camera serial number, it will try to open that camera instead.")
args = parser.parse_args()
return args
@@ -32,8 +32,8 @@ def main():
""" Main """
args = parse_args()
- # Events iterator on Camera or RAW file
- mv_iterator = EventsIterator(input_path=args.input_path, delta_t=1000)
+ # Events iterator on Camera or event file
+ mv_iterator = EventsIterator(input_path=args.event_file_path, delta_t=1000)
for evs in mv_iterator:
print("Events are available!")
diff --git a/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started_v2.py b/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started_v2.py
index 829c574b1..1850fdcd8 100644
--- a/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started_v2.py
+++ b/sdk/modules/core/python/samples/metavision_sdk_get_started/metavision_sdk_get_started_v2.py
@@ -21,8 +21,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Metavision SDK Get Started sample.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
- '-i', '--input-raw-file', dest='input_path', default="",
- help="Path to input RAW file. If not specified, the live stream of the first available camera is used. "
+ '-i', '--input-event-file', dest='event_file_path', default="",
+ help="Path to input event file (RAW or HDF5). If not specified, the camera live stream is used. "
"If it's a camera serial number, it will try to open that camera instead.")
args = parser.parse_args()
return args
@@ -32,8 +32,8 @@ def main():
""" Main """
args = parse_args()
- # Events iterator on Camera or RAW file
- mv_iterator = EventsIterator(input_path=args.input_path, delta_t=1000)
+ # Events iterator on Camera or event file
+ mv_iterator = EventsIterator(input_path=args.event_file_path, delta_t=1000)
global_counter = 0 # This will track how many events we processed
global_max_t = 0 # This will track the highest timestamp we processed
@@ -60,7 +60,7 @@ def main():
duration_seconds = global_max_t / 1.0e6
print(f"There were {global_counter} events in total.")
print(f"The total duration was {duration_seconds:.2f} seconds.")
- if duration_seconds >= 1: # No need to print this statistics if the video was too short
+ if duration_seconds >= 1: # No need to print this statistics if the total duration was too short
print(f"There were {global_counter / duration_seconds :.2f} events per second on average.")
diff --git a/sdk/modules/core/python/samples/metavision_simple_viewer/metavision_simple_viewer.py b/sdk/modules/core/python/samples/metavision_simple_viewer/metavision_simple_viewer.py
index b4d519bd7..d982da45d 100644
--- a/sdk/modules/core/python/samples/metavision_simple_viewer/metavision_simple_viewer.py
+++ b/sdk/modules/core/python/samples/metavision_simple_viewer/metavision_simple_viewer.py
@@ -8,7 +8,7 @@
# See the License for the specific language governing permissions and limitations under the License.
"""
-Sample code that demonstrates how to use Metavision SDK to visualize events from a live camera or a RAW file
+Sample code that demonstrates how to use Metavision SDK to visualize events from a live camera or an event file
"""
from metavision_core.event_io import EventsIterator, LiveReplayEventsIterator, is_live_camera
@@ -23,8 +23,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Metavision Simple Viewer sample.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
- '-i', '--input-raw-file', dest='input_path', default="",
- help="Path to input RAW file. If not specified, the live stream of the first available camera is used. "
+ '-i', '--input-event-file', dest='event_file_path', default="",
+ help="Path to input event file (RAW, DAT or HDF5). If not specified, the camera live stream is used. "
"If it's a camera serial number, it will try to open that camera instead.")
args = parser.parse_args()
return args
@@ -34,12 +34,12 @@ def main():
""" Main """
args = parse_args()
- # Events iterator on Camera or RAW file
- mv_iterator = EventsIterator(input_path=args.input_path, delta_t=1000)
+ # Events iterator on Camera or event file
+ mv_iterator = EventsIterator(input_path=args.event_file_path, delta_t=1000)
height, width = mv_iterator.get_size() # Camera Geometry
# Helper iterator to emulate realtime
- if not is_live_camera(args.input_path):
+ if not is_live_camera(args.event_file_path):
mv_iterator = LiveReplayEventsIterator(mv_iterator)
# Window - Graphical User Interface
diff --git a/sdk/modules/core/python/samples/metavision_time_surface/metavision_time_surface.py b/sdk/modules/core/python/samples/metavision_time_surface/metavision_time_surface.py
index 3423e42d9..cf89e94f1 100644
--- a/sdk/modules/core/python/samples/metavision_time_surface/metavision_time_surface.py
+++ b/sdk/modules/core/python/samples/metavision_time_surface/metavision_time_surface.py
@@ -24,8 +24,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Metavision Time Surface sample.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
- '-i', '--input-raw-file', dest='input_path', default="",
- help="Path to input RAW file. If not specified, the live stream of the first available camera is used. "
+ '-i', '--input-event-file', dest='event_file_path', default="",
+ help="Path to input event file (RAW or HDF5). If not specified, the camera live stream is used. "
"If it's a camera serial number, it will try to open that camera instead.")
args = parser.parse_args()
return args
@@ -37,12 +37,12 @@ def main():
last_processed_timestamp = 0
- # Events iterator on Camera or RAW file
- mv_iterator = EventsIterator(input_path=args.input_path, delta_t=10000)
+ # Events iterator on Camera or event file
+ mv_iterator = EventsIterator(input_path=args.event_file_path, delta_t=10000)
height, width = mv_iterator.get_size() # Camera Geometry
# Helper iterator to emulate realtime
- if not is_live_camera(args.input_path):
+ if not is_live_camera(args.event_file_path):
mv_iterator = LiveReplayEventsIterator(mv_iterator)
# Window - Graphical User Interface
diff --git a/sdk/modules/core_ml/python/pypkg/metavision_core_ml/data/camera_poses.py b/sdk/modules/core_ml/python/pypkg/metavision_core_ml/data/camera_poses.py
index 8bf86f296..c337f8e80 100644
--- a/sdk/modules/core_ml/python/pypkg/metavision_core_ml/data/camera_poses.py
+++ b/sdk/modules/core_ml/python/pypkg/metavision_core_ml/data/camera_poses.py
@@ -80,7 +80,7 @@ def generate_image_homography(rvec, tvec, nt, depth, K, Kinv):
tvec (np.array): translation vector
nt (np.array): normal to camera
depth (float): depth
- K (np.array): intrisic matrix
+ K (np.array): intrinsic matrix
Kinv (np.array): inverse intrinsic matrix
"""
H = generate_homography(rvec, tvec, nt, depth)
@@ -241,8 +241,8 @@ def get_flow(rvec1, tvec1, rvec2, tvec2, nt, depth, K, Kinv, height, width):
tvec2 (np.array): translation vector 2
nt (np.array): plane normal
depth (float): depth from camera
- K (np.array): intrisic matrix
- Kinv (np.array): inverse intrisic matrix
+ K (np.array): intrinsic matrix
+ Kinv (np.array): inverse intrinsic matrix
height (int): height of image
width (int): width of image
infinite (bool): plan is infinite or not
diff --git a/sdk/modules/driver/cpp/include/metavision/sdk/driver/camera.h b/sdk/modules/driver/cpp/include/metavision/sdk/driver/camera.h
index 9aedad579..186430166 100644
--- a/sdk/modules/driver/cpp/include/metavision/sdk/driver/camera.h
+++ b/sdk/modules/driver/cpp/include/metavision/sdk/driver/camera.h
@@ -169,10 +169,12 @@ class Camera {
/// @brief Initializes a camera instance from the first available camera plugged on the system
///
- /// Open the first available camera following at first EMBEDDED and then USB order.\n
+ /// Open the first available camera following at first EMBEDDED and then USB order.
+ ///
/// Please note that remote cameras will not be opened with this function. To do that,
/// please specify the @ref OnlineSourceType and use the @ref from_source function,
- /// or else specify the serial number and use the @ref from_serial function.\n
+ /// or else specify the serial number and use the @ref from_serial function.
+ ///
/// Serial numbers and types of available sources can be found with @ref list_online_sources function.
///
/// @throw CameraException in case of initialization failure.
@@ -180,10 +182,12 @@ class Camera {
/// @brief Initializes a camera instance from the first available camera plugged on the system
///
- /// Open the first available camera following at first EMBEDDED and then USB order.\n
+ /// Open the first available camera following at first EMBEDDED and then USB order.
+ ///
/// Please note that remote cameras will not be opened with this function. To do that,
/// please specify the @ref OnlineSourceType and use the @ref from_source function,
- /// or else specify the serial number and use the @ref from_serial function.\n
+ /// or else specify the serial number and use the @ref from_serial function.
+ ///
/// Serial numbers and types of available sources can be found with @ref list_online_sources function.
///
/// @throw CameraException in case of initialization failure.
@@ -193,8 +197,10 @@ class Camera {
/// @brief Initializes a camera instance from an @ref OnlineSourceType and a source index
///
- /// Open the source_index camera of online input_source_type if available from @ref list_online_sources"".\n
- /// By default, it opens the first available camera listed by @ref list_online_sources of type input_source_type.\n
+ /// Open the source_index camera of online input_source_type if available from @ref list_online_sources.
+ ///
+ /// By default, it opens the first available camera listed by @ref list_online_sources of type input_source_type.
+ ///
/// Serial numbers and types of available sources can be found with @ref list_online_sources function.
/// @throw CameraException if the camera corresponding to the input source type and the source index has not been
/// found.
@@ -206,12 +212,13 @@ class Camera {
/// @brief Initializes a camera instance from an @ref OnlineSourceType and a source index
///
- /// Open the source_index camera of online input_source_type if available from @ref list_online_sources"".\n
- /// By default, it opens the first available camera listed by @ref list_online_sources of type input_source_type.\n
+ /// Open the source_index camera of online input_source_type if available from @ref list_online_sources.
+ ///
+ /// By default, it opens the first available camera listed by @ref list_online_sources of type input_source_type.
+ ///
/// Serial numbers and types of available sources can be found with @ref list_online_sources function.
/// @throw CameraException if the camera corresponding to the input source type and the source index has not been
/// found.
- ///
/// @param input_source_type @ref OnlineSourceType
/// @param config Configuration used to open the camera
/// @param source_index Index of the source in the list of available online sources
@@ -221,7 +228,8 @@ class Camera {
/// @brief Initializes a camera instance from a 'serial' number
///
- /// Serial numbers of available sources can be found by with @ref list_online_sources function.\n
+ /// Serial numbers of available sources can be found by with @ref list_online_sources function.
+ ///
/// If 'serial' is an empty string, the function works as the main constructor.
///
/// @throw CameraException if the camera with the input serial number has not been found.
@@ -297,7 +305,6 @@ class Camera {
///
/// When a camera runtime error occurs, the camera thread is left and events are no longer sent.
/// You are notified by this callback whenever this happens.
- ///
/// @throw CameraException if the camera has not been initialized.
/// @param error_callback The error callback to call
/// @return ID of the added callback
@@ -325,7 +332,6 @@ class Camera {
CallbackId add_status_change_callback(StatusChangeCallback status_change_callback);
/// @brief Removes a previously registered callback
- ///
/// @param callback_id Callback ID
/// @return true if the callback has been unregistered correctly, false otherwise.
bool remove_status_change_callback(CallbackId callback_id);
@@ -348,9 +354,9 @@ class Camera {
/// @brief Starts the camera from the given input source
///
- /// It will start polling events from the source and calling specified events callbacks.\n
- /// It has no effect if the start function has been already called and not the @ref stop function.
+ /// It will start polling events from the source and calling specified events callbacks.
///
+ /// It has no effect if the start function has been already called and not the @ref stop function.
/// @throw CameraException if the camera has not been initialized.
/// @sa @ref CD::add_callback
/// @sa @ref ExtTrigger::add_callback
@@ -360,16 +366,15 @@ class Camera {
/// @brief Checks if the camera is running or there are data remaining from an offline source
///
- /// If the source is online, it always returns true unless the @ref stop function has been called.\n
- /// If the input is offline (from a file), it returns false whenever no data are remaining in the input file.
+ /// If the source is online, it always returns true unless the @ref stop function has been called.
///
+ /// If the input is offline (from a file), it returns false whenever no data are remaining in the input file.
/// @return true if the camera is running or there are data remaining from an offline source, false otherwise.
bool is_running();
/// @brief Stops polling events from the camera or from the file
///
/// Stops ongoing streaming.
- ///
/// @throw CameraException if the camera has not been initialized.
/// @return true if the camera instance has been stopped successfully, false otherwise. If the camera was not
/// running, this function returns false.
@@ -377,18 +382,19 @@ class Camera {
/// @brief Records data from camera to a file at the specified path
///
- /// The function creates a new file at the given @p file_path or overwrites the already existing file.\n
+ /// The function creates a new file at the given @p file_path or overwrites the already existing file.
+ ///
/// In case of an offline input source, the function can be used to split the file and record only a portion of it.
/// @throw CameraException if the camera has not been initialized.
- /// @warning Calling this function will overwrite the file at the path @p file_path if it already exists.\n
+ /// @warning Calling this function will overwrite the file at the path @p file_path if it already exists.
/// @note This functions is the recommended way to save recording with SDK driver.
/// It uses a separate thread to write the file for efficiency, so it will not slow down the decoding thread
- /// as opposed to \ref I_EventsStream::log_raw_data and \ref I_EventsStream::stop_log_raw_data
- /// It also enables writing to supported formats other than RAW file, altough the writing speed will probably
+ /// as opposed to @ref I_EventsStream::log_raw_data and @ref I_EventsStream::stop_log_raw_data
+ /// It also enables writing to supported formats other than RAW file, although the writing speed will probably
/// decrease for those formats
/// It can also be called several times with different paths to record the stream to multiple files at the same time
/// @note For more control over the way the data is recorded and to select with precision which events
- /// will be recorded, you may directly use the API provided by \ref EventFileWriter and its inherited classes
+ /// will be recorded, you may directly use the API provided by @ref EventFileWriter and its inherited classes
/// For more information, refer to the metavision_file_cutter sample
/// @param file_path Path to the file containing the recorded data
/// @return true if recording could be started, false otherwise
@@ -396,8 +402,9 @@ class Camera {
/// @brief Stops recording data from camera to the specified path
///
- /// This function stops recording data to the file at the given @p file_path.\n
- /// If the @p file_path is empty, all recordings of the current camera stream are stopped.\n
+ /// This function stops recording data to the file at the given @p file_path.
+ ///
+ /// If the @p file_path is empty, all recordings of the current camera stream are stopped.
/// @param file_path Path to the file containing the recorded data. If empty, all ongoing recordings are stopped.
/// @throw CameraException if the camera has not been initialized.
/// @return true if recording could be stopped, false otherwise
@@ -422,15 +429,13 @@ class Camera {
/// @warning If no event decoding callback has been set, this functions returns -1
timestamp get_last_timestamp() const;
- /// @brief Saves the camera to a given file
- ///
- /// @param path The path of the file to save the camera to
+ /// @brief Saves the camera settings to a given file
+ /// @param path The path of the file to save the camera settings to
/// @return true on success
bool save(const std::string &path) const;
- /// @brief Loads the camera from a given file
- ///
- /// @param path The path of the file to load the camera from
+ /// @brief Loads the camera settings from a given file
+ /// @param path The path of the file to load the camera settings from
/// @return true on success
bool load(const std::string &path);
@@ -468,14 +473,12 @@ class Camera {
};
/// @brief Saves the camera to a given stream
-///
/// @param os The output stream in which the camera will be saved
/// @param camera The camera to save
/// @return The modified output stream
std::ostream &operator<<(std::ostream &os, const Camera &camera);
/// @brief Loads the camera from a given stream
-///
/// @param is The input stream from which the camera will be loaded
/// @param camera The camera to load
/// @return The modified input stream
diff --git a/sdk/modules/driver/cpp/samples/metavision_active_pixel_detection/metavision_active_pixel_detection.cpp b/sdk/modules/driver/cpp/samples/metavision_active_pixel_detection/metavision_active_pixel_detection.cpp
index 3bc177b95..768423566 100644
--- a/sdk/modules/driver/cpp/samples/metavision_active_pixel_detection/metavision_active_pixel_detection.cpp
+++ b/sdk/modules/driver/cpp/samples/metavision_active_pixel_detection/metavision_active_pixel_detection.cpp
@@ -200,7 +200,7 @@ int main(int argc, char *argv[]) {
const auto default_calib_output_path = Metavision::GenX320RoiDriver::default_calibration_path();
std::string serial;
- std::string biases_file_path;
+ std::string cam_config_path;
std::string calib_output_path;
const double default_duration = 0.1;
double duration;
@@ -242,11 +242,11 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("serial,s", po::value(&serial),"Serial ID of the camera. If not provided, the first available camera will be used.")
- ("biases,b", po::value(&biases_file_path), "Path to a biases file. If not specified, the camera will be configured with the default biases.")
- ("duration,d", po::value(&duration)->default_value(default_duration),"Duration in second of the calibration, the pixels will be analyzed during this period.")
- ("min-event-count,n", po::value(&min_event_count)->default_value(default_min_event_count),"Minimum number of events to be acquired before starting the calibration.")
- ("output-calib,o", po::value(&calib_output_path)->default_value(default_calib_output_path.generic_string()), "Path to an output file used to save the result of the active pixels detection.\n"
+ ("serial,s", po::value(&serial),"Serial ID of the camera. If not provided, the first available camera will be used.")
+ ("input-camera-config,j", po::value(&cam_config_path), "Path to a JSON file containing camera config settings to restore a camera state. Only works for live cameras.")
+ ("duration,d", po::value(&duration)->default_value(default_duration),"Duration in second of the calibration, the pixels will be analyzed during this period.")
+ ("min-event-count,n", po::value(&min_event_count)->default_value(default_min_event_count),"Minimum number of events to be acquired before starting the calibration.")
+ ("output-calib,o", po::value(&calib_output_path)->default_value(default_calib_output_path.generic_string()), "Path to an output file used to save the result of the active pixels detection.\n"
"The default path should be used if the calibration should be applied automatically when the camera starts.\n"
"A custom path can be used to save the calibration data, but it won't be automatically loaded and applied when the camera starts.")
;
@@ -301,8 +301,8 @@ int main(int argc, char *argv[]) {
camera = Metavision::Camera::from_first_available(config);
}
- if (biases_file_path != "") {
- camera.biases().set_from_file(biases_file_path);
+ if (!cam_config_path.empty()) {
+ camera.load(cam_config_path);
}
camera_is_opened = true;
diff --git a/sdk/modules/driver/cpp/samples/metavision_file_cutter/metavision_file_cutter.cpp b/sdk/modules/driver/cpp/samples/metavision_file_cutter/metavision_file_cutter.cpp
index 61f9879c4..408ee1486 100644
--- a/sdk/modules/driver/cpp/samples/metavision_file_cutter/metavision_file_cutter.cpp
+++ b/sdk/modules/driver/cpp/samples/metavision_file_cutter/metavision_file_cutter.cpp
@@ -32,8 +32,8 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("input-file,i", po::value(&in_file_path)->required(), "Path to input file.")
- ("output-file,o", po::value(&out_file_path)->required(), "Path to output file.")
+ ("input-event-file,i", po::value(&in_file_path)->required(), "Path to input file.")
+ ("output-file,o", po::value(&out_file_path)->required(), "Path to output file.")
("start,s", po::value(&start)->required(), "The start of the required sequence in seconds.")
("end,e", po::value(&end)->required(), "The end of the required sequence in seconds.")
;
diff --git a/sdk/modules/driver/cpp/samples/metavision_file_info/metavision_file_info.cpp b/sdk/modules/driver/cpp/samples/metavision_file_info/metavision_file_info.cpp
index 9e2a102c7..42e8bc8de 100644
--- a/sdk/modules/driver/cpp/samples/metavision_file_info/metavision_file_info.cpp
+++ b/sdk/modules/driver/cpp/samples/metavision_file_info/metavision_file_info.cpp
@@ -9,7 +9,7 @@
* See the License for the specific language governing permissions and limitations under the License. *
**********************************************************************************************************************/
-// Example of using Metavision SDK Driver API to get information about a file.
+// Example of using Metavision SDK Driver API to get information about an event file.
#include
#include
@@ -67,13 +67,13 @@ std::string human_readable_time(Metavision::timestamp t) {
int main(int argc, char *argv[]) {
std::string in_file_path;
- const std::string program_desc("Application to get information about a file\n");
+ const std::string program_desc("Application to get information about an event file\n");
po::options_description options_desc("Options");
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("input-file,i", po::value(&in_file_path)->required(), "Path to input file.")
+ ("input-event-file,i", po::value(&in_file_path)->required(), "Path to input event file (RAW, DAT or HDF5).")
;
// clang-format on
diff --git a/sdk/modules/driver/cpp/samples/metavision_file_to_csv/metavision_file_to_csv.cpp b/sdk/modules/driver/cpp/samples/metavision_file_to_csv/metavision_file_to_csv.cpp
index 5e6b89335..0e9f46285 100644
--- a/sdk/modules/driver/cpp/samples/metavision_file_to_csv/metavision_file_to_csv.cpp
+++ b/sdk/modules/driver/cpp/samples/metavision_file_to_csv/metavision_file_to_csv.cpp
@@ -9,8 +9,8 @@
* See the License for the specific language governing permissions and limitations under the License. *
**********************************************************************************************************************/
-// This code sample demonstrates how to use Metavision SDK Driver to convert an event-based
-// file to a CSV formatted event-based file.
+// This code sample demonstrates how to use Metavision SDK Driver to convert an event file
+// to a CSV formatted event file.
#include
#include
@@ -41,7 +41,7 @@ class CSVWriter {
namespace po = boost::program_options;
int main(int argc, char *argv[]) {
- std::string in_file_path;
+ std::string event_file_path;
std::string out_file_path;
const std::string program_desc(
@@ -52,8 +52,8 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("input-file,i", po::value(&in_file_path)->required(), "Path to the input file.")
- ("output-file,o", po::value(&out_file_path)->default_value(""), "Path to the output file.")
+ ("input-event-file,i", po::value(&event_file_path)->required(), "Path to the input event file.")
+ ("output-file,o", po::value(&out_file_path)->default_value(""), "Path to the output CSV file.")
;
// clang-format on
@@ -76,14 +76,14 @@ int main(int argc, char *argv[]) {
// get the base of the input filename and the path
if (out_file_path.empty()) {
- const std::string output_base = std::regex_replace(in_file_path, std::regex("\\.[^.]*$"), "");
+ const std::string output_base = std::regex_replace(event_file_path, std::regex("\\.[^.]*$"), "");
out_file_path = output_base + ".csv";
}
// open the file that was passed
Metavision::Camera cam;
try {
- cam = Metavision::Camera::from_file(in_file_path, Metavision::FileConfigHints().real_time_playback(false));
+ cam = Metavision::Camera::from_file(event_file_path, Metavision::FileConfigHints().real_time_playback(false));
} catch (Metavision::CameraException &e) {
MV_LOG_ERROR() << e.what();
return 1;
diff --git a/sdk/modules/driver/cpp/samples/metavision_file_to_dat/metavision_file_to_dat.cpp b/sdk/modules/driver/cpp/samples/metavision_file_to_dat/metavision_file_to_dat.cpp
index af9fb9db5..d345b4581 100644
--- a/sdk/modules/driver/cpp/samples/metavision_file_to_dat/metavision_file_to_dat.cpp
+++ b/sdk/modules/driver/cpp/samples/metavision_file_to_dat/metavision_file_to_dat.cpp
@@ -9,7 +9,7 @@
* See the License for the specific language governing permissions and limitations under the License. *
**********************************************************************************************************************/
-// This application demonstrates how to use Metavision SDK Driver to convert a file to DAT file.
+// This application demonstrates how to use Metavision SDK Driver to convert a RAW or HDF5 event file to a DAT file.
#include
#include
@@ -26,15 +26,15 @@
namespace po = boost::program_options;
int main(int argc, char *argv[]) {
- std::string in_file_path;
+ std::string event_file_path;
- const std::string program_desc("Application to convert a file to DAT file.\n");
+ const std::string program_desc("Application to convert a RAW or HDF5 event file to a DAT file.\n");
po::options_description options_desc("Options");
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("input-file,i", po::value(&in_file_path)->required(), "Path to input file.")
+ ("input-event-file,i", po::value(&event_file_path)->required(), "Path to input event file (RAW or HDF5).")
;
// clang-format on
@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) {
Metavision::Camera camera;
try {
- camera = Metavision::Camera::from_file(in_file_path, Metavision::FileConfigHints().real_time_playback(false));
+ camera = Metavision::Camera::from_file(event_file_path, Metavision::FileConfigHints().real_time_playback(false));
} catch (Metavision::CameraException &e) {
MV_LOG_ERROR() << e.what();
return 1;
@@ -67,7 +67,7 @@ int main(int argc, char *argv[]) {
const unsigned short height = camera.geometry().height();
// get the base of the input filename and the path
- const std::string output_base = std::regex_replace(in_file_path, std::regex("\\.[^.]*$"), "");
+ const std::string output_base = std::regex_replace(event_file_path, std::regex("\\.[^.]*$"), "");
// setup feedback to be provided on processing progression
using namespace std::chrono_literals;
diff --git a/sdk/modules/driver/cpp/samples/metavision_file_to_hdf5/metavision_file_to_hdf5.cpp b/sdk/modules/driver/cpp/samples/metavision_file_to_hdf5/metavision_file_to_hdf5.cpp
index 1f7e35b4f..5109859c3 100644
--- a/sdk/modules/driver/cpp/samples/metavision_file_to_hdf5/metavision_file_to_hdf5.cpp
+++ b/sdk/modules/driver/cpp/samples/metavision_file_to_hdf5/metavision_file_to_hdf5.cpp
@@ -9,8 +9,8 @@
* See the License for the specific language governing permissions and limitations under the License. *
**********************************************************************************************************************/
-// This application demonstrates how to use Metavision SDK Core pipeline utility and SDK Driver to convert a file
-// to HDF5 file.
+// This application demonstrates how to use Metavision SDK Core pipeline utility and SDK Driver to convert
+// an event file to an HDF5 file.
#include
#include
@@ -34,7 +34,7 @@ int convert_file_to_hdf5(const std::filesystem::path &in_file_path, const std::f
MV_LOG_ERROR() << "Error: output file: '" << out_hdf5_file_path << "'";
return 1;
}
- if (!std::filesystem::exists(out_hdf5_file_path.parent_path())) {
+ if (!out_hdf5_file_path.parent_path().empty() && !std::filesystem::exists(out_hdf5_file_path.parent_path())) {
std::filesystem::create_directories(out_hdf5_file_path.parent_path());
}
@@ -66,11 +66,11 @@ int convert_file_to_hdf5(const std::filesystem::path &in_file_path, const std::f
// Gets the wrapped camera from the stage to extract sensor's resolution
Metavision::Camera &cam = cam_stage.camera();
- // Build a HDF5 file writer
+ // Build an HDF5 file writer
Metavision::HDF5EventFileWriter hdf5_writer(out_hdf5_file_path.string());
hdf5_writer.add_metadata_map_from_camera(cam);
- // 1) Stage that will write CD events to a HDF5 file
+ // 1) Stage that will write CD events to an HDF5 file
auto cd_stage_ptr = std::make_unique();
cd_stage_ptr->set_consuming_callback([&hdf5_writer](const boost::any &data) {
try {
@@ -80,7 +80,7 @@ int convert_file_to_hdf5(const std::filesystem::path &in_file_path, const std::f
});
p.add_stage(std::move(cd_stage_ptr), cam_stage);
- // 2) Stage that will write external triggers events to a HDF5 file
+ // 2) Stage that will write external triggers events to an HDF5 file
try {
cam.ext_trigger().add_callback(
[&cam_stage](const Metavision::EventExtTrigger *begin, const Metavision::EventExtTrigger *end) {
@@ -134,7 +134,7 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("input-path,i", po::value(&in_path)->required(), "Path to input file or folder.")
+ ("input-path,i", po::value(&in_path)->required(), "Path to input event file or folder.")
("output-path,o", po::value(&out_path)->default_value(""), "Path to output file or folder. If not specified, will use the same as input.")
("recursive,r", po::bool_switch(&recursive_mode), "If specified, iterate over all files in the specified folder and sub-folders.")
("filename-pattern,p", po::value(&filename_pattern), "Regex to match filenames to be converted, required in recursive mode.")
diff --git a/sdk/modules/driver/cpp/samples/metavision_file_to_hdf5/test/metavision_file_to_hdf5_pytest.py b/sdk/modules/driver/cpp/samples/metavision_file_to_hdf5/test/metavision_file_to_hdf5_pytest.py
index a8100243c..c0b2d2da5 100644
--- a/sdk/modules/driver/cpp/samples/metavision_file_to_hdf5/test/metavision_file_to_hdf5_pytest.py
+++ b/sdk/modules/driver/cpp/samples/metavision_file_to_hdf5/test/metavision_file_to_hdf5_pytest.py
@@ -111,6 +111,7 @@ def run_file_to_hdf5_on_recording_and_check_result(
# Get data
triggers = f["EXT_TRIGGER"]["events"]
+
assert triggers.size == number_trigger_expected
# Check first 10 events :
@@ -211,7 +212,7 @@ def pytestcase_test_metavision_file_to_hdf5_missing_input_args():
def pytestcase_test_metavision_file_to_hdf5_input_file_already_hdf5(dataset_dir):
"""
- Checks that metavision_file_to_hdf5 returns an error when passing a HDF5 file as input
+ Checks that metavision_file_to_hdf5 returns an error when passing an HDF5 file as input
"""
filename = "gen31_timer.hdf5"
diff --git a/sdk/modules/driver/cpp/samples/metavision_viewer/metavision_viewer.cpp b/sdk/modules/driver/cpp/samples/metavision_viewer/metavision_viewer.cpp
index 0cd6092a7..ffcac0bce 100644
--- a/sdk/modules/driver/cpp/samples/metavision_viewer/metavision_viewer.cpp
+++ b/sdk/modules/driver/cpp/samples/metavision_viewer/metavision_viewer.cpp
@@ -134,7 +134,7 @@ int main(int argc, char *argv[]) {
std::string serial;
std::string biases_file;
- std::string in_file_path;
+ std::string event_file_path;
std::string in_cam_config_path;
std::string out_file_path;
std::string out_cam_config_path;
@@ -143,13 +143,14 @@ int main(int argc, char *argv[]) {
bool do_retry = false;
const std::string short_program_desc(
- "Simple viewer to stream events from a file or device, using the SDK driver API.\n");
+ "Simple viewer to stream events from an event file or a device, using the SDK driver API.\n");
std::string long_program_desc(short_program_desc +
+ "Define a region using the cursor (click and drag) to set a Region of Interest (ROI)\n"
"Press SPACE key while running to record or stop recording raw data\n"
"Press 'q' or Escape key to leave the program.\n"
"Press 'o' to toggle the on screen display.\n"
- "Press 'l' to load the camera state from the input camera config file.\n"
- "Press 's' to save the camera state to the output camera config file.\n"
+ "Press 'l' to load the camera settings from the input camera config file.\n"
+ "Press 's' to save the camera settings to the output camera config file.\n"
"Press 'r' to toggle the hardware ROI mode (window mode or lines mode, default: window mode).\n"
"Press 'R' to toggle the ROI/RONI mode.\n"
"Press 'e' to toggle the ERC module (if available).\n"
@@ -161,13 +162,13 @@ int main(int argc, char *argv[]) {
// clang-format off
options_desc.add_options()
("help,h", "Produce help message.")
- ("serial,s", po::value(&serial),"Serial ID of the camera. This flag is incompatible with flag '--input-file'.")
- ("input-file,i", po::value(&in_file_path), "Path to input file. If not specified, the camera live stream is used.")
- ("input-camera-config", po::value(&in_cam_config_path), "Path to a file containing camera config settings to restore a camera state. Only works for live cameras.")
- ("biases,b", po::value(&biases_file), "Path to a biases file. If not specified, the camera will be configured with the default biases.")
- ("output-file,o", po::value(&out_file_path)->default_value("data.raw"), "Path to an output file used for data recording. Default value is 'data.raw'. It also works when reading data from a file.")
- ("output-camera-config", po::value(&out_cam_config_path)->default_value("settings.json"), "Path to a file that will contain the camera state. Default value is 'settings.json'. Only works for live camera.")
- ("roi,r", po::value>(&roi)->multitoken(), "Hardware ROI to set on the sensor in the format [x y width height].")
+ ("serial,s", po::value(&serial),"Serial ID of the camera. This flag is incompatible with flag '--input-event-file'.")
+ ("input-event-file,i", po::value(&event_file_path), "Path to input event file (RAW, DAT or HDF5). If not specified, the camera live stream is used.")
+ ("input-camera-config,j", po::value(&in_cam_config_path), "Path to a JSON file containing camera config settings to restore a camera state. Only works for live cameras.")
+ ("biases,b", po::value(&biases_file), "Path to a biases file. If not specified, the camera will be configured with the default biases.")
+ ("output-file,o", po::value(&out_file_path)->default_value("data.raw"), "Path to an output file used for data recording. Default value is 'data.raw'. It also works when reading data from a file.")
+ ("output-camera-config", po::value(&out_cam_config_path)->default_value("settings.json"), "Path to a JSON file where to save the camera config settings. Default value is 'settings.json'. Only works for live camera.")
+ ("roi,r", po::value>(&roi)->multitoken(), "Hardware ROI to set on the sensor in the format [x y width height].")
;
// clang-format on
@@ -188,7 +189,7 @@ int main(int argc, char *argv[]) {
return 0;
}
- if (!in_file_path.empty()) {
+ if (!event_file_path.empty()) {
long_program_desc += "\nIf available, you can also:\n"
"Press 'b' key to seek backward 1s\n"
"Press 'f' key to seek forward 1s\n";
@@ -197,8 +198,8 @@ int main(int argc, char *argv[]) {
MV_LOG_INFO() << long_program_desc;
if (vm.count("roi")) {
- if (!in_file_path.empty()) {
- MV_LOG_ERROR() << "Options --roi and --input-file are not compatible.";
+ if (!event_file_path.empty()) {
+ MV_LOG_ERROR() << "Options --roi and --input-event-file are not compatible.";
return 1;
}
if (roi.size() != 4) {
@@ -212,15 +213,15 @@ int main(int argc, char *argv[]) {
bool camera_is_opened = false;
// If the filename is set, then read from the file
- if (!in_file_path.empty()) {
+ if (!event_file_path.empty()) {
if (!serial.empty()) {
- MV_LOG_ERROR() << "Options --serial and --input-file are not compatible.";
+ MV_LOG_ERROR() << "Options --serial and --input-event-file are not compatible.";
return 1;
}
try {
Metavision::FileConfigHints hints;
- camera = Metavision::Camera::from_file(in_file_path, hints);
+ camera = Metavision::Camera::from_file(event_file_path, hints);
camera_is_opened = true;
} catch (Metavision::CameraException &e) { MV_LOG_ERROR() << e.what(); }
// Otherwise, set the input source to a camera
@@ -242,9 +243,6 @@ int main(int argc, char *argv[]) {
camera.biases().set_from_file(biases_file);
}
- if (!roi.empty()) {
- camera.roi().set({roi[0], roi[1], roi[2], roi[3]});
- }
camera_is_opened = true;
} catch (Metavision::CameraException &e) { MV_LOG_ERROR() << e.what(); }
}
@@ -280,7 +278,7 @@ int main(int argc, char *argv[]) {
});
// Get the geometry of the camera
- auto &geometry = camera.geometry(); // Get the geometry of the camera
+ const auto &geometry = camera.geometry();
// Setup CD event rate estimator
double avg_rate, peak_rate;
@@ -311,8 +309,13 @@ int main(int argc, char *argv[]) {
max_roi_windows = camera.roi().get_facility()->get_max_supported_windows_count();
} catch (...) {}
RoiControl roi_ctrl(geometry.width(), geometry.height(), max_roi_windows);
- roi_ctrl.need_refresh = roi.size() != 0;
roi_ctrl.use_windows = true;
+ if (roi.size() != 0) {
+ roi_ctrl.need_refresh = true;
+ roi_ctrl.windows.push_back({roi[0], roi[1], roi[2], roi[3]});
+ } else {
+ roi_ctrl.need_refresh = false;
+ }
// Setup CD frame display
std::string cd_window_name("CD Events");
@@ -342,7 +345,7 @@ int main(int argc, char *argv[]) {
bool osc_ready = false;
bool osd = true;
- if (!in_file_path.empty()) {
+ if (!event_file_path.empty()) {
try {
camera.offline_streaming_control().is_ready();
osc_available = true;
@@ -350,7 +353,7 @@ int main(int argc, char *argv[]) {
}
while (!signal_caught && camera.is_running()) {
- if (!in_file_path.empty() && osc_available) {
+ if (!event_file_path.empty() && osc_available) {
try {
osc_ready = camera.offline_streaming_control().is_ready();
} catch (Metavision::CameraException &e) { MV_LOG_ERROR() << e.what(); }
diff --git a/sdk/modules/driver/cpp/src/camera.cpp b/sdk/modules/driver/cpp/src/camera.cpp
index d2e02f880..31b192fb0 100644
--- a/sdk/modules/driver/cpp/src/camera.cpp
+++ b/sdk/modules/driver/cpp/src/camera.cpp
@@ -651,7 +651,7 @@ bool Camera::save(const std::string &path) const {
if (!ofs.is_open()) {
throw CameraException(CameraErrorCode::CouldNotOpenFile,
"Could not open file '" + path +
- "' to save a camera to. Make sure it is a valid filename and that you have "
+ "' to save camera settings to. Make sure it is a valid filename and that you have "
"permissions to write it.");
}
@@ -664,7 +664,7 @@ bool Camera::load(const std::string &path) {
if (!ifs.is_open()) {
throw CameraException(CameraErrorCode::CouldNotOpenFile,
"Could not open file '" + path +
- "' to load a camera from. Make sure it is a valid filename and that you have "
+ "' to load camera settings from. Make sure it is a valid filename and that you have "
"permissions to read it.");
}
diff --git a/sdk/modules/driver/cpp/src/hdf5_event_file_writer.cpp b/sdk/modules/driver/cpp/src/hdf5_event_file_writer.cpp
index 48c1a23f3..263219d8a 100644
--- a/sdk/modules/driver/cpp/src/hdf5_event_file_writer.cpp
+++ b/sdk/modules/driver/cpp/src/hdf5_event_file_writer.cpp
@@ -11,6 +11,7 @@
#include
#include
+
#ifdef HAS_HDF5
#include
#include
@@ -80,17 +81,22 @@ class EventsWriter {
}
bool sync() {
- hsize_t dims[1] = {offset_ + pos_};
- dset_.extend(dims);
hsize_t offset[1] = {offset_};
size_t num_bytes_in_chunk;
+
if (encoding_cb_) {
+ hsize_t dims[1] = {offset_ + pos_};
+ dset_.extend(dims);
+
num_bytes_in_chunk = encoding_cb_(events_.data(), events_.data() + pos_, outbuf_.data());
if (H5Dwrite_chunk(dset_.getId(), H5P_DEFAULT, 0, offset, num_bytes_in_chunk, outbuf_.data()) < 0) {
return false;
}
} else {
- num_bytes_in_chunk = pos_ * sizeof(EventType);
+ hsize_t dims[1] = {offset_ + pos_};
+ dset_.extend(dims);
+
+ num_bytes_in_chunk = chunk_size_ * sizeof(EventType);
if (H5Dwrite_chunk(dset_.getId(), H5P_DEFAULT, 0, offset, num_bytes_in_chunk, events_.data()) < 0) {
return false;
}
@@ -174,8 +180,10 @@ class IndexesWriter {
hsize_t dims[1] = {offset_ + pos_};
dset_.extend(dims);
hsize_t offset[1] = {offset_};
- size_t num_bytes_in_chunk = pos_ * sizeof(Index);
- if (H5Dwrite_chunk(dset_.getId(), H5P_DEFAULT, 0, offset, num_bytes_in_chunk, indexes_.data()) < 0) {
+ size_t num_bytes_in_chunk = chunk_size_ * sizeof(Index);
+
+ auto error_code = H5Dwrite_chunk(dset_.getId(), H5P_DEFAULT, 0, offset, num_bytes_in_chunk, indexes_.data());
+ if (error_code < 0) {
return false;
}
return true;
@@ -253,10 +261,10 @@ class HDF5EventFileWriter::Private {
cd_event_ds_prop.setChunk(1, chunk_dims);
cd_event_ds_prop.setFilter(H5Z_FILTER_ECF, H5Z_FLAG_OPTIONAL, 0, nullptr);
+ H5::DataSpace cd_index_ds(1, dims, maxdims);
H5::CompType cd_index_dt(sizeof(Index));
cd_index_dt.insertMember("id", HOFFSET(Index, id), H5::PredType::NATIVE_ULLONG);
cd_index_dt.insertMember("ts", HOFFSET(Index, ts), H5::PredType::NATIVE_LLONG);
- H5::DataSpace cd_index_ds(1, dims, maxdims);
H5::DSetCreatPropList cd_index_ds_prop;
cd_index_ds_prop.setChunk(1, chunk_dims);
@@ -396,7 +404,7 @@ class HDF5EventFileWriter::Private {
};
HDF5EventFileWriter::HDF5EventFileWriter(const std::string &path,
- const std::unordered_map &metadata_map) :
+ const std::unordered_map &metadata_map) :
EventFileWriter(path), pimpl_(new Private(*this, path, metadata_map)) {}
HDF5EventFileWriter::~HDF5EventFileWriter() {
diff --git a/sdk/modules/driver/cpp/tests/CMakeLists.txt b/sdk/modules/driver/cpp/tests/CMakeLists.txt
index bea7c07cc..d0f66e077 100644
--- a/sdk/modules/driver/cpp/tests/CMakeLists.txt
+++ b/sdk/modules/driver/cpp/tests/CMakeLists.txt
@@ -66,7 +66,7 @@ if (Protobuf_FOUND)
endif()
target_include_directories(gtest_metavision_sdk_driver PRIVATE
- ${CMAKE_SOURCE_DIR}/sdk/modules/driver/cpp/src/include
+ ${PROJECT_SOURCE_DIR}/sdk/modules/driver/cpp/src/include
${GENERATE_FILES_DIRECTORY}
)
diff --git a/sdk/modules/driver/cpp/tests/event_file_reader_writer_gtest.cpp b/sdk/modules/driver/cpp/tests/event_file_reader_writer_gtest.cpp
index 60e06ef79..8651dbc4f 100644
--- a/sdk/modules/driver/cpp/tests/event_file_reader_writer_gtest.cpp
+++ b/sdk/modules/driver/cpp/tests/event_file_reader_writer_gtest.cpp
@@ -954,7 +954,7 @@ TEST_F(HDF5EventFileWriter_Gtest, simple_write_triggers) {
HDF5EventFileReader reader(tmp_file_);
size_t num_calls = 0;
reader.add_read_callback([&num_calls](const EventExtTrigger *begin, const EventExtTrigger *end) {
- ASSERT_EQ(1, std::distance(begin, end));
+ ASSERT_EQ(1, std::distance(begin, end));
ASSERT_EQ(0, begin->p);
ASSERT_EQ(0, begin->t);
ASSERT_EQ(0, begin->id);
@@ -1060,6 +1060,7 @@ TEST_F(HDF5EventFileWriter_Gtest, write_first_ts_is_big) {
H5::DataSpace ds = dset.getSpace();
hsize_t dims[1];
ds.getSimpleExtentDims(dims, nullptr);
+
ASSERT_EQ(expected_indexes.size(), dims[0]);
std::vector indexes(dims[0]);
@@ -1127,14 +1128,18 @@ TEST_F(HDF5EventFileWriter_Gtest, random_writes) {
while (reader.read()) {
std::this_thread::yield();
}
+
ASSERT_EQ(expected_events_cd.size(), events_cd.size());
+
for (size_t i = 0; i < expected_events_cd.size(); ++i) {
ASSERT_EQ(expected_events_cd[i].x, events_cd[i].x);
ASSERT_EQ(expected_events_cd[i].y, events_cd[i].y);
ASSERT_EQ(expected_events_cd[i].p, events_cd[i].p);
ASSERT_EQ(expected_events_cd[i].t, events_cd[i].t);
}
+
ASSERT_EQ(expected_events_trigger.size(), events_trigger.size());
+
for (size_t i = 0; i < expected_events_trigger.size(); ++i) {
ASSERT_EQ(expected_events_trigger[i].p, events_trigger[i].p);
ASSERT_EQ(expected_events_trigger[i].id, events_trigger[i].id);
diff --git a/standalone_samples/metavision_evt2_raw_file_decoder/metavision_evt2_raw_file_decoder.cpp b/standalone_samples/metavision_evt2_raw_file_decoder/metavision_evt2_raw_file_decoder.cpp
index ab0805f2c..3ec913de3 100644
--- a/standalone_samples/metavision_evt2_raw_file_decoder/metavision_evt2_raw_file_decoder.cpp
+++ b/standalone_samples/metavision_evt2_raw_file_decoder/metavision_evt2_raw_file_decoder.cpp
@@ -11,16 +11,18 @@
#include
#include
+#include
#include
#include
#include
+#include
namespace Metavision {
namespace Evt2 {
enum class EventTypes : uint8_t {
- CD_LOW = 0x00, // CD event, decrease in illumination (polarity '0')
- CD_HIGH = 0x01, // CD event, increase in illumination (polarity '1')
+ CD_OFF = 0x00, // CD OFF event, decrease in illumination (polarity '0')
+ CD_ON = 0x01, // CD ON event, increase in illumination (polarity '1')
EVT_TIME_HIGH = 0x08, // Encodes the higher portion of the timebase (range 33 to 6). Since it encodes the 28 higher
// bits over the 34 used to encode a timestamp, it has a resolution of 64us (= 2^(34-28)) and
// it can encode time values from 0us to 17179869183us (~ 4h46m20s). After
@@ -43,7 +45,7 @@ struct RawEventCD {
unsigned int y : 11; // Pixel Y coordinate
unsigned int x : 11; // Pixel X coordinate
unsigned int timestamp : 6; // Least significant bits of the event time ba
- unsigned int type : 4; // Event type : EventTypes::CD_LOW or EventTypes::CD_HIGH
+ unsigned int type : 4; // Event type : EventTypes::CD_OFF or EventTypes::CD_ON
};
struct RawEventExtTrigger {
unsigned int value : 1; // Trigger current value (edge polarity):
@@ -61,6 +63,12 @@ using timestamp_t = uint64_t; // Type for timestamp, in microseconds
} // namespace Evt2
} // namespace Metavision
+/// @brief Structure containing metadata describing the input file
+struct Metadata {
+ int sensor_width = -1,
+ sensor_height = -1; // Sensor width & height
+};
+
int main(int argc, char *argv[]) {
// Check input arguments validity
if (argc < 3) {
@@ -71,8 +79,9 @@ int main(int argc, char *argv[]) {
std::cerr << "Trigger output file will be written only if given as input" << std::endl;
std::cerr << std::endl << "Example : " << std::string(argv[0]) << " input_file.raw cd_output.csv" << std::endl;
std::cerr << std::endl;
- std::cerr << "The CD CSV file will have the format : x,y,polarity,timestamp" << std::endl;
- std::cerr << "The Trigger output CSV file will have the format : value,id,timestamp" << std::endl;
+ std::cerr << "The CD CSV file header will have the format : %geometry:width,height" << std::endl;
+ std::cerr << "The CD CSV file contents will have the format : x,y,polarity,timestamp" << std::endl;
+ std::cerr << "The Trigger CSV file contents will have the format : value,id,timestamp" << std::endl;
return 1;
}
@@ -102,16 +111,58 @@ int main(int argc, char *argv[]) {
write_triggers = true;
}
- // Skip the header of the input file, if present :
- int line_first_char = input_file.peek();
- while (line_first_char == '%') {
- std::string line;
- std::getline(input_file, line);
- if (line == "% end") {
+ // Parse the header of the input file, if present, and store sensor geometry
+ Metadata metadata;
+ while (input_file.peek() == '%') {
+ std::string header_line;
+ std::getline(input_file, header_line);
+ if (header_line == "% end") {
break;
+ } else if (header_line.substr(0, 9) == "% format ") {
+ std::istringstream sf(header_line.substr(9));
+ std::string format_name;
+ std::getline(sf, format_name, ';');
+ if (format_name != "EVT2") {
+ std::cerr << "Error : detected non-EVT2 input file '" << argv[1] << "'" << std::endl;
+ return 1;
+ }
+ while (!sf.eof()) {
+ std::string option;
+ std::getline(sf, option, ';');
+ {
+ std::string name, value;
+ std::istringstream so(option);
+ std::getline(so, name, '=');
+ std::getline(so, value, '=');
+ if (name == "width") {
+ metadata.sensor_width = std::stoi(value);
+ } else if (name == "height") {
+ metadata.sensor_height = std::stoi(value);
+ }
+ }
+ }
+ } else if (header_line.substr(0, 11) == "% geometry ") {
+ std::istringstream sg(header_line.substr(11));
+ std::string sw, sh;
+ std::getline(sg, sw, 'x');
+ std::getline(sg, sh);
+ metadata.sensor_width = std::stoi(sw);
+ metadata.sensor_height = std::stoi(sh);
+ } else if (header_line.substr(0, 6) == "% evt ") {
+ if (header_line.substr(6) != "2.0") {
+ std::cerr << "Error : detected non-EVT2 input file '" << argv[1] << "'" << std::endl;
+ return 1;
+ }
}
- line_first_char = input_file.peek();
- };
+ }
+
+ // If parsed from input metadata, write sensor geometry as header of CD CSV output
+ if (metadata.sensor_width > 0 && metadata.sensor_height > 0) {
+ cd_output_file << "%geometry:" << metadata.sensor_width << "," << metadata.sensor_height << std::endl;
+ }
+
+ // Start chrono
+ const auto tp_start = std::chrono::system_clock::now();
// Vector where we'll read the raw data
static constexpr uint32_t WORDS_TO_READ = 1000000; // Number of words to read at a time
@@ -147,7 +198,7 @@ int main(int argc, char *argv[]) {
for (; current_word != last_word; ++current_word) {
Metavision::Evt2::EventTypes type = static_cast(current_word->type);
switch (type) {
- case Metavision::Evt2::EventTypes::CD_LOW: {
+ case Metavision::Evt2::EventTypes::CD_OFF: {
// CD events, decrease in illumination (polarity '0')
Metavision::Evt2::RawEventCD *ev_cd = reinterpret_cast(current_word);
Metavision::Evt2::timestamp_t t = current_time_base + ev_cd->timestamp;
@@ -160,7 +211,7 @@ int main(int argc, char *argv[]) {
cd_str += std::to_string(ev_cd->x) + "," + std::to_string(ev_cd->y) + ",0," + std::to_string(t) + "\n";
break;
}
- case Metavision::Evt2::EventTypes::CD_HIGH: {
+ case Metavision::Evt2::EventTypes::CD_ON: {
// CD events, increase in illumination (polarity '1')
Metavision::Evt2::RawEventCD *ev_cd = reinterpret_cast(current_word);
Metavision::Evt2::timestamp_t t = current_time_base + ev_cd->timestamp;
@@ -248,5 +299,10 @@ int main(int argc, char *argv[]) {
}
}
+ // Display processing time
+ const auto tp_end = std::chrono::system_clock::now();
+ const double duration_s = std::chrono::duration_cast(tp_end - tp_start).count() / 1e6;
+ std::cout << "Decoded '" << argv[1] << "' in " << duration_s << " s" << std::endl;
+
return 0;
}
diff --git a/standalone_samples/metavision_evt2_raw_file_encoder/metavision_evt2_raw_file_encoder.cpp b/standalone_samples/metavision_evt2_raw_file_encoder/metavision_evt2_raw_file_encoder.cpp
index 8f0bf4b3d..9cac0df5e 100644
--- a/standalone_samples/metavision_evt2_raw_file_encoder/metavision_evt2_raw_file_encoder.cpp
+++ b/standalone_samples/metavision_evt2_raw_file_encoder/metavision_evt2_raw_file_encoder.cpp
@@ -15,13 +15,16 @@
#include
#include
#include
+#include
+#include
+#include
namespace Metavision {
namespace Evt2 {
enum class EventTypes : uint8_t {
- CD_LOW = 0x00, // CD event, decrease in illumination (polarity '0')
- CD_HIGH = 0x01, // CD event, increase in illumination (polarity '1')
+ CD_OFF = 0x00, // OFF CD event, decrease in illumination (polarity '0')
+ CD_ON = 0x01, // ON CD event, increase in illumination (polarity '1')
EVT_TIME_HIGH = 0x08, // Encodes the higher portion of the timebase (bits 33..6). Since it encodes the 28 higher
// bits over the 34 used to encode a timestamp, it has a resolution of 64us (= 2^(34-28)) and
// it can encode time values from 0us to 17179869183us (~ 4h46m20s). After
@@ -44,7 +47,7 @@ struct RawEventCD {
unsigned int y : 11; // Pixel Y coordinate
unsigned int x : 11; // Pixel X coordinate
unsigned int timestamp : 6; // Least significant bits of the event timestamp (bits 5..0)
- unsigned int type : 4; // Event type: EventTypes::CD_LOW or EventTypes::CD_HIGH
+ unsigned int type : 4; // Event type: EventTypes::CD_OFF or EventTypes::CD_ON
};
struct RawEventExtTrigger {
@@ -62,6 +65,7 @@ using Timestamp = uint64_t; // Type for timestamp, in microseconds
/// @brief Class that reads CD events from a CSV file and encodes them in EVT2 format
struct EventCDEncoder {
+public:
/// @brief Column position in the sensor at which the event happened
unsigned short x;
@@ -78,24 +82,29 @@ struct EventCDEncoder {
/// @brief Timestamp at which the event happened (in us)
Timestamp t;
+private:
+ /// @brief Vector used to parse CSV input lines
+ std::vector tokens_;
+
+public:
/// @brief Reads next line of CSV file
/// @param ifs Stream to the input file to read
bool read_next_line(std::ifstream &ifs) {
std::string line;
if (std::getline(ifs, line)) {
std::istringstream iss(line);
- std::vector tokens;
+ tokens_.clear();
std::string token;
while (std::getline(iss, token, ',')) {
- tokens.push_back(token);
+ tokens_.push_back(token);
}
- if (tokens.size() != 4) {
+ if (tokens_.size() != 4) {
std::cerr << "Invalid line for CD event: <" << line << ">" << std::endl;
} else {
- x = static_cast(std::stoul(tokens[0]));
- y = static_cast(std::stoul(tokens[1]));
- p = static_cast(std::stoi(tokens[2]));
- t = std::stoll(tokens[3]);
+ x = static_cast(std::stoul(tokens_[0]));
+ y = static_cast(std::stoul(tokens_[1]));
+ p = static_cast(std::stoi(tokens_[2]));
+ t = std::stoll(tokens_[3]);
return true;
}
}
@@ -109,12 +118,13 @@ struct EventCDEncoder {
raw_cd_event->x = x;
raw_cd_event->y = y;
raw_cd_event->timestamp = t;
- raw_cd_event->type = p ? static_cast(EventTypes::CD_HIGH) : static_cast(EventTypes::CD_LOW);
+ raw_cd_event->type = p ? static_cast(EventTypes::CD_ON) : static_cast(EventTypes::CD_OFF);
}
};
/// @brief Class that reads Trigger events from a CSV file and encodes them in EVT2 format
struct EventTriggerEncoder {
+public:
/// Polarity representing the change of contrast (1: positive, 0: negative)
short p;
@@ -124,23 +134,28 @@ struct EventTriggerEncoder {
/// ID of the external trigger
short id;
+private:
+ /// @brief Vector used to parse CSV input lines
+ std::vector tokens_;
+
+public:
/// @brief Reads next line of CSV file
/// @param ifs Stream to the input file to read
bool read_next_line(std::ifstream &ifs) {
std::string line;
if (std::getline(ifs, line)) {
std::istringstream iss(line);
- std::vector tokens;
+ tokens_.clear();
std::string token;
while (std::getline(iss, token, ',')) {
- tokens.push_back(token);
+ tokens_.push_back(token);
}
- if (tokens.size() != 3) {
+ if (tokens_.size() != 3) {
std::cerr << "Invalid line for Trigger event: <" << line << ">" << std::endl;
} else {
- p = static_cast(std::stoi(tokens[0]));
- id = static_cast(std::stoi(tokens[1]));
- t = std::stoll(tokens[2]);
+ p = static_cast(std::stoi(tokens_[0]));
+ id = static_cast