1. A method for generating a confidence map, the method being implemented in a disparity estimation stage comprising a hardware processor configured to: retrieve a first stereo image and a second stereo image, each having a plurality of pixels; generate a disparity map from the first stereo image and the second stereo image, the disparity map having a plurality of disparity values; determine a first confidence value for each disparity value based on a match quality between a pixel or a group of pixels in the first stereo image and a corresponding pixel or a corresponding group of pixels in the second stereo image; determine a second confidence value for each disparity value based on a consistency of disparity estimates of the pixel or the group of pixels in the first stereo image and the corresponding pixel or the corresponding group of pixels in the second stereo image; wherein the second confidence value assumes one of at least four discrete values of confidence, the discrete values of confidence being RELIABLE, UNRELIABLE, OCCLUDED and UNDECIDED; determine a combined confidence value for each disparity value from the first confidence value and the second confidence value; and store the combined confidence value for each disparity value in a confidence map.