#### What Do I Need?

*   Any Dedicated or Virtual Server
*   Ubuntu
*   OpenCV
*   Python

### What are Depth Maps?

Simply, a depth map is a picture where every pixel has depth information, rather than RGB, and it is normally represented as a grayscale picture. Depth information means the distance of the surface of scene objects from a viewpoint. A depth map contains information about the distance between the surface of objects from a given viewpoint. When this is merged with the source image, a 3D image is created. It will appear as though the original source image has depth to it, giving it an almost lenticular effect. It’s particularly useful if you can use synchronized stereo images. Stereo images are two images with a slight offset. For example, take a picture of an object from the center axis. Move your camera to your right on the straight horizontal plane approximately 6cm while maintaining the object’s location in your center field of view. Look for the same thing in both pictures and infer depth from the difference in position. This is called stereo matching. To achieve the best results in depth map generation be as precise as possible and avoid distortions.

Depth maps have a massive number of uses. Like simulating the effect of uniformly dense semi-transparent media within a scene, i.e. fog, smoke or volumes of water or other liquids. Or simulating shallow depths of field, where parts of a scene appear to be out of focus. Depth maps can be used to selectively blur an image to varying levels or degrees. A shallow depth of field can be a characteristic of macro photography and as such the technique may form a part of the process of miniature faking. Includes a technique called z-buffering and z-culling, which can be used to make the rendering of 3D scenes more efficient. They can be used to identify objects hidden from view and which may therefore be ignored for some rendering purposes. This is also particularly important in real time applications such as computer games, where a fast succession of completed renders must be available in time to be displayed at a regular or fixed rate.

How to Create Depth Maps from 2D Photos using OpenCV
4.15 GEEK