API Usage Instructions
Algo SDK is a software development toolkit designed for evs devices, providing algorithm functions and simple operation methods to help developers easily integrate various functions.
Environment Configuration
Please ensure the following prerequisites are installed in your development environment:
- Operating System: Windows 10 64-bit
- Compiler: C/C++ compiler suitable for your operating system
- Dependencies: Ensure necessary libraries are installed, OpenCV (we will provide the OpenCV version corresponding to the SDK, just configure environment variables yourself).
- Development Tools: Such as IDE (Visual Studio 2019, etc.)
Suggestion: Use full English path for development.
Algo Module Description
The Algo library is mainly divided into three modules:
OpticalFlow
- Function: This API is an optical flow implementation based on EVS.
HandDetector
- Function: This API is a hand detector implementation based on EVS.
HumanDetector
- Function: This API is a human detector implementation based on EVS.
Algo Directory Description
- bin directory: Contains all core libraries and dependencies
- docs directory: Contains interface documentation
- include directory: Contains interface header files
- lib directory: Contains lib files for all development libraries
- models directory: Contains training model data
- samples_cpp directory: Contains simple examples for operating devices, running examples requires OpenCV environment
Note: After compiling the example, you need to copy the models directory and dynamic libraries in the bin directory to the same directory as the .exe executable file.
1. OpticalFlow
This API is an optical flow implementation based on EVS.
Of Function
The Of function is the initialization constructor of the optical flow class, parameter definitions are as follows:
Of(
uint16_t width,
uint16_t height,
uint8_t scale,
uint8_t search_radius,
uint8_t block_dimension);- width: Width of EVS image.
- height: Height of EVS image.
- scale: EVS downsampling factor.
- search_radius: Represents the optical flow search radius size, usually recommended to be 4.
- block_dimension: Represents the image size used for optical flow calculation related features, usually recommended to be 21, larger is more accurate but efficiency decreases.
run Function
The run function is the core function for running the optical flow algorithm, parameter definitions are as follows:
int run(
const cv::Mat& in_img,
cv::Mat& out_img,
uint8_t stack_nums = 1);- in_img: Represents the EVS input image used to calculate optical flow. Usually 0 means no event, 1 and 2 represent positive and negative events respectively.
- out_img: Represents the calculated optical flow image, represented by CV_8SC2 type. The values of the two channels of each pixel represent the x, y optical flow magnitude, and the sign represents the direction.
- stack_nums: The number of EVS frame stacking, default is 1, meaning no stacking. Usually sparse events require frame stacking.
showOf Function
The showOf function visualizes the optical flow image obtained by the run function using HVS space arrows, parameter definitions are as follows:
int showOf(
cv::Mat& of_result,
cv::Mat& of_mask,
uint8_t ratio = 2,
uint8_t step = 2);- of_result: Represents the optical flow image calculated by the run function.
- of_mask: Represents the optical flow result after visualizing of_result.
- ratio: Represents how many times to magnify the visualized optical flow arrows proportionally.
- step: Represents how many times to sparse sample the visualized optical flow arrows.
