Skip to content

Commit

Permalink
Release v4.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jthierry-psee committed Dec 14, 2023
1 parent 8905ebf commit 61ae079
Show file tree
Hide file tree
Showing 160 changed files with 5,105 additions and 849 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif(NOT CMAKE_BUILD_TYPE)

cmake_minimum_required(VERSION 3.5)

project(metavision VERSION 4.4.0)
project(metavision VERSION 4.5.0)
set(PROJECT_VERSION_SUFFIX "")

if(PROJECT_VERSION_SUFFIX STREQUAL "")
Expand Down Expand Up @@ -190,6 +190,7 @@ find_package(LibUSB REQUIRED)
# Boost
set (boost_components_to_find program_options filesystem timer chrono thread)
find_package(Boost COMPONENTS ${boost_components_to_find} REQUIRED)
add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) ## needed to get rid of warning `#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...)`

# Python 3 for bindings and pytests
if (COMPILE_PYTHON3_BINDINGS OR BUILD_TESTING)
Expand All @@ -200,7 +201,7 @@ endif ()
find_package(OpenCV COMPONENTS core highgui imgproc videoio imgcodecs calib3d objdetect REQUIRED)

# HDF5
if (NOT ANDROID)
if (NOT ANDROID AND NOT HDF5_DISABLED)
find_package(HDF5 1.10.2 COMPONENTS CXX)
if (HDF5_FOUND AND WIN32)
LIST(APPEND HDF5_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB)
Expand Down Expand Up @@ -433,7 +434,6 @@ add_subdirectory_if_exists(standalone_apps)
################################
if (GENERATE_DOC)
add_subdirectory(doc)
add_subdirectory(appnotes)
endif (GENERATE_DOC)

# Add script generation at the end, once all other subdirs have been processed
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,26 +251,25 @@ To compile OpenEB, you will need to install some extra tools:
* Select "C++ build tools", make sure Windows 10 SDK is checked, and add English Language Pack
* For development, you can also download and run [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/)
* install [vcpkg](https://github.com/microsoft/vcpkg) that will be used for installing dependencies:
* download and extract [vcpkg version 2022.03.10](https://github.com/microsoft/vcpkg/archive/refs/tags/2022.03.10.zip)
* download and extract [vcpkg version 2023.11.20](https://github.com/microsoft/vcpkg/archive/refs/tags/2023.11.20.zip)
* `cd <VCPKG_SRC_DIR>`
* `bootstrap-vcpkg.bat`
* install the libraries by running `vcpkg.exe install --triplet x64-windows libusb eigen3 boost opencv glfw3 glew gtest dirent hdf5[cpp,threadsafe,tools,zlib]`
* 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
number of vcpkg install you manage. To do so, you will need the versions of the libraries we require.
Those can be found in the [vcpkg repository](https://github.com/microsoft/vcpkg/tree/2022.03.10/versions) but we list them here for convenience:
* libusb: 1.0.24
* eigen3: 3.4.0
* boost: 1.78.0
* opencv: 4.5.5
* glfw3: 3.3.6
Those can be found in the [vcpkg repository](https://github.com/microsoft/vcpkg/tree/2023.11.20/versions) but we list them here for convenience:
* libusb: 1.0.26
* boost: 1.83.0
* opencv: 4.8.0
* dirent: 1.24.0
* gtest: 1.14.0
* glew: 2.2.0
* gtest: 1.11.0
* dirent: 1.23.2
* hdf5: 1.12.1
* glfw3: 3.3.8
* hdf5: 1.14.2

#### Installing Python and libraries

Expand Down
8 changes: 5 additions & 3 deletions cmake/cpack/deb_packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ foreach(PackageGroup All Public)
# |-- <all/public>_debN <--|
add_dependencies(${package_group_lower}_deb_packages ${package_group_lower}_build)
foreach (dep ${${package_group_lower}_deb_packages_dependencies})
add_dependencies(${dep} ${package_group_lower}_build)
add_dependencies(${package_group_lower}_deb_packages ${dep})
if(TARGET ${dep})
add_dependencies(${dep} ${package_group_lower}_build)
add_dependencies(${package_group_lower}_deb_packages ${dep})
endif()
endforeach (dep ${${package_group_lower}_deb_packages_dependencies})
else()
add_custom_target(${package_group_lower}_deb_packages
COMMAND ${CMAKE_COMMAND} -E "WARNING : no ${package_group_lower} packages registered"
)
endif(cpack_${package_group_lower}_components)

endforeach(PackageGroup)
endforeach(PackageGroup)
4 changes: 2 additions & 2 deletions cmake/custom_functions/add_library_version_header.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "5319a6deae077ed1dca071af6d1006936339e02a")
set(GIT_COMMIT_DATE "2023-10-10 17:53:39 +0200")
set(GIT_COMMIT_ID "992ed5dc39df6e5e454f842838ba4e43dc1e17a9")
set(GIT_COMMIT_DATE "2023-12-13 15:44:07 +0100")

find_program(GIT_SCM git DOC "Git version control" HINTS "C:\\Program Files\\Git\\bin\\")

Expand Down
27 changes: 10 additions & 17 deletions cmake/custom_functions/python3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,12 @@ if (COMPILE_PYTHON3_BINDINGS)
endif()
foreach (_python_version ${PYBIND11_PYTHON_VERSIONS})
# this is the extension we need to set for the python bindings module
if(CMAKE_CROSSCOMPILING)
# When cross compiling, we cannot run the python interpreter as it might be compiled for a different architecture.
# Therefore we ask for the user to have already set the library extension suffix.
if(NOT DEFINED PYTHON_${_python_version}_MODULE_EXTENSION)
message(FATAL_ERROR "CMake variable 'PYTHON_${_python_version}_MODULE_EXTENSION' needs to be defined. "
"One can run '$ python3-config --extension-suffix' on your targeted platform to get the actual value (eg. '.cpython-36m-x86_64-linux-gnu.so').
")
endif()
else()
execute_process(
COMMAND "${PYTHON_${_python_version}_EXECUTABLE}" "-c"
"from distutils import sysconfig as s; print(s.get_config_var('EXT_SUFFIX') or s.get_config_var('SO'));"
OUTPUT_VARIABLE PYTHON_${_python_version}_MODULE_EXTENSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif(CMAKE_CROSSCOMPILING)
execute_process(
COMMAND "${PYTHON_${_python_version}_EXECUTABLE}" "-c"
"from distutils import sysconfig as s; print(s.get_config_var('EXT_SUFFIX') or s.get_config_var('SO'));"
OUTPUT_VARIABLE PYTHON_${_python_version}_MODULE_EXTENSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# this is the path where we install our python modules for cpack DEB (system) packages ...
execute_process(
Expand All @@ -99,7 +89,7 @@ if (COMPILE_PYTHON3_BINDINGS)
)
file(TO_CMAKE_PATH "${PYTHON_${_python_version}_SYSTEM_SITE_PACKAGES}" PYTHON_${_python_version}_SYSTEM_SITE_PACKAGES)
# ... it must be relative
string(REGEX REPLACE "^/usr/" "" PYTHON_${_python_version}_SYSTEM_SITE_PACKAGES "${PYTHON_${_python_version}_SYSTEM_SITE_PACKAGES}")
string(REGEX REPLACE "^${STAGING_DIR_NATIVE}/usr/" "" PYTHON_${_python_version}_SYSTEM_SITE_PACKAGES "${PYTHON_${_python_version}_SYSTEM_SITE_PACKAGES}")

# this is the path where we install our python modules in the local system install tree
if (PYTHON3_SITE_PACKAGES)
Expand All @@ -121,7 +111,10 @@ if (COMPILE_PYTHON3_BINDINGS)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
file(TO_CMAKE_PATH "${PYTHON_${_python_version}_LOCAL_SITE_PACKAGES}" PYTHON_${_python_version}_LOCAL_SITE_PACKAGES)
# ... it must be relative
string(REGEX REPLACE "^${STAGING_DIR_NATIVE}/usr/" "" PYTHON_${_python_version}_LOCAL_SITE_PACKAGES "${PYTHON_${_python_version}_LOCAL_SITE_PACKAGES}")
endif (PYTHON3_SITE_PACKAGES)
string(REGEX REPLACE "^${STAGING_DIR_NATIVE}/usr/" "" PYTHON_${_python_version}_LOCAL_SITE_PACKAGES "${PYTHON_${_python_version}_LOCAL_SITE_PACKAGES}")
endforeach ()

# this variable is used to create all python versions packages variables for cpack
Expand Down
21 changes: 10 additions & 11 deletions cmake/custom_targets/README_metavision_open.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,26 +251,25 @@ To compile OpenEB, you will need to install some extra tools:
* Select "C++ build tools", make sure Windows 10 SDK is checked, and add English Language Pack
* For development, you can also download and run [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/)
* install [vcpkg](https://github.com/microsoft/vcpkg) that will be used for installing dependencies:
* download and extract [vcpkg version 2022.03.10](https://github.com/microsoft/vcpkg/archive/refs/tags/2022.03.10.zip)
* download and extract [vcpkg version 2023.11.20](https://github.com/microsoft/vcpkg/archive/refs/tags/2023.11.20.zip)
* `cd <VCPKG_SRC_DIR>`
* `bootstrap-vcpkg.bat`
* install the libraries by running `vcpkg.exe install --triplet x64-windows libusb eigen3 boost opencv glfw3 glew gtest dirent hdf5[cpp,threadsafe,tools,zlib]`
* 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
number of vcpkg install you manage. To do so, you will need the versions of the libraries we require.
Those can be found in the [vcpkg repository](https://github.com/microsoft/vcpkg/tree/2022.03.10/versions) but we list them here for convenience:
* libusb: 1.0.24
* eigen3: 3.4.0
* boost: 1.78.0
* opencv: 4.5.5
* glfw3: 3.3.6
Those can be found in the [vcpkg repository](https://github.com/microsoft/vcpkg/tree/2023.11.20/versions) but we list them here for convenience:
* libusb: 1.0.26
* boost: 1.83.0
* opencv: 4.8.0
* dirent: 1.24.0
* gtest: 1.14.0
* glew: 2.2.0
* gtest: 1.11.0
* dirent: 1.23.2
* hdf5: 1.12.1
* glfw3: 3.3.8
* hdf5: 1.14.2

#### Installing Python and libraries

Expand Down
4 changes: 4 additions & 0 deletions hal/cpp/include/metavision/hal/device/device_discovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ class DeviceDiscovery {
/// @param stream_config Configuration describing how to read the stream (see @ref RawFileConfig)
/// @return A new Device
static std::unique_ptr<Device> open_stream(std::unique_ptr<std::istream> stream, RawFileConfig &stream_config);

/// @brief Unloads all the plugins that have been loaded when listing all available sources
/// @warning This function should not be called if there is still a device that is being used
static void unload_plugins();
};

} // namespace Metavision
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ class I_EventRateActivityFilterModule : public I_RegistrableFacility<I_EventRate
/// @return true if the input value was correctly set (i.e. it falls in the range of acceptable values for the
/// sensor)
[[deprecated("This function is deprecated starting with version 4.4.0. Please use "
"set_lower/upper_bound_threshold_start/stop() instead.")]] virtual bool
"set_thresholds() instead.")]] virtual bool
set_event_rate_threshold(uint32_t threshold_Kev_s) = 0;

/// @brief Gets the event rate threshold in Kevt/s below which no events are streamed
/// @return Event rate threshold in Kevt/s
[[deprecated("This function is deprecated starting with version 4.4.0. Please use "
"get_lower/upper_bound_threshold_start/stop() instead.")]] virtual uint32_t
"get_thresholds() instead.")]] virtual uint32_t
get_event_rate_threshold() const = 0;

/// @brief Gets band pass filter hysteresis thresholds supported by the sensor.
Expand Down
12 changes: 12 additions & 0 deletions hal/cpp/include/metavision/hal/facilities/i_events_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,20 @@ class I_EventsStream : public I_RegistrableFacility<I_EventsStream> {
/// @return Pointer to an array of Event structures
/// @note This function must be called to write the buffer of events in the log file defined in @ref
/// log_raw_data
[[deprecated("'RawData *I_EventsStream::get_latest_raw_data(long &)' is deprecated since v4.5.0 and will be removed"
" in future releases, please use 'DataTransfer::BufferPtr I_EventsStream::get_latest_raw_data()'"
" instead.")]]
RawData *get_latest_raw_data(long &n_rawbytes);

/// @brief Gets latest raw data from the event buffer
///
/// Gets raw data from the event buffer received since the last time this function was called.
///
/// @return Pointer to a vector of Event structures
/// @note This function must be called to write the buffer of events in the log file defined in @ref
/// log_raw_data
DataTransfer::BufferPtr get_latest_raw_data();

/// @brief Enables the logging of the stream of events in the input file @a f
///
/// This methods first writes the header retrieved through @ref I_HW_Identification.
Expand Down
9 changes: 8 additions & 1 deletion hal/cpp/include/metavision/hal/facilities/i_roi.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class I_ROI : public I_RegistrableFacility<I_ROI> {

/// @brief Returns ROI/RONI activation state
/// @return The ROI/RONI state
virtual bool is_enabled() const = 0;
virtual bool is_enabled() const = 0;

/// @brief Window mode
///
Expand Down Expand Up @@ -103,6 +103,13 @@ class I_ROI : public I_RegistrableFacility<I_ROI> {
/// @return The vector of active windows
virtual std::vector<Window> get_windows() const = 0;

/// @brief Gets active ROI/RONI lines
///
/// @param cols vector to store active columns
/// @param rows vector to store active rows
/// @return true on success
virtual bool get_lines(std::vector<bool> &cols, std::vector<bool> &rows) const = 0;

/// @brief Sets multiple lines and columns from row and column binary maps
///
/// The binary maps (std::vector<bool>) arguments must have the sensor's dimension.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class PluginLoader {
void insert_folders(const std::vector<std::string> &folders);

void load_plugins();
void unload_plugins();

class PluginList;
PluginList get_plugin_list();
Expand Down
29 changes: 29 additions & 0 deletions hal/cpp/include/metavision/hal/utils/detail/warning_supression.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef WARNING_SUPRESSION_HPP
#define WARNING_SUPRESSION_HPP

#if defined(__GNUC__)

#define SUPRESS_DEPRECATION_WARNING(x) \
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
x _Pragma("GCC diagnostic pop")

#elif defined(__clang__)

#define SUPRESS_DEPRECATION_WARNING(x) \
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
x _Pragma("clang diagnostic pop")

#elif defined(_MSC_VER)

// see reference to:
// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-c4200-through-c4399?view=msvc-170
#define SUPRESS_DEPRECATION_WARNING(x) \
__pragma(warning(push)) __pragma(warning(disable : 4973 4974 4995 4996)) x __pragma(warning(pop))

#else

#define SUPRESS_DEPRECATION_WARNING(x) x

#endif

#endif // WARNING_SUPRESSION_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,10 @@ int main(int argc, char *argv[]) {
}

// Retrieves raw buffer
long n_rawbytes = 0;
uint8_t *ev_buffer = i_eventsstream->get_latest_raw_data(n_rawbytes);
auto ev_buffer = i_eventsstream->get_latest_raw_data();

// Decode the raw buffer
i_eventsstreamdecoder->decode(ev_buffer, ev_buffer + n_rawbytes);
i_eventsstreamdecoder->decode(ev_buffer->data(), ev_buffer->data() + ev_buffer->size());

// Update last timestamp
last_ts = i_eventsstreamdecoder->get_last_timestamp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ add_library(hal_sample_plugin_obj OBJECT
${CMAKE_CURRENT_SOURCE_DIR}/src/sample_plugin.cpp
)

# The following line is needed becase when linking a shared library to an object one,
# The following line is needed because when linking a shared library to an object one,
# the object library needs to be compiled with -fPIC
# cf https://stackoverflow.com/questions/50600708/combining-cmake-object-libraries-with-shared-libraries
set_target_properties(hal_sample_plugin_obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ TEST_F(HalSamplePlugin_GTest, record_and_read_back) {
ASSERT_LE(0, ret);

long n_bytes;
uint8_t *raw_data = i_events_stream->get_latest_raw_data(n_bytes);
i_eventsstreamdecoder->decode(raw_data, raw_data + n_bytes);
auto raw_data = i_events_stream->get_latest_raw_data();
i_eventsstreamdecoder->decode(raw_data->data(), raw_data->data() + raw_data->size());
}
Metavision::timestamp last_time = i_eventsstreamdecoder->get_last_timestamp();

Expand All @@ -169,8 +169,8 @@ TEST_F(HalSamplePlugin_GTest, record_and_read_back) {
short ret = i_events_stream->wait_next_buffer();
long n_bytes(0);
while (ret > 0) { // To be sure to record something
uint8_t *raw_data = i_events_stream->get_latest_raw_data(n_bytes);
i_eventsstreamdecoder->decode(raw_data, raw_data + n_bytes);
auto raw_data = i_events_stream->get_latest_raw_data();
i_eventsstreamdecoder->decode(raw_data->data(), raw_data->data() + raw_data->size());
ret = i_events_stream->wait_next_buffer();
}
ASSERT_EQ(number_cd_expected, n_cd_events_decoded);
Expand Down
5 changes: 2 additions & 3 deletions hal/cpp/samples/metavision_hal_seek/metavision_hal_seek.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,13 @@ int main(int argc, char **argv) {
if (seek_ts >= 0) {
MV_LOG_INFO() << "Seeking to position" << seek_ts;
display.setTo(color_bg);
long buffer_size_bytes;
Metavision::timestamp ts_reached;
const auto status = i_eventsstream->seek(seek_ts, ts_reached);
if (status == Metavision::I_EventsStream::SeekStatus::Success) {
i_eventsstreamdecoder->reset_timestamp(ts_reached);
while (i_eventsstream->wait_next_buffer() > 0) {
auto buffer = i_eventsstream->get_latest_raw_data(buffer_size_bytes);
i_eventsstreamdecoder->decode(buffer, buffer + buffer_size_bytes);
auto buffer = i_eventsstream->get_latest_raw_data();
i_eventsstreamdecoder->decode(buffer->data(), buffer->data() + buffer->size());
if (i_eventsstreamdecoder->get_last_timestamp() > seek_ts + accumulation_time) {
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ int main(int argc, char *argv[]) {
device->get_facility<Metavision::I_EventRateActivityFilterModule>();
if (i_event_rate_activity_filter_module) {
std::cout << "Event rate activity filter: streaming from "
<< i_event_rate_activity_filter_module->get_event_rate_threshold() << " Kev/s" << std::endl;
<< i_event_rate_activity_filter_module->get_thresholds().lower_bound_start << " Kev/s" << std::endl;
}

auto tokenize = [](std::string str, std::string separator) {
Expand Down Expand Up @@ -360,11 +360,10 @@ int main(int argc, char *argv[]) {

/// [buffer]
// Here we polled data, so we can launch decoding
long n_bytes;
uint8_t *raw_data = i_eventsstream->get_latest_raw_data(n_bytes);
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, raw_data + n_bytes);
i_eventsstreamdecoder->decode(raw_data->data(), raw_data->data() + raw_data->size());
/// [buffer]
}
});
Expand Down
Loading

0 comments on commit 61ae079

Please sign in to comment.