|Onboard optic flow|
The onboard optic flow algorithm uses the temporal filtered Lucas Kanade method. The presented implementation is focused on efficiency and uses integer arithmetic. The following pseudo-code illustrates the procedure:
The sensor data for the current and previous time step is contained in pixel and pixel_old, respectively. P denotes the spatial integration patch and GB contains the integrated values for G and B. Since G is symmetric it is sufficient to store 3 values for G instead of 4. The multiplications required for the temporal filtering are implemented as bitwise shift operations (>>n) which limits the possible α values for the filter but improves performance. Note that GB contains signed valued which requires an arithmetic shift with sign extension instead of a logic shift. A shift value of 4 corresponds to a division by 16 (α = 0.0625). In the computation of the spatial gradients a divisor of 2 is omitted. These factors cancel out in the final solving step up to a factor of 2 for the temporal gradient which is accounted for in the integration step on line 8.