1. A method for image processing, comprising: receiving a depth image of a scene containing an object; receiving a color image of the scene containing the object; evaluating respective quality measures of the depth image and the color image; responsively to the quality measures, identifying in the depth image a range of depths in which the object is located and filtering the color image using depth coordinates from the depth image to eliminate pixels from the color image for which the depth coordinates are outside the range; and processing the filtered color image in order to localize the object.