diff --git a/.gitignore b/.gitignore index bee2946..52a7416 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ examples/build/* data/* !data/.gitkeep + +src/evl/html +src/docs/build +src/docs/doxygen/* diff --git a/src/evl/core/common.hpp b/src/evl/core/common.hpp index 4888c93..d9eb87b 100644 --- a/src/evl/core/common.hpp +++ b/src/evl/core/common.hpp @@ -1,9 +1,36 @@ -// Copyright 2018 Event Vision Library. +/******************************************************************************/ +/*! @addtogroup EVL_CORE + @file common.hpp + @brief Common header file for global mutex variable. +******************************************************************************* + Detail We have "mutex" in common for multi threading. +******************************************************************************* + @date 2018/09/01 + @author Event Vision Library + @par Revision + 0.1 + @par Copyright + 2018-2018 Event Vision Library. All rights reserved. +******************************************************************************* + @par History + - 2018/09/01 shiba + -# Initial Version +******************************************************************************/ + +/*! @ingroup EVL_CORE */ +/* @{ */ + #ifndef SRC_EVL_CORE_COMMON_HPP_ #define SRC_EVL_CORE_COMMON_HPP_ #include +/*! @var mutex + @brief Global variable inside this library. + + mutex lock for multi threading. + +*/ extern std::mutex mtx; #endif // SRC_EVL_CORE_COMMON_HPP_ diff --git a/src/evl/core/initialize_davis.hpp b/src/evl/core/initialize_davis.hpp index 89addf2..0543e68 100644 --- a/src/evl/core/initialize_davis.hpp +++ b/src/evl/core/initialize_davis.hpp @@ -1,10 +1,40 @@ -// Copyright 2018 Event Vision Library. +/******************************************************************************/ +/*! @addtogroup EVL_CORE + @file initialize_davis.hpp + @brief Initializing DAVIS. +******************************************************************************* + Detail +******************************************************************************* + @date 2018/09/01 + @author Event Vision Library + @par Revision + 0.1 + @par Copyright + 2018-2018 Event Vision Library. All rights reserved. +******************************************************************************* + @par History + - 2018/09/01 shiba + -# Initial Version +******************************************************************************/ + +/*! @ingroup EVL_CORE */ +/* @{ */ + #ifndef SRC_EVL_CORE_INITIALIZE_DAVIS_HPP_ #define SRC_EVL_CORE_INITIALIZE_DAVIS_HPP_ #include "types.hpp" -namespace evl { + namespace evl { + +/******************************************************************************/ +/*! @brief Initialize DAVIS before reading data. + + Configuring several parameters and setting up ready to read DAVIS. + @return Success 1, failure 0 + @exception Raise error when there is no DAVIS connected. + @todo(shiba) Input argument as DAVIS ID (default=1). +******************************************************************************/ Davis initializeDavis(void); } // namespace evl diff --git a/src/evl/core/read_buffer.hpp b/src/evl/core/read_buffer.hpp index 2626f1a..72ff7a5 100644 --- a/src/evl/core/read_buffer.hpp +++ b/src/evl/core/read_buffer.hpp @@ -1,4 +1,25 @@ -// Copyright 2018 Event Vision Library. +/******************************************************************************/ +/*! @addtogroup EVL_CORE + @file read_buffer.hpp + @brief +******************************************************************************* + Detail +******************************************************************************* + @date 2018/09/01 + @author Event Vision Library + @par Revision + 0.1 + @par Copyright + 2018-2018 Event Vision Library. All rights reserved. +******************************************************************************* + @par History + - 2018/09/01 shiba + -# Initial Version +******************************************************************************/ + +/*! @ingroup EVL_CORE */ +/* @{ */ + #ifndef SRC_EVL_CORE_READ_BUFFER_HPP_ #define SRC_EVL_CORE_READ_BUFFER_HPP_ @@ -7,7 +28,29 @@ #include "types.hpp" namespace evl { + +/******************************************************************************/ +/*! @brief Read buffered events based on lifetime. + Reading event data based on lifetime timestamp. + + @param[in] *buffer (EventBuffer) Buffer to read events from. + @param[in] lifetime (int) Lifetime of events to read. + + @return event_tuple (std::vector) Vector of EventTuples. + @exception none +******************************************************************************/ std::vector readBufferOnLifetime(EventBuffer *buffer, int lifetime); + +/******************************************************************************/ +/*! @brief Read buffered events based on number of events. + Reading event data based on how many events to read. + + @param[in] *buffer (EventBuffer) Buffer to read events from. + @param[in] number (int) Number of events to read. + + @return event_tuple (std::vector) Vector of EventTuples. + @exception none +******************************************************************************/ std::vector readBufferOnNumber(EventBuffer *buffer, int number); } // namespace evl diff --git a/src/evl/core/save_csv.hpp b/src/evl/core/save_csv.hpp index 806fa9b..f5fb0e9 100644 --- a/src/evl/core/save_csv.hpp +++ b/src/evl/core/save_csv.hpp @@ -1,4 +1,24 @@ -// Copyright 2018 Event Vision Library +/******************************************************************************/ +/*! @addtogroup EVL_CORE + @file save_csv.hpp + @brief +******************************************************************************* + Detail +******************************************************************************* + @date 2018/09/01 + @author Event Vision Library + @par Revision + 0.1 + @par Copyright + 2018-2018 Event Vision Library. All rights reserved. +******************************************************************************* + @par History + - 2018/09/01 shiba + -# Initial Version +******************************************************************************/ + +/*! @ingroup EVL_CORE */ +/* @{ */ #ifndef SRC_EVL_CORE_SAVE_CSV_HPP_ #define SRC_EVL_CORE_SAVE_CSV_HPP_ @@ -7,6 +27,17 @@ #include "types.hpp" namespace evl { + +/******************************************************************************/ +/*! @brief Save buffered events to file. + Saving event data into csv file. + + @param[in] *buffer (EventBuffer) Buffer which stores events. + @param[in] lifetime (int) Lifetime of events to read. + @param[in] filename (std::string) Filename to save event data (.csv or .txt). + + @exception none +******************************************************************************/ void saveBuffer(EventBuffer *buffer, int lifetime, std::string filename); } // namespace evl diff --git a/src/evl/core/shutdown.hpp b/src/evl/core/shutdown.hpp index b802324..3a3348e 100755 --- a/src/evl/core/shutdown.hpp +++ b/src/evl/core/shutdown.hpp @@ -1,16 +1,47 @@ -// Copyright 2018 Event Vision Library. +/******************************************************************************/ +/*! @addtogroup EVL_CORE + @file shutdown.hpp + @brief +******************************************************************************* + Detail +******************************************************************************* + @date 2018/09/01 + @author Event Vision Library + @par Revision + 0.1 + @par Copyright + 2018-2018 Event Vision Library. All rights reserved. +******************************************************************************* + @par History + - 2018/09/01 shiba + -# Initial Version +******************************************************************************/ + +/*! @ingroup EVL_CORE */ +/* @{ */ + #ifndef SRC_EVL_CORE_SHUTDOWN_HPP_ #define SRC_EVL_CORE_SHUTDOWN_HPP_ #include namespace evl { + +/*! @class Shutdown + @brief Shutdown handler of events. + Handling SIGINT when pushed CTRL+C. +*/ class Shutdown { - public: - static std::atomic_bool globalShutdown; - static void globalShutdownSignalHandler(int signal); - static void usbShutdownHandler(void *ptr); - int setSigHandler(); + public: + /*! @var globalShutdown + @brief Shutdown signal + + When get SIGINT, this variable is 1. + */ + static std::atomic_bool globalShutdown; + static void globalShutdownSignalHandler(int signal); + static void usbShutdownHandler(void *ptr); + int setSigHandler(); }; } // namespace evl diff --git a/src/evl/core/store_buffer.hpp b/src/evl/core/store_buffer.hpp index 577c790..7fa04e6 100644 --- a/src/evl/core/store_buffer.hpp +++ b/src/evl/core/store_buffer.hpp @@ -1,11 +1,53 @@ -// Copyright 2018 Event Vision Library. +/******************************************************************************/ +/*! @addtogroup EVL_CORE + @file store_buffer.hpp + @brief Store buffer of event data. +******************************************************************************* + Detail +******************************************************************************* + @date 2018/09/01 + @author Event Vision Library + @par Revision + 0.1 + @par Copyright + 2018-2018 Event Vision Library. All rights reserved. +******************************************************************************* + @par History + - 2018/09/01 shiba + -# Initial Version +******************************************************************************/ + +/*! @ingroup EVL_CORE */ +/* @{ */ + #ifndef SRC_EVL_CORE_STORE_BUFFER_HPP_ #define SRC_EVL_CORE_STORE_BUFFER_HPP_ #include "types.hpp" namespace evl { -void storeBufferFromCsv(EventBuffer *buffer, char* fname); + +/******************************************************************************/ +/*! @brief Store events from CSV file to buffer. + Store events from CSV file to buffer. + Offline reader. + + @param[in] *buffer (EventBuffer) Buffer to store events. + @param[in] *fname (char) Filename of saved events (.csv or .txt). + + @exception none +******************************************************************************/ +void storeBufferFromCsv(EventBuffer *buffer, char *fname); + +/******************************************************************************/ +/*! @brief Store events from DAVIS to buffer. + Store events from DAVIS to buffer. + Online reader. + + @param[in] *buffer (EventBuffer) Buffer to store events. + + @exception none +******************************************************************************/ void storeBufferFromDavis(EventBuffer *buffer); } // namespace evl diff --git a/src/evl/core/types.hpp b/src/evl/core/types.hpp index db93fa1..d81d36f 100644 --- a/src/evl/core/types.hpp +++ b/src/evl/core/types.hpp @@ -1,4 +1,25 @@ -// Copyright 2018 Event Vision Library. +/******************************************************************************/ +/*! @addtogroup EVL_CORE + @file types.hpp + @brief Type definitions for EVL. +******************************************************************************* + Detail +******************************************************************************* + @date 2018/09/01 + @author Event Vision Library + @par Revision + 0.1 + @par Copyright + 2018-2018 Event Vision Library. All rights reserved. +******************************************************************************* + @par History + - 2018/09/01 shiba + -# Initial Version +******************************************************************************/ + +/*! @ingroup EVL_CORE */ +/* @{ */ + #ifndef SRC_EVL_CORE_TYPES_HPP_ #define SRC_EVL_CORE_TYPES_HPP_ @@ -8,10 +29,39 @@ #include #include -namespace evl { +/*! @namespace evl + @brief Base namespace. + + Base namespce for this library. +*/ +namespace evl +{ + +/*! @var EventTuple + @brief Tuple of events + + Tuple of . +*/ typedef std::tuple EventTuple; + +/*! @var EventBuffer + @brief Buffer of events, using boost::circular_buffer. + + This variable uses boost::circular_buffer. + @todo(shiba) more details here... +*/ typedef boost::circular_buffer EventBuffer; + +/*! @var EventPolarity + @brief Polarity of events, using libcaer. + + Polarity means increase (+1) of decrease (0) of events. +*/ typedef libcaer::events::PolarityEventPacket EventPolarity; + +/*! @var Davis + @brief Davis camera instance. +*/ typedef libcaer::devices::davis Davis; } // namespace evl diff --git a/src/evl/imgproc/detection.hpp b/src/evl/imgproc/detection.hpp index 9693239..e4c48d7 100644 --- a/src/evl/imgproc/detection.hpp +++ b/src/evl/imgproc/detection.hpp @@ -1,4 +1,25 @@ -// Copyright 2018 Event Vision Library. +/******************************************************************************/ +/*! @addtogroup EVL_IMGPROC + @file detection.hpp + @brief +******************************************************************************* + Detail +******************************************************************************* + @date 2018/09/01 + @author Event Vision Library + @par Revision + 0.1 + @par Copyright + 2018-2018 Event Vision Library. All rights reserved. +******************************************************************************* + @par History + - 2018/09/01 shiba + -# Initial Version +******************************************************************************/ + +/*! @ingroup EVL_IMGPROC */ +/* @{ */ + #ifndef SRC_EVL_IMGPROC_DETECTION_HPP_ #define SRC_EVL_IMGPROC_DETECTION_HPP_ @@ -7,13 +28,21 @@ #include #include #include "evl/core/types.hpp" -#define W 240 -#define H 180 + +/*! @name CamereResolution + Camera resolution. Currently, these are global variables. + + @todo(shiba) More flexible +*/ +/* @{ */ +#define W 240 /*!< Width */ +#define H 180 /*!< Height */ namespace evl { - void detect_rod_tip(std::vector, cv::Rect *roi); - void detect_rod_tip(std::vector v, - cv::Rect *roi, cv::Point *vertex); + +void detect_rod_tip(std::vector v, cv::Rect *roi); +void detect_rod_tip(std::vector v, + cv::Rect *roi, cv::Point *vertex); } // namespace evl #endif // SRC_EVL_IMGPROC_DETECTION_HPP_ diff --git a/src/evl/utils/event_utils.hpp b/src/evl/utils/event_utils.hpp index 402af66..542b25e 100644 --- a/src/evl/utils/event_utils.hpp +++ b/src/evl/utils/event_utils.hpp @@ -1,4 +1,25 @@ -// Copyright 2018 Event Vision Library. +/******************************************************************************/ +/*! @addtogroup EVL_UTILS + @file event_utils.hpp + @brief +******************************************************************************* + Detail +******************************************************************************* + @date 2018/09/01 + @author Event Vision Library + @par Revision + 0.1 + @par Copyright + 2018-2018 Event Vision Library. All rights reserved. +******************************************************************************* + @par History + - 2018/09/01 shiba + -# Initial Version +******************************************************************************/ + +/*! @ingroup EVL_UTILS */ +/* @{ */ + #ifndef SRC_EVL_UTILS_EVENT_UTILS_HPP_ #define SRC_EVL_UTILS_EVENT_UTILS_HPP_ @@ -8,8 +29,28 @@ #include namespace evl { + +/******************************************************************************/ +/*! @brief Print events to stdout. + + @param[in] events Events to print. + @param[in] with_pol It True, print events with polarity. + + @exception none +******************************************************************************/ void printEvent(EventTuple x); -cv::Mat convertEventsToMat(std::vector events, bool with_pol=false); + +/******************************************************************************/ +/*! @brief Convert events to matrix (opencv) + + @param[in] events Events to print. + @param[in] with_pol If true, convert events with polarity. (returns TYPE) + If false, returns TYPE. + + @return OpenCV matrix. + @exception none +******************************************************************************/ +cv::Mat convertEventsToMat(std::vector events, bool with_pol = false); } // namespace evl #endif // SRC_EVL_UTILS_EVENT_UTILS_HPP_