# E2-VINS: An Event-Enhanced Visual-Inertial SLAM Scheme for Dynamic Environments
## 3 Methodology
### Preprocessing and Visual-Inertial Alignment-Based IMU Calibration  
Inspired by the approach of the classical frameworks[2; 28], the system preintegrates IMU measurements between every two consecutive image frames, tracks features between consecutive frames, and detects new features in the latest frame. The process is as follows:  
* Preintegration of IMU Data  
E\({}^{2}\)-VINS models IMU measurements by taking inspiration from previous works [2; 28]. Specifically, accelerometer measurements are the sum of true linear acceleration \(a\), gravity-compensating force \(\dot{g}\), accelerometer bias \(\mathbf{b}_{a}\), and Gaussian white noise \(n_{a}\), while true angular velocity \(\omega\) is affected by gyroscope bias \(\mathbf{b}_{\omega}\) and additional noise \(n_{\omega}\):  
\[\widehat{a}=a+\mathbf{b}_{a}+\dot{g}+n_{a},\widehat{\omega}=\omega+\mathbf{b }_{\omega}+n_{\omega}, \tag{2}\]  
where the bias \(\mathbf{b}_{a}\) and \(\mathbf{b}_{\omega}\) are modeled as random walk, and their derivatives are Gaussian white noise. These biases are estimated in subsequent visual-inertial alignment to calibrate IMU measurements. Consider two consecutive images, corresponding to IMU coordinate frames (body frames) \(b_{k}\) and \(b_{k+1}\). During this period, the system's position \(a_{b_{k+1}}^{b_{k}}\), velocity \(\beta_{b_{k+1}}^{b_{k}}\), and orientation states \(\gamma_{b_{k+1}}^{b_{k}}\) are propagated using IMU measurements through a process referred to as IMU preintegration between images. The IMU preintegration strategy aligns with classical methods [2; 28]. * Preprocessing of Images and Visual-based Structure from Motion  
The system applies contrast-limited adaptive histogram equalization to input images to cope with lighting variations. For each new image, the Shi-Tomasi corner features are extracted and processed. The features are tracked by the KLT sparse optical flow algorithm [29] to avoid time-consuming matching computations. Subsequently, a sparse map composed of camera poses and feature positions is estimated. To limit computational complexity, E\({}^{2}\)-VINS maintains several frames using a sliding window. For frames with stable matches within the window, the system employs the five-point algorithm [30] to recover the relative rotation and scale-free translation between the two frames. Subsequently, all features between the two frames are triangulated, and the perspective-n-point (PnP) algorithm [31] is used to estimate the poses of all other frames in the window. Finally, the global bundle adjustment [32] is applied to minimize the total reprojection error of all feature observations. The first camera frame \((\cdot)^{c_{0}}\) is used as the reference coordinate system for structure from motion (SFM), and all subsequent frame poses \((\mathbf{p}_{\mathrm{c}_{\mathrm{x}}}^{c_{0}},\mathbf{q}_{\mathrm{c}_{\mathrm{ x}}}^{c_{0}})\) and feature positions are calculated relative to \((\cdot)^{c_{0}}\). \(\mathbf{q}_{\mathrm{c}_{\mathrm{x}}}^{c_{0}}\) and \(\mathbf{p}_{\mathrm{c}_{\mathrm{x}}}^{c_{0}}\) represent the rotation quaternion and translation vector, respectively. Given the extrinsic parameters \((\mathbf{p}_{\mathrm{c}}^{b},\mathbf{q}_{\mathrm{c}}^{b})\) between the camera and IMU, the system can convert the pose from the camera coordinate system to the body (IMU) coordinate system \((\cdot)^{b_{\mathrm{x}}}\):  
\[ \begin{split}\mathbf{q}_{b_{k}}^{c_{0}}&=\mathbf{q} _{\mathrm{c}_{\mathrm{x}}}^{c_{0}}\otimes\left(\mathbf{q}_{\mathrm{c}}^{b} \right)^{-1},\\ s\mathbf{p}_{b_{k}}^{c_{0}}&=\mathbf{sp}_{\mathrm{c }_{\mathrm{x}}}^{c_{0}}-\mathbf{R}_{b_{k}}^{c_{0}}\mathbf{p}_{\mathrm{c}}^{b},\end{split}  \tag{3}\]  
where \(s\) is the camera scale parameter, which would be solved during visual-inertial alignment, \(\otimes\) represents the multiplication of two quaternions, and \(\mathbf{R}_{b_{k}}^{c_{0}}\) is the rotation matrix corresponding to \(\mathbf{q}_{b_{k}}^{c_{0}}\).