1. A method for detecting an object in an image that contains invalid data regions, the method comprising the steps of: determining a data mask for the image to indicate which pixels in the image are valid; representing the data mask as an integral mask in which each pixel has a value corresponding to a total number of valid pixels in the image above and to left of the pixel; applying a rectangular feature to the image, the rectangular feature having at least one positive region and one negative region; determining the number of pixels in the rectangular feature that are valid using the integral mask; approximating a mean intensity value for a region that contains invalid pixels; determining a feature value for the rectangular feature by computing a weighted difference between a sum of intensity values in the positive and negative regions of the rectangular feature; and using the feature value to determine if an object has been detected.