There is no single formula for depth estimation, as various algorithms and approaches have been proposed to tackle this problem. In the case of stereo depth estimation, the depth can be calculated using the disparity between corresponding points in the images and the baseline distance between the cameras. For monocular depth estimation, machine learning algorithms, particularly deep learning models, are used to learn and predict depth information from a single 2D image. These models are trained on large datasets and can generalize to new images, making them suitable for real-world applications.