
Anaglyph 3D
iOS Universel / Education
Anaglyph 3D creates anaglyphs for photos, Live Photos and videos by generating stereo image pairs from depth prediction.
Two photos taken with a slight horizontal offset—mimicking human vision—form a stereo image pair. When viewed with special glasses, Virtual Reality headsets, or free-viewing techniques like cross-eye or parallel viewing, this offset allows the brain to perceive depth, creating a 3D effect.
An anaglyph combines the left and right images of a stereo pair into a single image, creating a 3D effect when viewed with red-cyan glasses. Specifically, the left image is represented in shades of red, while the right image appears in shades of cyan. The color-matching lenses ensure that each eye receives the correct image, enabling depth perception.
Traditionally, a stereo pair is captured with a dual lens or double shot camera, as in our app Cameranaglyph. This app offers an alternative approach, using a single image to generate a stereo pair from depth prediction and machine learning.
Each of your eyes sees a slightly different view because they are spaced apart horizontally. This causes objects to appear slightly shifted between the left and right views. The amount of horizontal shift between common objects in both views is called disparity. Closer objects have a larger disparity than those farther away. You can observe this effect by looking at an object with one eye closed, then switching to the other eye. The closer the object, the more it appears to shift between views. Your brain uses this difference to perceive depth and distance.
Machine learning is a process where computers analyze data to make predictions without being explicitly programmed for each task. It employs a model to detect and analyze patterns within the data. Training involves optimizing the model by iteratively adjusting its parameters using labeled data to minimize prediction errors and improve performance.
One application of machine learning is depth prediction in images, where the model estimates how far objects are from the camera. By training on millions of images, the model learns to recognize visual patterns that indicate depth.
A depth map is an image that represents object distances by encoding them as grayscale pixel values. Using machine learning, it’s possible to predict depth from a single photo or video frame, creating a depth map. The depth map is used to create a disparity filter to generate a right and left image stereo pair by shifting pixels in the original image. The stereo pair can then be used to create an anaglyph.
The Disparity Intensity parameter adjusts the pixel shift between the left and right stereo images generated from depth prediction. Increasing the value exaggerates depth differences, enhancing the 3D effect, while decreasing it reduces the disparity for a more subtle stereo effect — similar to adjusting contrast in an image.
Select a photo or video using the browser or from the sample media in the app menu. For a conventional video stereo pairs are generated from depth prediction on the single image extracted from a video frame. Each stereo pair is then used to generate three types of video output—Anaglyph, Side by Side and Spatial—as follows:
Anaglyph: Each output video frame is an anaglyph created using a stereo image pair generated from depth prediction on the input video frame, for 3D glasses.
Side by Side: Each output video frame is a juxtaposition of the images using a stereo image pair generated from depth prediction on the input video frame. The placement of images is intended for parallel viewing. To see the 3D effect, the viewer must train their eyes to focus as if looking at a distant object, allowing each eye to align with the corresponding image.
Spatial: Each output video frame consists of a stereo image pair generated from depth prediction on the input video frame to create a spatial video. A spatial video is a stereoscopic 3D video format introduced for the Apple Vision Pro.
Quoi de neuf dans la dernière version ?
Added support for pasting/copying images from/to the clipboard. Use the new item named 'Paste Image' in the app menu (located in the top right corner of the main view). It's a convenience for loading images to create their anaglyphs.