1. A computer-implemented method for processing data, comprising: receiving a depth map of a scene containing a body of a humanoid subject, the depth map comprising a matrix of pixels, each pixel 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; segmenting the depth map so as to find a contour of the body; processing the contour in order to identify a torso and one or more limbs of the subject by: identifying an axis of the body in the depth map; computing a transverse thickness of the contour along multiple first lines perpendicular to the axis; computing a longitudinal thickness of the contour along multiple second lines parallel to the axis; designating as the torso a part of the area within the contour that is defined by the first and second lines along which the transverse thickness and longitudinal thickness are no less than a specified transverse threshold and longitudinal threshold, respectively; and identifying a second part of the area that is connected to the torso as at least one of the limbs; and generating an input 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.