1. A method, comprising: for each of a plurality of pixels in an image, detecting a pixel direction and a pixel weight; generating at least one one-dimensional (1D) histogram and at least one two-dimensional (2D) histogram based on the detected pixel directions and weights; generating a global 2D histogram based on the generated 1D and 2D histograms; and generating a final depth map based on the global 2D histogram.