A computer-implemented method includes receiving a depth map (30) of a scene containing a body of a humanoid subject (28). The depth map includes a matrix of pixels (32), each corresponding to a respective location in the scene and having a respective pixel value indicative of a distance from a reference location to the respective location. The depth map is segmented so as to find a contour (64) of the body. The contour is processed in order to identify a torso (70) and one or more limbs (76, 78, 80, 82) of the subject. An input is generated to control an application program running on a computer by analyzing a disposition of at least one of the identified limbs in the depth map.