Depth map creator

Purpose of the program

Requirements to computer and system

Program usage

Dialogue Smoothing

Work order. Requirements to the source images

Troubleshooting

Purpose of the program

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 and filter.

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 (Quality-Speed slider).

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.

Top

Requirements to computer and system

Windows 98/NT4/2000/XP.

Top

Program usage

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.

Settings

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 suffix -3dmap.

Top

Dialogue Smoothing

Fig. 7. Smoothing dialogue interface

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 outline level = 20

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

Top

Work order. Requirements to the source images

  1. 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 3000x3000 px.

    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.

  2. 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.

  3. 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.

  4. 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 lighting.

  5. 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.

  6. Generated depth map may be smoothed without outline blurring using the Smoothing dialogue.

  7. The software creates the following helper files:
    filename-xd.bmp
    filename-yd.bmp
    filename-gradient.bmp
    filename-outline.bmp
    filename-resize.bmp
    filename-3dmap.bmp
    filename-3dmapNew.bmp

    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.

  8. Generated depth map may be edited in any graphical editor.

Top

Troubleshooting

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.

Top

Back