{'fraction_non_alphanumeric': 0.028351417570878543, 'fraction_numerical': 0.017194609730486525, 'mean_word_length': 4.675937422398808, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Linear Comb Filter for Event Flicker Removal

Event cameras are bio-inspired sensors that capture per-pixel asynchronous intensity change rather than the synchronous absolute intensity frames captured by a classical camera sensor. Such cameras are ideal for robotics applications since they have high temporal resolution, high dynamic range and low latency. However, due to their high temporal resolution, event cameras are particularly sensitive to flicker such as from fluorescent or LED lights. During every cycle from bright to dark, pixels that image a flickering light source generate many events that provide little or no useful information for a robot, swamping the useful data in the scene. In this paper, we propose a novel linear filter to preprocess event data to remove unwanted flicker events from an event stream. The proposed algorithm achieves over 4.6 times relative improvement in the signal-to-noise ratio when compared to the raw event stream due to the effective removal of flicker from fluorescent lighting. Thus, it is ideally suited to robotics applications that operate in indoor settings or scenes illuminated by flickering light sources.


INTRODUCTION
Event cameras, such as the Dynamic Vision Sensor (DVS) [18], are bio-inspired vision sensors that record per-pixel brightness changes. In contrast to conventional cameras that accumulate average brightness for every pixel over the exposure time to generate synchronous intensity frames, event cameras output a sparse asynchronous stream of positive and negative event data only when the change in logarithmic brightness at individual pixels exceeds a contrast threshold. The high dynamic range (HDR), fine temporal resolution, low latency (<0.5 ms) and sparse output [8] make event cameras ideal for high-speed robotics vision applications that requires low computational cost and operate in challenging lighting conditions, such as feature tracking [33,22,9] de-blurring [25,13], motion estimation [16], autonomous-driving applications [23], visual odometry and simultaneous localization and mapping (SLAM) [17,28,20]. However, these same properties make event cameras highly Wang susceptible to flicker, particularly those caused by fluorescent and LED light sources, which can swamp the signal of interest in the scene.
Event data de-noising is common in all current event cameras. Current de-noising methods focus primarily on uncorrelated background activity noise [6,2,12,21,15,24,35]. This noise is commonly caused by transistor switch leakage or thermal noise [6,21] and is present even when there is no real brightness changes [21]. Flicker removal is an entirely different problem since it corresponds to real intensity changes in the image and is only considered 'noise' since flicker is uninteresting and distracting to most robotic systems. However, in a typical indoor or nighttime environment with fluorescent or LED light sources, the events associated with the flicker of the lighting can overwhelm other events in the scene. In the datasets collected in this paper, with only a single fluorescent light source, the unwanted events associated with the flickering light source outnumbered interesting foreground events and occupied 84% of the event data on average. This creates many problems in real-world robotics systems. Excessive events due to flicker can overwhelm the onboard data bus leading to the lost events or requiring the camera to be set at lower sensitivity (leading to fewer events overall), resulting in a bigger quantisation error in the desired foreground information. Modern image reconstruction algorithms often rely on batching events [27,32,13] and excessive unwanted flicker can dominate the data in a batch and lead to poor reconstructions of foreground activity. Flicker is also a major issue in optical flow and other motion estimation methods that depend on image consistency. Real-world flickering light sources are complex to model. Rarely are they perfect sinusoidal signals due to the electronics that are used to generate the driving current and the frequency response usually has many strong harmonics [7].
In this paper, we propose an algorithm for event flicker removal. To the best of the authors' knowledge, this is the first such algorithm that has been published. A key contribution is the recognition that flicker events are highly non-sinusoidal and cannot be removed using a finite-dimensional notch filter. This leads us to consider linear comb filters that attenuate all harmonics of a given frequency at the same time by feeding back a time-delayed version of the original signal. We use both delayed feedback and delayed feed-forward [26,14] to design a linear filter response that is effective at passing the DC component of a signal while strongly attenuating all harmonics of a desired base frequency. Since the design is based on a linear filter, there is a short transient while the internal filter state converges to attenuate the undesired signal. The resulting algorithm is highly effective in removing flicker from event streams. The algorithm is suitable for integration into a Field-Programmable Gate Array (FPGA) or Application-Specific Integrated Circuit (ASIC), allowing the algorithm to be built into the camera hardware. In the present paper we provide only a demonstration implementation in C++ to demonstrate its potential. In summary, • We propose a modified linear comb filter for event flicker removal. The algorithm allows parallel pixel-wise computation and is suitable for implementation on low-latency and low-power hardware circuits, such as FPGA and ASIC. • We demonstrate event flicker removal performance in high frame rate and fast motion video reconstruction in the presence of fluorescent lighting.
Since event cameras are prone to noise [18] many event data de-noising algorithms have been used in image reconstruction and de-blurring algorithms. For example, noise in event data can be modelled by estimating event data bias and contrast threshold to match event data to reference intensity images [2,35,34]. To avoid accumulating event bias over time, the Complementary Filter (CF) [29] exponentially 'forgets' historical event data using a single filter gain parameter. Pan et al. [25] estimates event camera contrast threshold by minimising energy function of image sharpness. Some neural networks [27,32,19,13] rely on regularisation and spatial priors to reduce artefacts caused by event data noise.
In addition to estimating event sensitivity and priors, event filtering methods can remove noisy events as a preprocessing step for other algorithms. Delbruck [6] firstly introduced an effective background activity filter that directly removes isolated events with a low spatial-temporal correlation between the nearest neighbouring event data. The algorithm has been implemented in the event-based sensor software jAER [1]. Ieng et al. [12] reduced noise by spatial-temporal filtering event data asynchronously and Liu et al. [21] implemented a background activity filter in hardware that filters out 98% background noise with 10% loss of real data. Later, Padala et al. [24] achieved higher signal to noise ratio and Khodamoradi et al. [15] reduced memory complexity of the background activity filter from O (N 2 ) to O (N ). Apart from the correlation with the nearest neighbour, event data noise was also modelled based on differing polarity, refractory period and inter spike interval [5,34]. Recently, Wang et al. [36] bridged event and image data via a noise-robust motion compensation model and proposed a joint filtering method.
To the authors' knowledge, there is no published algorithm that is targeted at attenuation of flicker events in event streams. In contrast, flicker removal is a well-studied field for conventional cameras. For conventional images, flicker is modelled as a dramatic intensity change between two neighbouring frames [30] rather than at a pixel level. Chono et al. [4] proposed a quantisation-based method to insert a periodically intra-coded pictures derived from the previous predictive-coded pictures, that suppresses the effect of flickering. Guthier et al. [10] proposed an iterative flicker removal algorithm that uses an average intensity change threshold to detect flicker and an iterative intensity scaling to compensate until variation falls below the threshold. Shiau et al. [30] designed an adjuster to the video frame, which estimates the atmospheric light of each frame, and assigned a multiplier based on that weight. Many modern video cameras come with 50 or 60Hz de-flicker as a standard functionality.

METHOD
In this section we present the mathematical model of our event-based flicker removal algorithm.

Event Camera Model
As an asynchronous image sensor, the output of an event camera follows the Address Event Representation (AER) [3]. The intensity change of the i th event e i is encoded in a vector [t i , p x i , p y i , σ i ] T with event timestamp t i , pixel coordinate p i = (p x i , p y i ), and polarity σ i for positive or negative direction of the log-intensity change. We model a single event as an impulse signal δ in continuous time where c pi is the contrast threshold at pixel p i . An event stream E for asynchronous filter implementations is defined as where p is the pixel location considered and t is the time index and δ p (p i ) is the Kronecker delta function that is unity when p = p i and zero otherwise [11].

Flickering and Harmonics
The high temporal resolution property enables event cameras to capture events that encode high-frequency flickering intensity as a periodic waveform. Reproducing the complex waveform of a light source requires a large number of events per second even though the light source appears to be of a constant brightness for a typical frame-based camera and human eye. Fluorescent and LED lights under Alternating Current (AC) power source can be modelled as a periodic signal over time t. Expanding the signal in Fourier series yields for Fourier coefficients a k and b k . Due to the electronics in fluorescent and LED lights the higher order coefficients are generally quite large and the signal cannot be attenuated by a simple notch filter at the base frequency. The power spectral density of the signal (3) consists of an infinite sum of harmonics at multiples kω 0 of the base frequency.

Feed-forward Comb Filter
The basic feed-forward comb filter [31] subtracts a time-delayed version of the signal to itself (see Fig. 2). If the time delay corresponds exactly to the period τ = 2π/ω 0 of the flicker, then the resulting summed signal attenuates the flicker. The corresponding system block diagram is shown in Fig. 2(a). The bode plot shown in Fig. 2(b) displays periodic notches to the input signal corresponding not only to the base frequency f 0 = ω 0 /2π, but also to the harmonics of the flicker frequency. The infinite harmonic notch filter is characteristic of the time delay action; the cancellation of periodic signals works equally well at multiple cycles of the base period τ = 2π kω0 as it does for k = 1. This infinite-dimensional nature of the comb filter is ideal for the suppression of harmonic noise characteristic of flicker in event data.
However, as seen from the bode plot in Fig. 2(b), there is a significant magnitude and phase distortion around the notches. The basic feed-forward comb filter also attenuates the DC component of the signal. In the proposed application this will annihilate static scene information and would compromise the performance of the filter.

Distortion attenuation
To solve the magnitude distortion problem of the feed-forward comb filter [26], we introduce a scaled positive feedback signal in addition to the feed-forward signal as shown in Fig. 3. The feed-forward comb filter can be thought of as a transfer function with an infinite set of zeros corresponding to the expansion of the exponential function. The feedback loop introduces a corresponding infinite set of poles that are frequency aligned but have a slightly lower amplitude. This introduces a near pole-zero cancellation of the filter response localising the frequency effect of the comb filter. The transfer function for the feed-forward/feedback comb filter is where 0 < ρ < 1 is a tuning parameter. The parameter ρ governs how closely the pole cancels the corresponding zero and determines the depth and width of each notch. A higher ρ value localises the filter effect close to the notch frequency and ensures that other frequencies are not distorted, while a lower ρ value widens both the notch and the associated frequency distortion up to the limit ρ = 0, where the basic feed-forward comb filter is recovered. The corresponding bode plot is shown in Fig. 3(b).
The combination of a feed-forward and feedback filter provides an infinite sequence of notch filters at all harmonics of a base frequency with a tunable factor ρ that allows the notch to be widened at the cost of increased frequency distortion. The remaining difficulty is the fact that the feed-forward loop still cancels the DC response of the base signal.

Proposed event-based flicker removal algorithm
The proposed filter ( Figure 4) uses a reciprocal comb filter [14] (in resonant mode with gain on the feed-forward path allowing the feedback to dominant and emphasise flicker) at a much higher frequency with a smaller time-constant τ 2 << τ 1 to introduce where the gain ρ 2 serves the same purpose as ρ 1 in (6). The time constant τ 2 must be chosen significantly smaller than τ 1 , in our work we typically use τ 2 = τ 1 /10 and tune the gain ρ 2 to satisfy τ 2 (1 − ρ 1 ) = τ 1 (1 − ρ 2 ) to ensure that the decade slope of the resonant mode matches the attenuation of the DC notch that needs to be cancelled. The pole-zero plot in Fig. 4 provides a visualisation of the resulting pole zero cancellations. Fig. 4(c) shows the bode plot of our proposed filter with the desired notch filters at all harmonics with the DC component unaffected.
The time-domain solution of (7) can be written as This is a causal function that only depends on the present and past value of input x and output y. The resulting filter can be implemented by processing incoming events and keeping a ring buffer of events to implement the time-delays.  0  100  200  300  400  500  600  700  800 0  100  200  300  400  500  600  700  800  0  100  200  300  400  500  600  700  800  0  100  200  300  400  500  600  700  800  0  100  200  300  400  500  600  700  800 Basketball Table Tennis Badminton 1 Badminton 2 Nerf Gun Figure 5: Qualitatively analysis of the raw and filtered event data from five high-speed datasets with a flickering fluorescent light source. The first row (a) are image reconstruction E2VID [27] using raw event data. The second raw (b) shows image reconstruction E2VID [27] after event flicker removal using our proposed filter (EFR), and the flickering light source is clearly attenuated. The third and fourth row demonstrate heat maps of events per second of the raw and filtered event stream. The events rate from 0 to the maxima is coloured from blue to yellow. Before flicker removal, most events occur around the fluorescent light source. The ratio of events occurring at the flickering region to all events before filtering is 84.0% on average. Our event-based flicker removal algorithm filters out most of the flickering events and mostly preserves the useful event data under the lights. Our filter is not affected by the motion across the flickering source (shown in Table Tennis).
An event sampler is applied at the output to regenerate an event stream. This sampler keeps a reference value of intensity and compares the output to the reference generating an event and resetting the reference when the filter output change is above the threshold. The input signal to this sampler is a zero-order hold signal and the threshold need only be checked when an event occurs, either in the input signal or from one of the ring buffers that instantiates the time delay. This can be implemented in digital logic.

Datasets
To the best of the authors' knowledge, there is no existing open-source datasets and algorithm available targeted at the event camera flicker removal problem. To fill the gap, we collected a set of real data under a flickering fluorescent light using a Prophesee Gen3 event camera (resolution 480 × 640). Our datasets include fast motions of a basketball, table tennis, badminton and Nerf gun. The flickering light source in the datasets is supplied by 50Hz alternating current in Australia, but the flickering primarily occurs at 100Hz because older fluorescent lights with magnetic ballasts flicker at twice the supply frequency [37] and 50Hz flickering mainly occurs at the two edges of the fluorescent light. (c)Badminton (d)Nerf Gun Figure 6: The power spectral density of high-frequency video reconstruction using HF [29]. The 50Hz, 100Hz flicker and their harmonics are effectively attenuated with our event-based flicker removal algorithm.

Video reconstruction and heat map of event rate
We evaluate the raw and filtered event data using the state-of-the-art pure event-based video reconstruction algorithm E2VID [27] in Fig. 5. The flickering light sources are obvious in the E2VID [27] reconstructed images using raw event data in Fig. 5(a). After applying our event-based flicker removal (EFR) algorithm, the flashing lights in reconstructed images are clearly attenuated in Fig. 5(b). Please see video materials for better visualisation of the flicker removal performance.
We also provide heat map analysis of event rate to visualise the distribution of the raw event data and the filter event data in Fig. 5(c)-(d). We accumulate event data during a 0.03-second time window for both raw event data and filtered event data. The event rate is modelled by the ratio of triggered event number to the time period. The event rate from 0 to the maxima is coloured from blue to yellow in Fig. 5. In a raw event stream, the number of flicker events is on average 84% of the total number of events within the image containing a flickering light source. In Fig. 5(c), it is clear that most events are triggered by the flickering fluorescent light, leading to the constantly flickering video reconstructions. The flicker events contain little or no useful information but occupy most data memory and computational resources, while the actual useful events are triggered at a very low event rate in comparison. Using our event-based flicker removal algorithm, most of the flicker events are filtered out in Fig. 5(d), while preserving useful event data. Interestingly, objects across the flickering source have minimal impact on our flicker removal algorithm. For example, when the table tennis ball in Fig. 5(b) and the racket in Fig. 1(b) are moving across the flickering fluorescent light, our filter is able to attenuate flickering events, leading to high-quality video reconstruction performance.
We also quantitatively analyse our flicker removal algorithm in Table 1, evaluating on the same time period as Fig. 5. We use the signal-to-noise ratio (SNR) foreground-events/ flicker-events as a metric for the quality of the data. A higher SNR indicates that most of the events in the dataset are relevant to the robot, whereas a lower SNR indicates that many of the events are associated with uninteresting flicker events. The first row of Table 1(a) documents the raw dataset. Note that even though the fluorescent light in this scene is less than 5% of the image, the SNR is an average of 0.19 (or around 84% of the data is flicker). After event flicker removal (Table 1(b)) the SNR average is 1.07 indicating that at least 50% of the remaining events are of interest to the robot. The relative improvement in SNR (b − a)/(a) is shown in the final row of Table 1. On average, the relative improvement in SNR is a factor of 4.63 times better after event flicker removal. It should be noted that the SNR is highly dependent on the foreground motion. For example, the SNR of the event steam in Basketball dataset is much higher than the others (in all three metrics). It is because the moving object in the dataset is bigger, triggering more foreground events than other datasets.

Power spectral density analysis
The flicker removal performance is also analysed by the power spectral density (PSD) diagrams. We reconstruct high-frequency video at 1000Hz using a high-pass filter (HF) [29] and analyse the PSD of a patch at the flickering area before and after applying our flicker removal algorithm. The PSD diagrams are shown in Fig. 6. Note that apart from the strong 100Hz and its harmonics, the fluorescent light also triggers events at 50Hz and its harmonics. Therefore, we set the based frequency to 50Hz to attenuate all flickering frequencies. Fig. 6(a)(c)(d) are very similar because there is no object moving across the flickering light source. The table tennis ball in Fig. 6(b) moves across the flickering fluorescent light, leading to more components at low frequencies. It also affects the flickering frequency of raw event data at 100Hz, and the 100Hz notch of our EFR algorithm is not as deep as the other datasets, but most of the flickering events are still removed.
To evaluate the convergence rate of our event-based flicker removal (EFR) algorithm, we also demonstrate the PSD of highfrequency video reconstruction by HF [29] and flicker filtered reconstruction in the first four 1-second sliding window periods (see Fig. 7). After 0.1 seconds, the PSD plot shows that most frequencies are unchanged while the flickering frequencies have been mostly attenuated. It shows that our event-based flicker removal algorithm takes around 0.1 seconds to converge. The actual convergence time also depends on the pre-defined buffer length and the parameter ρ. A smaller ρ will make the converge process even faster, with deeper and wider notches.

CONCLUSIONS
In this paper, we introduce the problem that event cameras are sensitive to flicker such as from fluorescent or LED lights. We proposed the first event flicker removal algorithm using a modified linear comb filter and the first event camera de-flickering dataset that includes objects with fast motions under a flickering fluorescent light for evaluation. Our proposed filter yields a relative improvement 4.63 in the signal-to-noise ratio of the filtered event stream compared to the raw event stream on average, and the flicker removal performance is visualised using power spectral density. It effectively attenuates flicker events and the associated harmonics, with convergence within 0.1 seconds. Our filter can be used as a front-end or preprocessing algorithm to provide a cleaner and flicker-free event stream for other robotics applications.