Orb-slam (vi) MapPoint and map

Source: Internet
Author: User

Map points can be constructed from keyframes or through normal frames, but ultimately, the map points constructed from normal frames are only temporarily used for tracking by tracking, which correspond to keyframes.

Constructors (map point 3D coordinates and their reference frames):

// A reference frame is a keyframe that corresponds to a number of frame keyframes, establishing a common view between keyframes Mappoint::mappoint (const Cv::mat &pos, Keyframe *prefkf, map* pMap)//  reference frame is a normal frame, The map point corresponds only to the feature point of the current normal frame mappoint::mappoint (constconstint &idxf)

The observation relationship between a map point and a keyframe is most important, referring to which frame the keyframe is, and which keyframes the map point is observed by, and which of the corresponding (IDX) feature points? maintained by two members:

Std::map<keyframe*,size_t> mobservations; // number of cameras observed at this map point int

Add Map Point observations: A common-view relationship exists between keyframes that can observe the same map point

void Mappoint::addobservation (keyframe* PKF, size_t idx);

Delete Map Point observations: Removes the corresponding keyframe observation relationship from the mobservation and Nobs members of the current map point, which needs to be re-specified if the keyframe happens to be a reference frame. when the number of observed cameras is less than or equal to 2 o'clock, the map point needs to be removed. Delete the observation relationship, and delete the map point (and replace the map point), you need to distinguish the open!

void Mappoint::eraseobservation (keyframe* PKF);

Culling MapPoint not only needs to delete the observed relationships of the key frames maintained in the map points, but also to delete the corresponding map points in the corresponding key, as well as the memory of the map points in the maps:

void Keyframe::erasemappointmatch (const size_t &idx) {    unique_locklock( Mmutexfeatures);    MVPMAPPOINTS[IDX]=static_cast<mappoint*>(NULL);} Mpmap->erasemappoint (this);

The following is an important function:

void Mappoint::replace (mappoint* PMP);

Replace the current map point (this) with a PMP. Primarily used in closed loops, adjust map points and keyframes to create a new relationship:

KeyFrames Replace the This contact with Pmap:

Pkf->replacemappointmatch (Mit->second, PMP); // keyframe the Mit->second index corresponding to the map point, with the PMP replace the originalthis pmp->addobservation (Pkf,mit->second); // PMP Map points Add observing keyframes
Delete the map point in map
Mpmap->erasemappoint (this);

Whether Setbadflag () or replace (), the MBBAD flag for the current map point is recorded as true, indicating that the current map point is a bad point.

The difference between visible and found: The map point is within the field of view, and the map point has the number of frames corresponding to the feature point. Generally speaking, the map point of found must be visible, but the visible map point is probably not found

float Mappoint::getfoundratio () {    unique_locklock(mmutexfeatures);     return static_cast<float> (mnfound)/mnvisible;}

Getfoundratio low indicates that the map point is within the field of view of many keyframes, but there are no matches on many feature points.

Finally, there are several more important functions in MapPoint:

void mappoint::computedistinctivedescriptors (); void mappoint::updatenormalanddepth (); int MapPoint::P redictscale (constfloat &currentdist, keyframe* PKF);

1. Calculate Map Point descriptors:

The key frames and corresponding descriptors of the current map point are obtained from the mobservations, and the descriptors are placed in a vector consisting of the vdescriptor description sub-vectors. In these descriptors, choose distance (similar to Hamming distance) other descriptors nearest (median distance, see code to understand what it means) as the map point description sub-mdescriptor.

2. Calculate the average observation direction and depth of the map points

The map points to all of the observed Keyframe camera center vectors, normalized and added.

Depth range: Map point to Reference frame (only one frame) camera center distance, multiply the reference frame to describe sub-acquisition pyramid magnification scale, get the maximum distance mfmaxdistance The maximum distance divided by the magnification scale of the highest layer of the pyramid gets the minimum distance mfmindistance. Generally speaking, the closer map points will be extracted at a higher level of the pyramid, farther away from the map point, in the lower pyramid layer of the place (the lower the pyramid layer, the higher the resolution, to identify the far point). So through the information of the map point (mainly the corresponding descriptors), we can get the pyramid level corresponding to the map point:

Const int level = prefkf->mvkeysun[observations[prefkf]].octave;

This allows you to predict what distance the map point can be observed!

3. int MapPoint::P redictscale (const float &currentdist, keyframe* PKF)

Note the relationship between Pyramid Scalefactor and distance: The current feature point corresponding to the Scalefactor 1.2 means: The image resolution is reduced 1.2 times times, you can extract the feature point (when the resolution is higher, it can certainly be extracted, where the pyramid can be extracted from the highest level of the feature point as the level of the feature point)

At the same time, the distance from the current feature point can be inferred from the level.

Map is relatively simple, mainly responsible for maintaining the key frame and map point container, set the reference map point for plotting:

STD::set<MapPoint*> mspmappoints;std::set<KeyFrame*> mspkeyframes;

Orb-slam (vi) MapPoint and map

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.