We don’t allow questions seeking recommendations for开发者_运维问答 books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionI'm looking for an open source project or library (c++, c) that can give me a method to calculate the distance to a certain object (pixel) in the image, assuming I have all the info about the cameras - The field of view, focal length, distance between cameras, etc..
I'm looking for an open source project or library (c++, c) that can give me a method to calculate the distance to a certain object (pixel) in the image, assuming I have all the info about the cameras - The field of view, focal length, distance between cameras, etc..
Depending on what exactly "etc" is, the solution is somewhere between easy and impossible.
If you have fully calibrated cameras (intrinsic parameters + relative extrinsic parameters) computing the distance is a matter of computing and intersecting two lines of sight. The lines of sight directly follow from all the known parameters and the pixel positions. Intersecting them is a matter of solving a linear least squares problem with 4 equations and 3 unknowns.
If you only have intrinsic camera parameters (Up to five degrees of freedom, usually an upper triangular 3x3 matrix) and the distance between the cameras you need to first reconstruct the remaining 5 degrees of freedom for the relative pose of the two cameras. This can be done by computing the "fundamental matrix" F for a set of point correspondences and dividing it by the known kamera matrices so you get the "essential matrix" E. This matrix can be further factored into a rotation and a cross product matrix. This tells you how the second camera is positioned relative to the first. Combinind this with the known distance between cameras, you'll be able to compute a metric reconstruction of things "you see".
If you don't even know all the intrinsic parameters you can't compute a metric reconstruction but only some kind of "projective reconstruction". But that's not really what you want.
Suggested reading: Multiple View Geometry by Hartley and Zisserman
精彩评论