Map Manager
SLAM.MapManager
— TypeMapManager(params::Params, frame::Frame, extractor::Extractor)
Map Manager is responsible for managing Keyframes in the map as well as Mappoints.
Arguments
current_frame::Frame
: Current frame that is shared throughout all the components in the system.frames_map::Dict{Int64, Frame}
: Map of the Keyframes (its id → Keyframe).params::Params
: Parameters of the system.extractor::Extractor
: Extractor for finding keypoints in the frames.map_points::Dict{Int64, MapPoint}
: Map of all the map_points (its id → MapPoints).current_mappoint_id::Int64
: Id of the current Mappoint to be created. It is incremented each time a new Mappoint is added tomap_points
.current_keyframe_id::Int64
: Id of the current Keyframe to be created. It is incremented each time a new Keyframe is added toframes_map
.nb_keyframes::Int64
: Total number of keyframes.nb_mappoints::Int64
: Total number of mappoints.
SLAM.update_frame_covisibility!
— Functionupdate_frame_covisibility!(map_manager::MapManager, frame::Frame)
Update covisibility graph for the frame
. This is done by going through all of the keypoints in the frame
. Getting their corresponding mappoints. And joining sets of observers for those mappoints.
SLAM.merge_mappoints
— Functionmerge_mappoints(m::MapManager, prev_id, new_id)
Merge prev_id
Mappoint into new_id
Mappoint. For "previous" observers, update mappoint and keypoint to the new.
SLAM.optical_flow_matching!
— Functionoptical_flow_matching!(map_manager, frame, from_pyramid, to_pyramid, stereo)
Match keypoints in frame
from from_pyramid
to to_pyramid
. This function is used when matching keypoints temporally from previous frame to current frame, or when matching keypoints between stereo image.
If there are 3D keypoints in the frame
, then try to match respectful keypoints using displacement guess from motion model (when matching temporally) or calibration pose (in stereo).
Arguments
map_manager::MapManager
: Map manager, used for retrieving parameters info, 3D mappoints, removing mappoints.frame
: Frame for which to do matching.from_pyramid::LKPyramid
: Pyramid from which to track.to_pyramid::LKPyramid
: Pyramid to which to track.stereo::Bool
: Set totrue
if doing stereo matching. It will retrieve data using mutex and updatestereo
keypoints instead of regular keypoints. Otherwise set tofalse
.
SLAM.maybe_stereo_update!
— Functionmaybe_stereo_update!(
frame::Frame, kpid, new_position::Point2f; epipolar_error::Float64 = 2.0,
)
Update stereo keypoint if the vertical distance between matched keypoints is less than epipolar_error
. In this case, set y-coordinate equal to the left keypoint. Otherwise do nothing.
Returns
true
if successfully updated, otherwise false
.
SLAM.reset!
— Methodreset!(m::MapManager)
Reset map manager.