Given 2 image taken from 2 camera in canonical position, and the baseline is b, we can find the distance Z of an object from the camera. We know that Z=bf/D where D is disparity. I read some books but still have no idea of how to find the disparity using c#. Can someone suggest some mathematics and algorithm for me? I also read about finding the correspondence point of the image but i have no idea of how the corresponding point related to disparity. And what is the unit of disparity we found using algorithm.Is it in unit of pixel and can we plug directly into above equation to find Z in unit of mm or cm? Or how can we convert focal length into pixel? I also read about the essential matrix and fundamental matrix, do i really need to find them? because if i can find disparity without using these matrix, then i already can find the distance using formula above. This matrices is very difficult to solve. My supervisor require me to write the entire algorithm by myself without using any library such as opencv. So someone please give me the mathematics behind the algorithm.