raulmur / ORB_SLAM2

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

Using monocular camera never escaping mState=NOT_INITIALIZED, issue with Tracking:MonocularInitialization #1031

Open jfenton888 opened 2 years ago

jfenton888 commented 2 years ago

I have spent a few hours back tracking through the code to figure out why the publishers start but nothing ever happens. It seems that the tracking state (mState in Tracking is never getting set to OK), caused by a never ending loop of failing to initialize in Tracking:MonocularInitialization(). This is caused by the condition if(mpInitializer->Initialize(mCurrentFrame, mvIniMatches, Rcw, tcw, mvIniP3D, vbTriangulated)) always returning false and preventing the CreateInitialMapMonocular from running. I do not understand what is happening enough, but the ReconstructH method being called in Initializer is always returning false. matcher.SearchForInitialization(mInitialFrame,mCurrentFrame,mvbPrevMatched,mvIniMatches,100) is always returning 100-500 matches which I would think tells me that a transformation should be possible. Initializer::Initializer always results in trying a homography (with SH~=3000, and SF~=3700 when the camera is static), but then I get something like d1=573829, d2=573267, d3=573165 which apparently they should not be. I am trying to run ORB_SLAM2 through ravburn's wrapper so I can't as easily try the other sample data sets but this doesn't make sense to me why a transformation cannot be found for a stationary camera when it is getting matches

paw8975 commented 2 years ago

Any update to this? I'm having an issue where no activity appears on the /{node name}/debug_image ROS topic and suspect this might be a root issue.