A method for measuring a distance between an object of a scene (24, 40) and a Time-Of-Flight camera system, and providing a depth map of the object, the Time-Of-Flight camera system comprising an illumination unit, patterning means, an imaging sensor having a matrix of pixels (22, 23) and image processing means, the method comprising the following steps - illuminating the scene with said illumination unit without the use of the patterning means; - receiving onto the pixels of the matrix of the sensor the beams reflected by the scene comprising both direct and indirect components providing the image processing means with corresponding data and generating a first intermediary depth map; the method being characterized by the following steps: - modifying in a discrete way the illumination of said illumination unit with patterning means in order to illuminate elementary areas (31, 32) of the scene with different incident intensities, respectively, for distinguishing the direct incident light beams from the indirect incident light beams (26, 28); - receiving onto the pixels of the matrix of the sensor the beams reflected by said elementary areas (31, 32) and providing the image processing means with corresponding data and generating a second intermediary depth map; - processing the said corresponding data for eliminating the influence of the indirect light beams in the depth map of the object by identifying, on an intermediary depth map, the elementary areas on which no direct incident light beam can impinge by noticing the apparition of peaks in the second depth map not present in the first depth map, and by subtracting the complex data obtained in some of the pixels of the matrix by the time of flight measurement of light dominated by the indirect components from the complex data obtained in the other pixels of the matrix by both direct and indirect components to form a new complex data. - illuminating the scene with said illumination unit without the use of the patterning means; - receiving onto the pixels of the matrix of the sensor the beams reflected by the scene comprising both direct and indirect components providing the image processing means with corresponding data and generating a first intermediary depth map; - modifying in a discrete way the illumination of said illumination unit with patterning means in order to illuminate elementary areas (31, 32) of the scene with different incident intensities, respectively, for distinguishing the direct incident light beams from the indirect incident light beams (26, 28); - receiving onto the pixels of the matrix of the sensor the beams reflected by said elementary areas (31, 32) and providing the image processing means with corresponding data and generating a second intermediary depth map; - processing the said corresponding data for eliminating the influence of the indirect light beams in the depth map of the object by identifying, on an intermediary depth map, the elementary areas on which no direct incident light beam can impinge by noticing the apparition of peaks in the second depth map not present in the first depth map, and by subtracting the complex data obtained in some of the pixels of the matrix by the time of flight measurement of light dominated by the indirect components from the complex data obtained in the other pixels of the matrix by both direct and indirect components to form a new complex data.