Depth map creator
The program is intended for creating depth map basing on stereopair.
Depth map shows us what areas are closer to us, and what are more distant. The
white area is located at the foreground, the black one is at the background.
Source image and created depth map is used to generate several stereo views.
This views is used for lenticular images preparing. For generating several
stereo views may be used the program Bas-relief or Photoshop plug-in
Thereby we may create several stereo view basing on stereopair.
Program uses standard method based finding similar fragments of left and
right images. Depth map correspond to shifting similar fragments (disparity).
Depth map quality depend on content of source images. To preview depth map
make the calculation with low quality and high speed
Sometimes stereo views generated by Bas-relief or Photoshop
will be very good. Sometimes you can't make a satisfying result. In this
case you need another software.
Formats of input files are BMP, PNG, TIFF, JPEG in RGB colour
mode. Formats of output files are BMP, PNG, TIFF in RGB colour
mode. Don't support compressed and multilayered TIFF.
Fig. 1. Program interface
We load two images: one is a left image (left image), another is
right image (Right image). If you mix up left and right, you make
inverted depth map: the white area will be located at the background. Both
images must be in RGB colour mode. The program reads the files in
BMP, PNG, TIFF, JPEG format, and writes in BMP, PNG, TIFF.
- Analyzed fragment size, px determines fragment size (of a square
fragment) that will be compared. Set the fragment size near or equal to the size
of picture's distinct details.
Fig. 2. Analyzed fragment size
The accuracy of depth map creation depends on the analyzing fragment's size.
It hasn't to be too large nor too small.
|Analyzed fragment size = 2
||Analyzed fragment size = 4
fragment size = 6|
Fig. 3. Depth map with different
analyzed fragment size
- Maximum horizontal parallax, px - before the software starts, one
needs to determine maximum vertical and horizontal parallax, and thus set the
field of search:
Fig. 4. Maximum horizontal
- Maximum vertical parallax, px - vertical parallax for the most stereo
pairs is equal to 0 or very small.
Fig. 5. Maximum vertical parallax
- Options Source image analysing and Gradient image analysing
determine what images will be analysed, the source ones or their gradients, or
outlines. If the left and right images differ by colour or lighting, it will be
better to analyse only outline or gradient images:
|source stereo pair
Fig. 6. Source and gradient images
- Quality - Speed sets how much the analysed image will be decreased
to improve the speed of depth map creating. You need a high-speed and
low-quality depth map to make a preview image that allows to estimate the
quality of processing. Calculations of a high-quality image will take much time,
depending on the CPU speed. For example, a 1000x1000 pixels image calculation
may take up to 40 minutes.
- When the Preview anaglyph image option is set, the newly created
depth map will be displayed using a system graphics viewer, if such is
installed, e.g. ACDSee.
When the user clicks the Create left depth map button, the left image
depth map is created. Create right depth map creates the same map for the
right image. Created files will have the same name as originals, and the
Fig. 7. Smoothing dialogue
This dialogue is intended for smoothing of the depth map. A custom algorithm
is used here, that doesn't blur the image's outline. In the beginning one needs
to create an outline image, setting necessary outline level (Outline image
level). Lower values of the outline level mean that lighter outlines
will be emphasized:
|outline level = 50
Fig. 8. Outline images
Buttons Smooth left depth map and Smooth right depth map smooth
the depth maps for left and right images. Before you need to set the Smoothing degree. Newly created files have a suffix
-3dmapNew in their names.
|depth map before smoothing
||depth map after smoothing|
Fig. 9. Smoothing without outline
blurring. Smooth level = 50
- Before creating a depth map, one needs to prepare a stereo pair. Images must
not be too small. Smaller images loose distinct details and outlines; they
don't suite for a good depth map. They have a small parallax, also, and this value
determines number of planes that are on different distance one from another.
If the entire parallax of your stereo pair is equal to 6 px, it may not contain
more than 6 planes. Lesser stereo pair size means lower quantity of viewable planes.
Depth map uses the greyscale to show the relative distance of points. Only 256
levels of grey can be written in a file, so the source stereo pair can't contain
more than 256 planes. The entire parallax must not be greater than 256 px,
positive and negative parallaxes must not be greater than 128 px. If a stereo
pair's parallax is greater than 256 px, one needs to decrease the stereo pair's
size. It sets a limitation of an upper size of the image, something about
The result depends on the source image quality. Do not save source images in the
JPEG format, or save them as JPEGs with maximum quality. Do not apply texture filters,
nor Sharpen or Blur filters. Apply the necessary filters AFTER depth map creating.
- Before starting, one needs to align the stereo pairs to obtain minimum horizontal
and vertical parallaxes. In most cases the stereo pairs haven't a vertical parallax.
But there may be exceptions. Close-up photos may have a small vertical parallax. You
may also take a shot not correctly, for example, the camera may have a tilt when
taking a second shot. In this case, too, you'll have a vertical parallax, and
the stereo image will be difficult for viewing. Generated stereo view may be
better, in case of a good depth map.
- Now it's necessary to determine the values of maximum height and width shifts.
To do this, one needs to create an anaglyphic image basing on a stereo pair.
Such image allows to easily view areas that have maximum shift. You may, for
example, measure the parallax in pixels using the Photoshop's Measure tool.
- Open left and right images in DepthMapCreator, set the maximum vertical
and horizontal parallaxes and the analysed fragment's size. Check the
Source image analysing or Gradient image analysing boxes. Use
Gradient image analysing option if the images differ by colour or
- Now make a quick test depth map (select lower quality and high speed
using Quality - Speed slider). If the created map is good,
set the high quality (Speed = 1). It may take much time, up to few hours.
- Generated depth map may be smoothed without outline blurring using the
- The software creates the following helper files:
The last two files are our depth maps: 3dmap
is a non-smoothed map, and 3dmapNew is a
smoothed one. The other files may be deleted, but not when the
software is working - they are necessary for calculations.
- Generated depth map may be edited in any graphical editor.
If the target image is black, source files are not in RGB
colour mode (perhaps in Greyscale, Indexed Colour, CMYK).
Source files must be always in RGB colour mode.
Copyright © 2002 - 2004.
. All rights reserved.