1. A method of determining depth in images, comprising: generating an image mask indicating smooth areas and object edges for each of a pair of stereo images; calculating a computation cost for a plurality of pixels within the image mask; and matching pixels between the each of a pair of stereo images and optimizing a value for the matching pixels to obtain an estimated depth map.