I'm trying to implement standard Structure from Motion code but the triangulatePoints is resulting in NaN values. I do the following steps -
- get ORB features for image 1 and image 2.
- Match the features.
- get essential matrix from the matched features and camera intrinsic info available, using findEssentialMat()
- using recoverPose() to get pose of camera 2. Camera 1 is assumed to be at the origin.
- get projection matrices for camera1 and camera2.
- use triangulatePoints() to get 3D points.
I have tried the Matlab triangulate() function as well with the projection matrices for camera1 and camera2 as well as matched points obtained above. In case of Matlab I get good results. But using opencv in C++ (Opencv 3.3) I get NaN values.