Problems with stereo vision using two M5Stack Timer cameras (Fisheye lens)
-
Hi community,
I am trying to work out the stereo vision principle with two timer cameras type fisheye lens. My problem is that I can't find the focal length of the lens in the specs. I tried to calculate the focal length with the Diagonal Field Of View(DFOV), but I don't know if it's correct. Because I didn't got a distance near the correct value in combination with the depthmap and disparity.
My calculation for the focal length is based on the following formula from http://www.bobatkins.com/photography/technical/field_of_view.html
FOV (equisolid fisheye) = 4 * arcsin (frame size/(focal length * 4))
For the frame size I calculated the diagonal frame size, because I only know the DFOV. I get the sizes of the image area from this specsheet:
https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/unit/OV3660_CSP3_DS_1.3_sida.pdfWith Pythagoras and the image area sizes I have found a value of 3.6299 mm for the diagonal frame size. By rewriting the formula I have gotten the following result. DFOV = 120 degrees.
focal length = (diagonal frame size/(sin(DFOV/4)))/4
focal length = (3.6299/(sin(120/4)))/4 = 1.815 mmIs this the correct way to calculate the value or do you know the right value?
For the stereo vision part I have worked with the stereocalibrate() and stereorectify() functions from OpenCV in Python. This to get a correct disparity map. Maybe there is something wrong in that code, but I think that the focal length is wrong at the moment. So please help me out and thanks in advance.
Michael
PS:
I have the python code with the depth calculation shown in the following image. The distance need to be around the 1.2 meters for the specific pixel. Calculations are at the moment in mm.