{'fraction_non_alphanumeric': 0.026616360830046305, 'fraction_numerical': 0.011593208712056251, 'mean_word_length': 4.912796592983168, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
KeystoneDepth: Visualizing History in 3D

This paper introduces the largest and most diverse collection of rectified stereo image pairs to the research community, KeystoneDepth, consisting of tens of thousands of stereographs of historical people, events, objects, and scenes between 1860 and 1963. Leveraging the Keystone-Mast raw scans from the California Museum of Photography, we apply multiple processing steps to produce clean stereo image pairs, complete with calibration data, rectification transforms, and depthmaps. A second contribution is a novel approach for view synthesis that runs at real-time rates on a mobile device, simulating the experience of looking through an open window into these historical scenes. We produce results for thousands of antique stereographs, capturing many important historical moments.


Introduction
Wouldn't it be fascinating to be in the same room as Abraham Lincoln, visit Thomas Edison in his laboratory, or step onto the streets of New York a hundred years ago? If only there were a way to travel back in time and capture these moments with a lightfield camera [24]! We take a major step towards this lofty goal by publishing the Key-stoneDepth collection, the world's largest and most diverse collection of stereo image pairs, showing historic people, events, objects, and scenes between 1860 and 1963. We also describe a novel real-time view synthesis technique we developed for visualizing this collection that reproduces stereo, parallax, and visibility cues over a predetermined head volume to give the sensation of peering through a window into these other times and places.
Stereo cameras and viewers were invented in the mid 1850s, and quickly became very popular. Many of the worlds most famous people, events, and places over the following century were captured in stereo, and hundreds of thousands of these stereographs survive to this day. Notably, the California Museum of Photography has 250,000 stereoscopic glass-plate and film negatives from the Keystone-Mast Collection, of which 45,197 are available online. This imagery opens up the fascinating possibility of reconstructing dense lightfields of these historic scenes that could be used to create immersive "like you were there" visualizations.
However, these antique stereographs are not in a form that facilitates this type of research and development. They are uncalibrated, unaligned, and contain many artifacts (scratches, damage, dirt, exposure differences, contrast loss, scanning errors, etc.). Modern view synthesis algorithms are not designed to work with this kind of data, and predictably do not produce satisfactory results when applied naively. Another major challenge is overcoming the need to extrapolate well beyond the input stereo pair in order to achieve an immersive range of head motion.
Our contributions are two-fold. First, we introduce the KeystoneDepth collection, the world's largest collection of rectified antique stereographs with camera calibration, depth, and metadata, as a resource for the research community, see Section 3. Beyond its historical value, this collection is one of the largest and most diverse collections of stereo images of any kind. Assembling, processing, and cleaning this collection took months of work, and we believe it is a contribution of significant value to the research community.
Second, we introduce a novel approach for view synthesis that is able to generate new views of a captured historic scene at real-time rates on a mobile device as the viewer moves within a predetermined head volume. Unlike traditional lightfield rendering techniques [17] that require a dense set of input images, our formulation requires only a single input stereo pair (similar to the method of Zhou et al. [37], but designed for 6DOF rather than 1DOF motion). In particular, we use a lightweight representation of the 3D scene comprised of several depth maps with aligned intensity images. We introduce a novel double reprojection method to train a deep neural network for inpainting intensity and depth values that are missing at interpolated viewpoints. One additional innovation is a depth boundary optimization technique that improves the quality of object silhouette edges under camera motion. Altogether, our approach can smoothly extrapolate views significantly beyond the input range at real-time rendering rates, thus creating a compelling illusion of looking through a window into one of these historic scenes.

Related Work
We describe related work in two different areas: stereo datasets by prior authors, and techniques for producing 6DOF (parallax) enabled representations from stereo pairs.

Stereo Datasets
Several research groups have produced stereo image benchmark datasets over the years, most notably the Middlebury benchmark [27], leading to rapid progress in stereo performance. While the Middlebury dataset is limited in number (a few dozen) and scope (laboratory scenes), subsequent researchers [8,16,28] have improved the selection and quality of stereo benchmark images available online. Nevertheless, these datasets are largely limited to buildings [28], streets [8], or specific objects like tanks and temples [16]. While Li et al. [18] use multiview stereo to infer depthmaps for tourist sites using Internet imagery, it's less clear how to produce rectified stereo pairs in this manner.

Stereo to 6DOF
Viewing a stereo image pair with a stereo viewer provides a compelling experience except that your viewpoint is fixed. Simulating parallax as you move your head is key to a more realistic and immersive visualization. The simplest form is view interpolation [6,23,29], which produces a narrow range of viewpoints strictly in between the two inputs. While some view interpolation methods are capable of extrapolation, holes emerge and performance degrades beyond the input views due to visibility changes.
Filling in these holes, i.e., hallucinating hidden regions, is key to generating a larger (6DOF) range of viewpoints. This is however very challenging, and previous work has typically resorted to using multiple cameras [5,10,25,36,38]. Zhou et al. [37] proposed instead a stereo magnification approach that uses machine learning to estimate a multi-plane image representation from a single stereo view. Although the estimation is highly unconstrained, they show high-quality view extrapolations results without holes in a variety of settings, that sometimes show depth quantization and rubber sheet artifacts at edges. Recently, Choi et al. [14] generated extreme view extrapolations (up to 30x the baseline), but it requires running a CNN to render each frame, making it unsuited for lightweight real-time applications. Unlike [37], our proposed representation based on multiple inpainted intensity and depth images exhibits no depth quantization, and is lightweight to run in a cellphone. To note as well, is the recently launched Facebook 3D Photo feature [1], that enables creating a 6-DOF experience from a stereo image taken on a cellphone, and uses diffusion [4] to fill in missing regions.

Image and Depth Inpainting
Traditional image inpainting algorithms find candidate patches in the same image to fill in holes [3,4,7], or find good matches in a large database [9]. State-of-the-art methods [12,20] use large CNNs that do semantic aware inpainting by recognizing objects in the scene and learning how to inpaint them. Other work has addressed depth inpainting. For example, Zhang et al. [34] estimate scene normals and use them to inpaint depths with sparse constraints. Others [11,31,33] focused on densifying sparse depthmaps for 3d reconstruction and AR applications. In this paper, we train networks to do both image and depth inpainting and build on the partial convolution framework of [20].

The KeystoneDepth Dataset
A primary contribution of this work is the creation of a large public collection of rectified antique stereoscopic images along with corresponding camera parameters and disparity maps (scene depth up to an unknown scale). Hundreds of thousands of antique stereographs can be found in museums and antique stores, and many can be found online [2,32,19]. Among them, the Keystone-Mast Collection [32] maintained by the California Museum of Photography (CMP) has the largest collection. It mostly consists of gelatin silver contact prints made from the original negatives, captured by the Keystone View Company, a major distributor of stereoscopic images. This collection contains 250,000 stereographs captured between 1860 and 1963, portraying a wide variety of subjects, ranging from scenes from World War I and American presidential inaugurations to portraits of Mark Twain and Thomas Edison to images of the Egyptian pyramids and scenes of daily life on farms and factories during that time period. Of these, 45,197 are available online.
While the raw imagery is available, it is not in a form well-suited for research and development, as the images are not aligned, calibrated, or rectified. Furthermore, many of the scans are of poor quality or have significant visual artifacts ( Figure 2, top row). A major challenge we faced in constructing this dataset was filtering out the many unusable samples from the Keystone-Mast collection and, for the rest, determining the largest artifact-free bounding box in each side of the stereo image that contained usable data, as described later in this section.
Each entry in the KeystoneDepth dataset consists of the original stereoscopic image and its corresponding metadata, a URL to the corresponding entry in the Keystone-Mast collection, a bounding box for each image in the stereo pair marking the largest image region free enough of artifacts for reliable disparity estimation, a rectified stereo pair, camera parameters, and a pair of disparity maps. The resolution of the images is typically about 570 × 610 pixels, and we provide depthmaps at 512 × 512 after rescaling. Altogether, we considered 29,480 stereoscopic images from the Keystone-Mast collection and were able to compute disparity maps for 10,134. We plan to expand this further as more of the museum's holdings make their way online.

Image Acquisition and Filtering
We downloaded stereoscopic images and their accompanying metadata from the Keystone-Mast collection by crawling the index on the CMP website 1 . In a first step, we automatically detected and removed stereo pairs that are unsuitable for depth estimation using the following procedure: compute SIFT features for both the left and right image and cull any pair having less than 0.5% (or 10 total) good matches between the two sides, where a match is considered "good" if it passes the ratio test with a threshold value of 0.7. This step removed most of the monocular images, backs of stereocards, and the poorest quality images. For images with 0.5% − 1.5% good matches, we hired Mechanical Turkers to inspect each one by hand and identify 1 http://ucr.emuseum.com/collectionoverview/3631 images that were not valid stereo pairs, upside-down, or had inverted intensities. We removed the non-stereo images and corrected the latter two cases.
In a second step, we hired a crowdsourcing company [30] to manually specify the largest artifact-free rectangular crop region in each side of a stereo image pair (Figure 2, bottom row). Finally, we used matching SIFT features within these regions to align the crops and compute their intersection. The images were cropped again to this intersection region and processed according to the steps described below.

Stereo Rectification
In order to compute disparity maps, each stereo image pair is first rectified so that epipolar lines are aligned with the image pixel rows. We used the stereo rectification method developed by Loop and Zhang [22], which works for uncalibrated cameras, with two modifications. First, the offset of the two principal points in x-axis is ambiguous. We assume the principal point is the center of the full image, if available. Otherwise, we translate the images after rectification so that there is no negative disparity. Second, we assumed a vertical field of view of 45 degrees, as that produced the most plausible depth scaling in our experiments, and inferred a corresponding camera focal length based on this assumption.

Disparity Estimation
The relatively low quality and noise characteristics of antique stereographs complicates the stereo matching problem, and we found that the top stereo algorithms on the Middlebury benchmark did not produce good results. Instead, we found that dense optical flow methods performed better, as they are more tolerant of rectification errors that result in vertical displacements between corresponding scene points.
In particular, we used the FlowNet2 algorithm [13] to compute optical flow and retained the horizontal component We compute four new viewpoints at the corners of a quadrilateral surrounding the input image as described in the paper. (c) We reproject the input GD image to these four new viewpoints, which produces holes at object boundaries. (d) We use a self-supervised learning method to inpaint these holes. Our representation of the 3D scene is the union of these GD images, stored as a texture-mapped triangle mesh. of the flow vector at each pixel as the stereo disparity. We found this strategy produced the best results of the methods we evaluated, producing accurate and sharp boundaries even for inputs as challenging and diverse as those in

Real-Time View Synthesis from Antique Stereographs
We developed a real-time method for synthesizing novel views from antique stereographs as a way to both visualize the entries in our KeystoneDepth dataset and to power a mobile application that gives a user the sensation of looking through a window onto a historical scene. We first introduce our representation of the 3D scene (Section 4.1) and then describe a novel learning-based technique for inpainting holes in both depth and intensity images that emerge with viewpoint changes (Section 5).

Scene Representation
We seek a compact 3D scene representation that enables rendering new viewpoints within a head volume centered around the input stereo pair at real-time framerates on a mobile device. We first define the supported range of viewpoints as a plane bounded by a quadrilateral (Figure 3). This quad captures all viewing rays (within the input camera's field of view) that pass through the quad, and thereby enables generating a range of views in front-of and behind the plane, whose rays intersect the quad [17].
We approximate the continuous range of viewpoints within the quad by sampling five discrete viewpoints: the four corners of the quad, and the center viewpoint (defined by the left image in the stereo pair). For each of these five viewpoints, we generate a full grayscale intensity plus depth ("GD") image. These GD images are treated as textured meshes which are rendered to produce in-between views within the quad. Unlike most traditional view interpolation methods, which interpolate new views from real photos, these corner GD images are synthesized. As such we perform two phases of view synthesis: one to extrapolate these quad corner views (offline), and a second to interpolate views inside this quad (online in real-time).
Formally, take the left image of the stereo pair as a reference, and assume depth has been computed to form a reference GD image denoted v 0 . Consider a coordinate system whose origin is located at the reference camera's center of projection at v 0 = (0, 0, 0) with its -z direction aligned with the optical axis of the reference camera, as shown in Figure 3. We pick the scene center to be c = (0, 0, −1/median(1/D 0 )), where D 0 is the reference depth map. Based on the head movement (r w , r h ) we want to support, we set the quad corners to −r h , 0). Further, we orient the cameras at the corners towards the scene center. Let R(v, c) denote the rotation matrix for a camera located at v looking at the location c with up vector the same as the reference camera. Our scene representation thus consists of the set of image tuples 4], where I(v, R) and D(v, R) are intensity and depth images from a camera at position v and rotation R, respectively.
Choosing appropriate values for r w and r h is application dependent, as it depends on the depth of the scene contents and the desirable range of head motion. In the case of antique stereographs, however, we generally don't have access to the metric camera parameters, and therefore cannot specify physically meaningful viewpoint ranges. Therefore, we instead choose these parameters based on the desired amount of image parallax when moving from one side of the quad to the other. Specifically, we obtained good results on average with r w = r h = 96b dmax × √ 2 2 , where the d max is the maximum disparity and b is the camera baseline, corresponding to maximum displacement of 96 pixels.

Intensity and Depth Inpainting
Our scene representation requires reconstructing intensity and depth images of the 3D scene as seen from the four quad corners. For most scenes, reprojecting the reference GD image (left stereo input image) to these viewpoints will produce images that have holes along depth boundaries v v v Figure 4: We reproject a GD image at viewpoint v to a different viewpoint v and then back to v, in order to generate a pattern of holes at v that are characteristic of those revealed by viewpoint changes. We apply this double reprojection to train a neural network to inpaint these types of holes.
where parts of the scene come into view that are not visible from the reference viewpoint ( Figure 3). A fundamental problem that any view synthesis method must overcome is filling in this type of missing data. We take a machine learning approach to this problem and train a neural network to inpaint missing regions in GD images of these types of scenes, and build on stateof-the-art inpainting techniques [20] designed for color images. The method of Liu et al. [20] uses training data augmented by adding holes, in the form of rectangles or random streaks. We observe that holes in reprojected images are different and have a characteristic structure: they follow object boundaries and correspond primarily to background regions in the scene that become visible due to disocclusions. One way to produce training data that possesses this structure is to reproject a GD image v to a new viewpoint v and compare it to a ground truth image from v . However, such an approach requires having ground truth depth and intensity images, which is not available in our case. We therefore introduce a technique that generates realistic holes across a single complete GD image and apply it to train a neural network for this inpainting task.

Double Reprojection
As shown in Figure 4, reprojecting an input GD image from v to a new viewpoint v and then back to v produces an image that is comparable to projecting a complete GD at v to v. However, the advantage of the former is that it requires only one GD, not two. Hence, we can produce a large number of training images with holes and hole-free ground truth by performing this double reprojection using the set of GD images in the KeystoneDepth dataset.
Specifically, we construct a triangle mesh from the input depth image that is textured using the image intensities and remove triangles that straddle depth boundaries by thresholding maximum relative difference in depth. We then render the resulting mesh from each of the viewpoints at the quad corners. Finally, we reconstruct a new GD image from each rendered result (now having holes) and perform this meshing-and-rendering operation a second time, but now from the original viewpoint. The result is a set of masks that mark characteristic hole locations in the original GD image.

Boundary mask
We found that inpainting intensity and depth across depth boundaries tends to generate blurry transitions between the foreground and background parts of the scene. To avoid these kind of artifacts, we add a boundary mask as an additional input to the network, that indicates the location of depth discontinuities. In general, one can only infer a depth discontinuity on the foreground side of a reprojection hole, as the scene might have constant depth along the background side of it. Therefore, we detect pixels on the foreground side of the reprojection holes and store them as a binary boundary mask B. Sample boundary masks are shown in Figure 6, and we provide more details on how they are computed in the supplementary material.

Inpainting network
We train a deep convolutional neural network to inpaint holes in GD images. The architecture of our network is the same as that proposed by Liu et al [21] for similar image synthesis tasks: a standard U-Net [26] where the convolutional layers have been replaced with partial convolutions. , where denotes element-wise multiplication. We trained two networks, one for inpainting intensity holes and one for depth, whose outputs areÎ andD respectively.

Network Inputs and Outputs
Losses: For inpainting image intensities, we used the same loss as Liu et al. [20] including L1 loss in both valid and hole regions, total variation loss, perceptual loss and style loss. For depth inpainting, we used an L1 loss with different weigths for the valid (non-hole) and hole regions, and a total variation loss on the composite depth, to encourage sparse depth discontinuities in the final output, i.e., whereD p andD t are predicted and ground truth normalized inverse depth and T V (x) is the total variation loss, and D comp = (1 − M ) D p + M D t is their composition.

Implementation Details
We train the intensity and depth inpainting network on a subset of our dataset containing 676 samples from the Key-stoneDepth. To improve results, we pre-train on a dataset of 9400 samples of SUNCG [35], where we create characteristic holes using the double reprojection technique.
We trained the network using the ADAM solver [15]. We pre-train for 125K steps on SUNCG, and then train 17K steps on KeystoneDepth data. In both cases, we set β 1 = 0.9, β 2 = 0.999 for ADAM solver, and use a batch size if 4. The learning rate is set to 2 × 10 −3 during pre-training and 2×10 −4 when training on KeystoneDepth. During training, all images have a spatial resolution of 512 × 512. However, because our network is fully convolutional, it can be applied to images of arbitrary resolution. Training required about two days with a Nvidia Tesla 1080Ti GPU.
We use weights λ hole = 6, λ tv = 0.1, and for the double reprojection technique, we discard a triangle if two of its vertices have a relative depth difference > 0.1.

Evaluation
We performed a number of qualitative and quantitative evaluations of our KeystoneDepth dataset and novel view synthesis technique. Throughout our experiments, we set r w = r h = 96b dmax × Dataset: Figure 10 shows a few of the more than 10,000 stereo images in the KeystoneDepth dataset. Please see the supplementary material which includes video versions of these and hundreds of additional results.
To evaluate the quality of our results, we manually categorized 711 randomly sampled entries from our dataset and assigned a label to each: "very few artifacts", "some artifacts", and "failure." We found 23% to have very few artifacts, 49% show some artifacts, and the remaining 28% are failures. Extrapolating these statistics to the entire collection implies there are several thousand high quality re-sults. Figure 5 shows representative failure cases due to poor rectification and poor depth estimation. The supplementary material also includes additional examples in each of these quality categories.
Among the failure cases, we observe that about 5% are caused by incorrect rectification or because the stereo cards have the eyes swapped. Improving the processing to achieve even higher quality results over a larger part of the Keystone-Mast collection is an interesting direction for future work and one we believe will become possible by making this dataset available to the research community. Inpainting network: We also evaluated how the unique components of our neural network for inpainting contribute to its overall performance. Figures 6 and 7 show the impact of including the boundary mask as an additional input and using double reprojection technique for training, which guide the network to produce sharper and more continuous depth boundaries.
We also evaluated the benefit of using data from the KeystoneDepth dataset to train our inpainting networks. As illustrated in Figure 8, depth edges become noticeably sharper and interior details in the intensity images are better preserved when our training includes the KeystoneDepth data as opposed to stopping after the pre-training phase that uses only synthetic SUNCG data. We attribute this to the fact that the KeystoneDepth data is naturally more representative of this particular task and so it does a better job of guiding the learning process.  View extrapolation: We compared our method to Stereo Magnification [37], which learns a multi-plane image (MPI) representation from a stereo pair that allows synthesizing novel views. We believe this method is the most similar to our approach as other techniques either require more than two input views [10,25] or are not compatible with realtime applications on low-end devices [14]. Figure 9 shows a comparison to Stereo Magnification using their publicly released code. Note that unlike our technique, theirs was not trained using KeystoneDepth data as it requires videos of panning motion. We found that the most noticeable artifact produced by Stereo Magnification for this application is the so called "stack of cards" effect [37], due to it struggling to locate foreground and background elements onto separate planes. Our approach, on the other hand, is able to support a larger viewing volume due to it maintaining an explicit model of the scene geometry and inpainting underlying holes in the background. We also observed depth quantization artifacts in the MPI representation, most noticeably near slanted surfaces that straddle multiple layers in the stacked representation. Overall, we believe our approach provides better visual performance for this particular dataset and application. Our supplemental materials includes additional comparisons.
We also performed a blind user study to compare our approach to Stereo Magnification [37]. This study presented 20 randomly selected stereograph scenes to test subjects (N=29), where for each technique we showed a short 7 second virtual camera path exhibiting parallax. We asked the participants to rate both algorithms for each test stereograph on a 1 to 7 Likert scale where 7 corresponds to "A is much better than B", 6 to "better", 5 to "a bit better", 4 to "equally good", etc. We found that 62.3% of the subjects preferred our approach, 27.8% preferred Stereo Magnification, and the balance had no preference.

KeystoneAR Mobile App
Finally, we developed an Augmented Reality (AR) mobile application that simulates the experience of looking through a window into a historical scene captured in these antique stereographs. It works by detecting the plane of a wall facing the user and then places a simulated window on the wall and uses our view synthesis technique to simulate a 3D historical scene behind the window. The user can move around and peer into the scene through the window, as shown in Figure 1d. Please see the demonstration video in the supplementary materials.

Conclusion and Future Work
This paper introduces one of the world's largest and most diverse collections of rectified stereo images and depthmaps, KeystoneDepth, which captures historical people, events, objects and scenes between 1860 and 1963. We believe this dataset will inspire and support future research into bringing these lost moments to life. We also described a novel novel lightweight 3D scene representation and inpainting technique for intensity and depth images that allows re-rendering novel viewpoints within a viewing volume centered around these input stereo images. Our inpainting technique uses a neural network that is trained using samples extracted from the KeystoneDepth data, using a new double reprojection method. We also incorporate a depth boundary guidance input image to the network that helps reproduce sharp and consistent depth edges. Finally, we integrated all of these components into a mobile AR application that gives the sensation of looking through an open window into these historical scenes.
There are many avenues for future work. While we produce good results for thousands of scenes, others fail due to failures in calibration, rectification, or disparity estimation. Our inpainting network is far from perfect and our scene representation does not guarantee hole-free interpolations, particularly in scenes with complex occlusions. Other interesting directions include improving image quality, hallucinating motion (or sound) in these scenes, and expanding the effective camera field of view.