To help us build an interactive demo of a depth camera, we will reuse much of the Cameo project that we developed in Chapter 2, Handling Files, Cameras, and GUIs, and Chapter 3, Processing Images with OpenCV. As you will recall, we designed Cameo to support various kinds of input, so we can easily adapt it to support depth cameras in particular. We will add code that analyzes the depth layers in an image in order to find the main region, such as the face of a person sitting in front of the camera. Having found this region, we will paint everything else black. This type of effect is sometimes used in chat applications to hide the background so that users have more privacy.
Some of the code to manipulate depth-camera data will be reusable outside Cameo.py, so we should separate it into a new module. Let's create a depth.py file in the same directory as Cameo...