| 2947 | } |
| 2948 | |
| 2949 | bool Tracking::TrackLocalMap() |
| 2950 | { |
| 2951 | |
| 2952 | // We have an estimation of the camera pose and some map points tracked in the frame. |
| 2953 | // We retrieve the local map and try to find matches to points in the local map. |
| 2954 | mTrackedFr++; |
| 2955 | |
| 2956 | UpdateLocalMap(); |
| 2957 | SearchLocalPoints(); |
| 2958 | |
| 2959 | // TOO check outliers before PO |
| 2960 | int aux1 = 0, aux2=0; |
| 2961 | for(int i=0; i<mCurrentFrame.N; i++) |
| 2962 | if( mCurrentFrame.mvpMapPoints[i]) |
| 2963 | { |
| 2964 | aux1++; |
| 2965 | if(mCurrentFrame.mvbOutlier[i]) |
| 2966 | aux2++; |
| 2967 | } |
| 2968 | |
| 2969 | int inliers; |
| 2970 | if (!mpAtlas->isImuInitialized()) |
| 2971 | Optimizer::PoseOptimization(&mCurrentFrame); |
| 2972 | else |
| 2973 | { |
| 2974 | if(mCurrentFrame.mnId<=mnLastRelocFrameId+mnFramesToResetIMU) |
| 2975 | { |
| 2976 | Verbose::PrintMess("TLM: PoseOptimization ", Verbose::VERBOSITY_DEBUG); |
| 2977 | Optimizer::PoseOptimization(&mCurrentFrame); |
| 2978 | } |
| 2979 | else |
| 2980 | { |
| 2981 | // if(!mbMapUpdated && mState == OK) // && (mnMatchesInliers>30)) |
| 2982 | if(!mbMapUpdated) // && (mnMatchesInliers>30)) |
| 2983 | { |
| 2984 | Verbose::PrintMess("TLM: PoseInertialOptimizationLastFrame ", Verbose::VERBOSITY_DEBUG); |
| 2985 | inliers = Optimizer::PoseInertialOptimizationLastFrame(&mCurrentFrame); // , !mpLastKeyFrame->GetMap()->GetIniertialBA1()); |
| 2986 | } |
| 2987 | else |
| 2988 | { |
| 2989 | Verbose::PrintMess("TLM: PoseInertialOptimizationLastKeyFrame ", Verbose::VERBOSITY_DEBUG); |
| 2990 | inliers = Optimizer::PoseInertialOptimizationLastKeyFrame(&mCurrentFrame); // , !mpLastKeyFrame->GetMap()->GetIniertialBA1()); |
| 2991 | } |
| 2992 | } |
| 2993 | } |
| 2994 | |
| 2995 | aux1 = 0, aux2 = 0; |
| 2996 | for(int i=0; i<mCurrentFrame.N; i++) |
| 2997 | if( mCurrentFrame.mvpMapPoints[i]) |
| 2998 | { |
| 2999 | aux1++; |
| 3000 | if(mCurrentFrame.mvbOutlier[i]) |
| 3001 | aux2++; |
| 3002 | } |
| 3003 | |
| 3004 | mnMatchesInliers = 0; |
| 3005 | |
| 3006 | // Update MapPoints Statistics |
nothing calls this directly
no test coverage detected