{'fraction_non_alphanumeric': 0.02810540459838758, 'fraction_numerical': 0.011160047775455359, 'mean_word_length': 4.439098660170524, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Video Reconstruction by Spatio-Temporal Fusion of Blurred-Coded Image Pair

Learning-based methods have enabled the recovery of a video sequence from a single motion-blurred image or a single coded exposure image. Recovering video from a single motion-blurred image is a very ill-posed problem and the recovered video usually has many artifacts. In addition to this, the direction of motion is lost and it results in motion ambiguity. However, it has the advantage of fully preserving the information in the static parts of the scene. The traditional coded exposure framework is better-posed but it only samples a fraction of the space-time volume, which is at best 50% of the space-time volume. Here, we propose to use the complementary information present in the fully-exposed (blurred) image along with the coded exposure image to recover a high fidelity video without any motion ambiguity. Our framework consists of a shared encoder followed by an attention module to selectively combine the spatial information from the fully-exposed image with the temporal information from the coded image, which is then super-resolved to recover a non-ambiguous high-quality video. The input to our algorithm is a fully-exposed and coded image pair. Such an acquisition system already exists in the form of a Coded-two-bucket (C2B) camera. We demonstrate that our proposed deep learning approach using blurred-coded image pair produces much better results than those from just a blurred image or just a coded image.


I. INTRODUCTION
Today's commercially available high-frame-rate cameras are expensive as their sensors need to be highly light-sensitive and should be able to handle large data bandwidth. For a given bandwidth and cost there is a trade-off between spatial and temporal resolution [1]. One way to overcome this tradeoff is to temporally upsample the frames captured from the low frame-rate camera using computational methods. Recently, learning-based methods like [2], [3] take in as input a longexposure (or blurred) image and computationally decompose it into multiple frames of a video sequence. Recovering multiple video frames from a single image is a highly ill-posed problem. The recovered video sequences obtained from [2], [3] are not completely deblurred and also contain several motion artifacts. These methods also suffer from motion ambiguity as the input frame has lost the information about motion direction due to temporal averaging.
This motion ambiguity can be overcome by using imaging systems such as flutter shutter [4], [5] and per-pixel exposure coding [1], [6]. The exposure systems such as [1], [6] use a per-pixel binary code, to temporally multiplex the information into a single coded frame. These systems compress only the temporal information at each pixel into a single value. Fully-exposed Coded Fully exposed-Coded pair  Fig. 1: We show the middle frames of extracted video sequences given a single fully exposed image, single coded exposure image and our proposed hybrid model consisting of a pair of coded and fully exposed images. The temporal information of the dynamic regions can be recovered well from the coded images and the spatial information of the static regions can be recovered well from the fully-exposed images. The fusion of this complementary information provides us with higher fidelity reconstruction over either the fully-exposed image or the blurred image alone.
The acquisition process of these imaging architectures form a better-posed linear inverse problem and the compressed high frame rate video signal can be recovered with high fidelity. However, one shortcoming of these encoding techniques is that they are light inefficient [7] and throw away a significant amount of light. This inefficiency can be overcome by the use of a blurred image that integrates the light over the whole exposure. We propose and investigate an algorithm to extract a video sequence from a complementary system consisting of a coded exposure image and a fully-exposed image. We show that when using the coded-blurred image pairs, we can better recover the static parts of the scene from the blurred image and the dynamic parts of the scene from the coded image. This overall leads to a higher fidelity in reconstruction compared to recovering the video from only the blurred image or the coded image.
In this work, we propose a learning-based framework to extract a sequence of video frames from a coded and blurred image pair. Such an acquisition system already exists in the form of the recently proposed multi-bucket sensor architecture [8]. The recently proposed Coded-2-Bucket (C2B) sensors contain two buckets per pixel of the sensor. While the first bucket outputs a temporally multiplexed frame encoded using the binary code C, the second bucket outputs a coded frame multiplexed using the code 1 − C. By adding the two coded exposure frames, we can obtain the fully exposed frame. We use the coded-fully exposed image pair and the knowledge of the known forward model specified by the code C to solve for a low-spatial resolution video sequence. A shallow, shared encoder network is used to extract features from the lowresolution video and fully-exposed frame. These features are then used to compute an attention map which helps in fusing the information from the coded frames and the fully exposed frame. The dynamic regions are better recovered from the coded frame while the static regions are better recovered from the fully-exposed image. The features fused using the attention map are fed to a deep neural network which outputs the full resolution video sequence. We train the network end-to-end on data simulated from videos captured using a high frame-rate camera. In summary, we make the following contributions: • Static parts of a scene are best captured by the fully exposed image and the dynamic parts by the coded exposure image. We design a deep learning architecture that exploits this complementary information to reconstruct high spatial and temporal resolution video. • Video reconstruction from just a blurred image suffers from the motion ambiguity problem. We are able to resolve this ambiguity by using a the coded image. • We show that we obtain better video reconstructions than just using the fully exposed image or the coded image only.
II. RELATED WORK High speed imaging systems: A hybrid system consisting of multiple conventional image sensors for high speed imaging was proposed in [9], [10]. Another hybrid system of intensity and event sensor based system was proposed in [11] for extracting a video sequence using a blurry image and information from an event sensor. Event based sensors have also been used to design a low power high speed camera [12], [13], [14], [15]. Other methods of high speed imaging involve temporal superresolution of video sequences captured from a low frame-ratecamera [16]. Some methods propose interpolation of multiple frames between successive frames of a low-frame rate video using optical flow [17], auto-regressive model [18], kernel regression [19], learning-based methods [20] among others. Recently, few works have also explored the possibility of decomposing a single blurred frame into a sequence of video frames [2], [3].
Coded exposure imaging: A global pixel coding system known as flutter shutter was proposed in [5] for image deblurring and compressive video recovery [4]. A similar system was proposed in [21], which used a coded strobing photography system for compressive sensing of high speed videos. The flutter shutter camera further extended to recover a video sequence in [4]. Pixel-wise coded exposure imaging system which use DMD [6] or modified conventional CMOS sensors [1] have been very popular. Several algorithms have been proposed [22], [23], [24], [25] which utilize this imaging architecture for compressive high speed imaging. Recently, a multi-bucket sensor called Coded2Bucket camera [8], [26] capable of controlling the exposure for individual pixels has also been used [27].
III. VIDEO FROM CODED-BLURRED IMAGE PAIR Fig. 2 shows the overview of our proposed algorithm which takes in as input a pair of coded and fully exposed images and outputs a sequence of video frames. The algorithm can be broadly divided into 3 stages. In the first stage, we obtain low spatial resolution video sequences from each of the input pair of frames as explained in Sec. III-A. The second stage uses an attention module to fuse features that are extracted from the two video sequences. The third stage consists of a deep neural network which predicts the full-resolution video sequence from the fused features.
The predicted video from our proposed algorithm has T consecutive frames each of spatial resolution H × W . This output is obtained from only two input frames: coded-exposure and fully exposed frames. The coded exposure frame is obtained by multiplexing the temporal scene information by a predetermined binary code C. This multiplexing is done by first dividing the full exposure of the sensor into T equal subexposures. In each of these T sub-exposures, the code can be either 0 (block incoming light) or 1 (integrate incoming light), acting as a shutter for each of the pixels individually. The fullyexposed frame is obtained by integrating the light over all the T sub-exposures. The process of obtaining the coded image Y c and the fully exposed image Y b can be written as, where is the element-wise multiplication, X t are the intensity frames and C t is the binary code. Each of the X t and C t have the same spatial resolution H × W . In our algorithm we consider a code of size N × N × T where N = 3. This code is then repeated spatially to obtain the full code C of size H × W × T . As the code is repeating, we divide the input coded and blurred frames of size H × W into tiles of size N × N and explain our algorithm on an individual N × N tile. This process can be repeated over all the tiles to obtain the final reconstructed video sequence of size H × W × T . Coded image: Y c Fully-exposed image: Y b High-res video: Low-res video: X c Shuffled video: X f Fig. 2: Our proposed algorithm takes in as input a coded exposure image and a full-exposed image and outputs the corresponding high temporal resolution, sharp video sequence. The coded exposure image can be used to extract the motion information and the fully exposed image can be used to extract the spatial information. We extract these complementary features from each of the input images and then fuse them using the computed attention map. We finally use a fully-convolutional auto-encoder to learn a mapping from the extracted feature map to the high spatio-temporal resolution video sequence. In the local spatial neighborhood of N × N pixels we make the assumption of uniform intensity to facilitate inversion of the ill-posed system in Eq. (1). With this assumption, we recover a video spatially downsampled by N times.

A. Initial low-resolution video reconstruction
The very first part of our proposed algorithm consists of obtaining two low-res videos X c and X f from the coded image and the fully-exposed image, respectively. We obtain X c by solving the linear inverse problem and X f by re-arranging the pixels in the fully-exposed image into a video sequence.
First we wish to obtain a video sequence of size N ×N ×T from the coded image of size N × N by inverting the linear system shown in Eq. (1). However, this is a highly illposed problem with N 2 T unknowns with only N 2 observed quantities. In our case, we have T = 9 and hence we have 9 times more unknown quantities than the observed quantities. To make this inversion better posed, we make the assumption of uniform intensities in a local spatial neighborhood of N ×N as shown in Fig. 3, based on the local spatial correlation in natural images. In our experiments we choose N = 3, hence our assumption of uniform intensity in the small spatial neighborhood remains valid. With this assumption, the number of unknowns reduce to T = 9 from N 2 T = 81 and hence can be solved by inverting the system of N 2 = 9 equations. Hence, from the tile of size N × N of the coded image, we obtain the video sequence of size 1 × 1 × T , where we have T = N 2 .
Next, we consider the Pixel Shuffle block in Fig. 2 where we reshape a N × N (= T , in our case) tile from the blurred image into a 1×1×T low spatial resolution video. For this, we vectorize the N ×N tile and the index of this vector represents the frame number in the 1 × 1 × T low-res video where we restrict T = N 2 . This process is repeated for both the coded and blurred images to obtain the low spatial resolution video X c and X f each of size H/N × W/N × T .

B. High resolution video reconstruction
Our objective here is to obtain the full-resolution video H × W × T from the given two input videos of size H/N × W/N × T . The video sequence X c gives us the information about scene motion direction which otherwise would have been lost due to temporal averaging. The video sequence X f contains valuable spatial information for parts of the scene which remain mostly static. We use an attention mechanism to fuse the information from these two inputs. The fused features are then input to a deep neural network to predict the final full-resolution video of size H × W × T .
First, we use a shallow encoder network E θ to extract features Φ c = E θ (X c ) and Φ f = E θ (X f ) from the two input video sequences. We then computeÂ as the cosine distance along the channel dimension between the feature maps Φ c and Φ f . As Φ c and Φ f share the same encoder network E θ , similar (or dissimilar) features correspond to similar (or dissimilar) regions in the input videos X c and X f . The low-resolution video sequences X c and X f are similar in the static regions of the scene and dissimilar in the dynamic regions of the scene. This is because the video X c has good motion information and X f is obtained by merely rearranging the input pixels. Since the attention map measures the cosine distance, it has higher values for static regions and lower values for the dynamic regions of the scene. We normalize the cosine distance map A to be between [0, 1] and obtain the attention map A. As shown in Fig. 2 [31]. For [3] and [2] the input is a blurred frame generated by averaging 7 consecutive sharp frames. While, for GMM [30] and our algorithms, the input coded and blurred images are obtained by (coded) averaging 9 consecutive frames.
is then fed to a U-net like architecture which outputs the fullresolution videoX corresponding to the ground truth video X. The network is trained end-to-end using the cost function defined as, where ∇ denotes the finite difference spatial gradient operator.
C. Architecture details Fig. 2 depicts the architecture of our proposed network. The shared encoder block E θ consists of three convolution layers of sizes 64, 64, 128 and 3×3 filters. The first two layers are followed by ReLU activation. All convolutional layers use stride 1 and padding 1. The extracted feature maps Φ c and Φ f consist of 128 channels and the same spatial dimension as the inputs X c and X f . The attention map A is obtained by computing normalized inner product between features Φ c and Φ f along the channel dimension, then scaled to the range [0, 1]. The feature maps Φ c and Φ f are multiplied by (1 − A) and A respectively and concatenated to form a fused feature map of 256 channels. The fused feature map is then passed to the U-Net which follows a similar architecture as [28]. It consists of three contracting encoder blocks each followed by a 2 × 2 Maxpool layer, a bottleneck block, two expanding decoder blocks and a final decoder block. The final layer in our network is a Pixel-Shuffle layer [29] which increases the spatial resolution N times and hence outputs the video sequence at the same resolution as the ground truth video.

IV. EXPERIMENTAL RESULTS
We use GoPro dataset [31] consisting of 33 video sequences with a frame rate of 240 fps and a spatial resolution of 720 × 1280. This data is split into 22 train sequences and 11 test sequences following the split proposed in [31]. The first 500 sharp frames under each training sequence are taken to form our training set. We simulate our coded exposure images using consecutive 9 frames from each video sequence. We train our network on non-overlapping patches of size 240 × 240 extracted from the training set. Hence, the ground truth video X to our model is of size 240 × 240 × 9 during training.
For all our experiments we set the code C to be a tensor of size 3 × 3 × 9, where 3 × 3 is the spatial extent and 9 is the temporal extent of the code. For our proposed method we fix the code C to be a sequential impulse code as shown in Fig. 5. The code C sequentially samples all the 3×3 spatial locations over the 9 temporal frames exactly once. Each of the 3 × 3 pixels is sampled at one of the temporal frames. This code is then repeated spatially to span the entire spatio-temporal volume of the input frames. The coded images are obtained by multiplexing the ground-truth videos with the above tiled code according to Eq. (1) and the blurred or fully exposed images are obtained by just adding the frames of the ground truth videos.
As we use a fully-convolutional model, the network can take in as input coded exposure frames of any spatial resolution that is a multiple of 3. The regularizer weight λ is set to 0.1 in Eq. (2) for all our experiments. We train the network using Adam optimizer [32] with a learning rate of 0.0001, for 200 epochs of the training set and with a batch size of 64. We use Pytorch [33] to build our entire network architecture. During testing, we use the code C used during training to simulate the coded exposure frames from 9 consecutive video frames, each of size 720 × 1280. These coded exposure frames are then used to predict the video sequence and compared against the ground truth video sequence.

A. Video reconstruction
In this section, we compare the fidelity of video reconstruction for different inputs: a single blurred frame; a single coded frame; and a pair of coded-blurred images.
For evaluation of video extraction from a single blurred frame we choose algorithms [2], [3], which take as input a blurred frame obtained by averaging 7 consecutive frames from the test set of GoPro dataset [31]. These algorithms predict the 7 consecutive video frames from which the blurred image was formed. For evaluation of video reconstruction from a single coded image, we use the data driven Gaussian Mixture Model (GMM) based algorithm proposed in [30]. The GMM is trained with 20 components using 8 × 8 × 9 video patches extracted from the training dataset of GoPro [31]. We then use the trained GMM to predict video of 9 frames from an input coded exposure image. We also modify our proposed algorithm to predict video sequence from a single coded frame as input. This modification only acts as another strong baseline in our experiments and is not our proposed method. In our modified architecture, we first extract the low-res video sequence X c from the single coded image as described in section III-A. This low-res video sequence is then given as an input to the U-Net [28] model whose output the full-resolution video sequence with 9 frames. As this model  Fig. 4: The first and last frames of videos extracted from randomly selected test sequences has been shown. The video reconstruction fidelity has a significant improvement when using the coded image as input vs. using a single blurred image. Our proposed algorithm uses both the coded and blurred frame as input and shows the best reconstruction quality. Sequential impulse code 3 x 3 x 9 1 : exposed pixel; 0 : unexposed pixel Fig. 5: The sequential impulse code of size 3 × 3 × 9 used in our algorithm which is repeated spatially to match the spatial resolution of the ground truth video sequence.
takes only a single coded exposure frame as input we do not use any attention map. This modified architecture is also used to predict the video sequence from a single blurred frame as input. We also evaluate our proposed algorithm which takes as input a pair of coded-blurred image frames, and predicts the corresponding video sequence of 9 frames. The GMM based algorithm [30] is also modified to provide the output video sequence of 9 frames from an input of pair of coded-blurred frames. Notice that algorithms such as [2], [3] extract only 7 frames from the input while GMM [30] and our proposed algorithms extract 9 frames from the input. Although the comparison is not very fair, we only wish to highlight the extreme ill-posedness of extracting video from a single blurred frame input over a coded frame input. For each of the cases, we compute the peak signal-tonoise ratio (PSNR) and the structural similarity index (SSIM) [34] of the predicted frames against the original frames. In Table I we provide quantitative evaluation on the entire GoPro test set. For blurred frame video extraction, we consider the algorithm proposed in [3] and our architecture modified to take single blurred frame as input. We compare the reconstruction from single coded frame input and coded-blurred frame input variants of our proposed method. As the code for [2] is not open source, we requested the authors to provide the predicted frames for 15 randomly selected blurred frames from the test set. In Table II, we provide quantitative comparison on this set of 15 test sequences for all the above algorithms. We also provide qualitative comparison for some of the 15 sequences, in Fig. 4. From the comparisons it can be seen that extracting video from a coded frame is a much better-posed problem in comparison to extracting video from a single blurred frame. In Fig. 4, we see that the motion direction of the car is reversed when the video is extracted from a single blurred frame. The qualitative results can be better seen as video in the accompanying supplementary material.

B. Middle frame extraction
Algorithms that extract video from a single blurred image [2], [3] suffer from motion ambiguity due to the loss of temporal information. However, for these algorithms, deblurring the image or extracting the middle frame of the video sequence is a slightly better-posed problem. Comparing only the fidelity of the deblurred images instead of the entire video   [31]. While [2], [3] extract 7 consecutive frames, GMM [30] and our proposed algorithms are designed to extract 9 consecutive frames from the given input.
sequence gives a slightly fairer chance to algorithms which use only the blurred frame as input. We also use a state of the art learning-based image deblurring algorithm [35] as an additional comparison. To add another stronger baseline, we include the quantitative results from GMM [30] and our modified architecture that takes only a single coded frame as input. In Table III, we compare the PSNR and SSIM [34] values for the predicted middle frame. From Table III, we observe an average gain of 2dB PSNR when using a single coded image versus a blurred image for extracting the middle frame. We observe a further gain of 1.5dB PSNR when the additional fully exposed frame is used as an input. This points to the fact that the issue of motion ambiguity has a huge impact on the performance of [2], [3]. Our proposed method is able to outperform all the previous works as it is able to exploit the complementary information provided by the fully exposed and coded frames. We show some of the extracted middle frames in Fig. 6 for some of the 15 test sequences used for the evaluation. More results can be found in the accompanying supplementary material. Through this experiment, we only reiterate the advantage of using the additional information from coded image in terms of fidelity of video reconstruction.

C. Visualizing attention maps
As the inputs to our framework provide complementary information, we use attention mechanism to attend to different parts of the scene from different inputs. The attention map helps to combine features extracted from the two inputs, the coded frames and the fully-exposed frame. We use the datasets proposed in [36], [37] to visualize our attention maps. These videos contain a static background and a few dynamic objects in the foreground and are captured using a static camera. We simulate the two coded frames and the fully-exposed frames from these videos and provide it as an input to our trained model. We visualize the attention maps learned from these inputs in Fig. 7. We observe that the attention maps make a clear distinction between the static parts and dynamic parts of the scene. This experiment confirms that the trained network attends to different regions of the scene from different inputs. The trained network attends to the static regions of the scene in the fully-exposed frame and to the dynamic regions of the scene in the coded exposure frames. Fig. 6: The first row shows crop of the deblurred image from a fully-exposed image using [35] for some randomly selected frame sequences from the GoPro test set [31]. The second and third rows show crop of the middle frame of the predicted video sequence obtained using our method, from a single coded image and from a coded-blurred image pair.

V. CONCLUSION
In this work, we propose a method to extract a video sequence from a coded exposure image and a fully exposed image. We propose an attention mechanism to fuse the complementary spatial and temporal information from the input images. In this work we observe a tradeoff between imaging hardware complexity and the fidelity of the recovered video sequence. A blurred image can be easily acquired, but recovering the video sequence from this blurred image is highly ill-posed and the current algorithms require further innovation. Acquiring a coded image requires significant hardware modification, but provides a large improvement in the fidelity of the recovered video. However, the sensors that can acquire coded images are still not commercially available. Recently proposed C2B sensors show a promise in this direction which allows per pixel exposure control and is also 100% light efficient. We show that, the additional information of fully-exposed image that can be obtained from these sensors provide a further improvement in the fidelity of the reconstructed video. In future, we would also like to obtain the prototype C2B camera and test our proposed method on the real data acquired from the sensor.

CODE AND SUPPLEMENTARY MATERIAL
The code associated with the publication can be found here: https://github.com/asprasan/codedblurred/.
The associated supplementary material with video reconstruction results can be viewed here