Now start learning the next closed loop detection thread.
The localmapping thread sends the keyframe to the Mlploopkeyframequeue queue, we check to see if the queue is empty, and if the first keyframe comes in, the loopback detection begins. The keyframes in the loopclosing are sent in localmapping: One frame is sent over, and one frame is checked.
Funtion1:detectloop ()
Take a keyframe out of the queue as the current keyframe and set it to the non-erased feature, then determine if the last closed-loop detection is more than 10 frames, and if so, add the current keyframe to Mpkeyframedb and erase the current key frame.
Traverse all common-view keyframes, calculate the current keyframe's bow similarity score with each common-view key, and get a minimum score of Minscore, which is a threshold that, if the score is lower than the minimum score, is definitely not a closed-loop keyframe.
Funtion1. 1:p keyframedb->detectloopcandidates (MPCURRENTKF, Minscore)
Find closed-loop alternate frames in all keyframes (pkeyframedb).
* 1. Find all keyframes that have common words with the current frame (excluding keyframes connected to the current frame), and count the number of words in all closed-loop candidate frames that share the most common word with PKF, with a threshold of 0.8 times times the maximum number of words.
* 2. A key frame with a similarity greater than minscore is selected only with a key frame that has a threshold value of 0.8 times times the maximum number of words .
* 3. It is not enough to calculate the similarity between the current frame and a keyframe alone, where the first 10 keyframes connected to the Keyframe (the highest and most common) are grouped, the cumulative score is calculated, the highest group score is selected, and then 0.75 times times as the threshold, the group with the score greater than the threshold value, as Groups with higher scores .
* 4. Only the keyframes that accumulate the highest scores in those groups with higher scores are returned.
OK, so we get a closed-loop candidate Keyframe Group.
If the candidate Keyframe group is not reached after the detection is complete, add this frame to the Keyframe database and return FALSE.
Next, check the continuity of the keyframes. The goal of the calculation group score is to exclude a higher score for a single frame, but not a common view keyframe, which is not robust enough as a closed loop. For key frames that pass the closed-loop detection, it is also necessary to pass continuity detection (through the above filtering for three consecutive frames) to be a closed-loop candidate frame.
The final goal to achieve is to link the closed-loop keyframes detected by a successive 3 frames as shown.
Implementation on the program: first comes in a set of candidate keyframes, each of which forms a "child candidate group" for itself and the keyframes that are attached to it. Each sub-candidate group in the sub-continuous group is numbered 0 when the system has just begun, or if there is no continuous detection. After the candidate keyframe groups of the keyframes come, the candidate keyframes in each group form their own "child candidate group", which is compared with the "child candidate group" in the previous "sub-continuous group". If connected, the connected "sub-candidate frame group" and the sequence number are pressed into the current continuous group, which is the ordinal of the previous group "sub-continuous group" +1. If Ncurrentconsistency is greater than or equal to 3, then the "child candidate group" represents the candidate frame to cross the border and into the mvpenoughconsistentcandidates. Finally, the loop ends and the current continuous group is sent to the system continuous group for the next detection. and presses the current frame into the key frame database.
Funtion1. 2: ComputeSim3 ()
Orb_slam Code Parsing (4) localclosing thread