1. A method for fast cost aggregation for dense stereo matching comprising: receiving first and second images of a scene; rectifying the images; computing a cost volume based on the first and second images; subsampling the cost volume to generate a subsampled cost volume; for each pixel, p, in the subsampled cost volume, determining one or more local extrema in the subsampled cost volume for each neighboring pixel, q, within a window centered on the pixel, p; for each pixel, p, performing cost aggregation using the one or more local extrema; performing cross checking to identify matching pixels to generate a disparity map based on disparities between the matching pixels; responsive to identifying unmatched pixels, performing gap-filling for the unmatched pixels to update the disparity map; and generating and storing a depth map from the disparity map.