raulmur / ORB_SLAM2

Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilities
Other
9.32k stars 4.69k forks source link

Fundamental Matrix computation incorrect? #328

Open an-kumar opened 7 years ago

an-kumar commented 7 years ago

The computation of the fundamental matrix from two key frames (signature: cv::Mat LocalMapping::ComputeF12(KeyFrame &pKF1, KeyFrame &pKF2)) seems to be incorrect, when comparing to e.g Hartley and Zisserman's Multiple View Geometry. The equation is altogether different; in particular, in ORB_SLAM's computation, the skew symmetric matrix is computed from a vector which is entirely a function of the rotations and translations, whereas in Hartley and Zisserman's method, the skew symmetric matrix is computed from a vector which is also a function of the calibration matrix K.

(For reference, Hartley and Zisserman's method: Cameras not at infinity P = K [I | 0], P' = K' [R | t], F = K'^(-T) R K^(T) [KR^(T)t]×, where × indicates skew symmetric matrix).

Am I missing something?

AlejandroSilvestri commented 7 years ago

@an-kumar , Two comments:

Points are undistorted in Frame::UndistortKeyPoints(), by using opencv's cv::undistortPoints, passing K as argument, so undistorted points are normalized with focal length 1 and central point 0,0 . From this point K=Identity . This is why you don't find it in ComputeF12.

I wonder if they should name it Essential matrix instead of Fundamental matrix, and so ComputeE12.