13 #include <orb_slam/ORBmatcher.h>
28 mnCorrectedReference(0),
58 : mnFirstKFid(pRefKF->mnId),
63 mnCorrectedReference(0),
228 map<WAIKeyFrame*, size_t> obs;
236 for (map<WAIKeyFrame*, size_t>::iterator mit = obs.begin(), mend = obs.end(); mit != mend; mit++)
252 if (pMP->
mnId == this->mnId)
255 int nvisible, nfound;
256 map<WAIKeyFrame*, size_t> obs;
268 for (map<WAIKeyFrame*, size_t>::iterator mit = obs.begin(), mend = obs.end(); mit != mend; mit++)
316 vector<cv::Mat> vDescriptors;
318 map<WAIKeyFrame*, size_t> observations;
327 if (observations.empty())
330 vDescriptors.reserve(observations.size());
332 for (map<WAIKeyFrame*, size_t>::iterator mit = observations.begin(), mend = observations.end(); mit != mend; mit++)
336 if (pKF && !pKF->
isBad())
337 vDescriptors.push_back(pKF->
mDescriptors.row((
int)mit->second));
340 if (vDescriptors.empty())
345 size_t N = vDescriptors.size();
347 float** Distances =
new float*[N];
348 for (
size_t i = 0; i < N; ++i)
349 Distances[i] =
new float[N];
351 for (
size_t i = 0; i < N; i++)
354 for (
size_t j = i + 1; j < N; j++)
356 int distij = ORBmatcher::DescriptorDistance(vDescriptors[i], vDescriptors[j]);
357 Distances[i][j] = (float)distij;
358 Distances[j][i] = (float)distij;
362 const size_t N = vDescriptors.size();
364 float Distances[N][N];
365 for (
size_t i = 0; i < N; i++)
368 for (
size_t j = i + 1; j < N; j++)
370 int distij = ORBmatcher::DescriptorDistance(vDescriptors[i], vDescriptors[j]);
371 Distances[i][j] = distij;
372 Distances[j][i] = distij;
377 int BestMedian = INT_MAX;
379 for (
size_t i = 0; i < N; i++)
381 vector<int> vDists(Distances[i], Distances[i] + N);
382 sort(vDists.begin(), vDists.end());
383 int median = vDists[(uint64_t)(0.5 * (N - 1))];
385 if (median < BestMedian)
394 for (
size_t i = 0; i < N; ++i)
435 map<WAIKeyFrame*, size_t> observations;
448 if (observations.empty())
451 cv::Mat normal = cv::Mat::zeros(3, 1, CV_32F);
453 for (map<WAIKeyFrame*, size_t>::iterator mit = observations.begin(), mend = observations.end(); mit != mend; mit++)
458 normal = normal + normali / cv::norm(normali);
463 const float dist = (float)cv::norm(PC);
464 const int level = pRefKF->
mvKeysUn[observations[pRefKF]].octave;
545 if (mat.isContinuous())
546 size = mat.total() * mat.elemSize();
549 size = mat.step[0] * mat.rows;
558 size +=
sizeof(*this);
cv::Mat GetCameraCenter()
const std::vector< float > mvScaleFactors
const std::vector< cv::KeyPoint > mvKeysUn
void EraseMapPointMatch(WAIMapPoint *pMP)
const cv::Mat mDescriptors
const float mfLogScaleFactor
void ReplaceMapPointMatch(const size_t &idx, WAIMapPoint *pMP)
std::mutex mMutexFeatures
@ RefKfSource_Constructor
@ RefKfSource_EraseObservation
void SetMinDistance(float minDist)
void AddObservation(WAIKeyFrame *pKF, size_t idx)
std::map< WAIKeyFrame *, size_t > mObservations
static long unsigned int nNextId
std::map< WAIKeyFrame *, size_t > GetObservations()
float GetMaxDistanceInvariance()
size_t getSizeOfCvMat(const cv::Mat &mat)
void UpdateNormalAndDepth()
int PredictScale(const float ¤tDist, WAIKeyFrame *pF)
int GetIndexInKeyFrame(WAIKeyFrame *pKF)
static std::mutex mGlobalMutex
void SetDescriptor(const cv::Mat &descriptor)
void Replace(WAIMapPoint *pMP)
float GetMinDistanceInvariance()
static std::mutex mMutexMapPointCreation
void SetNormal(const cv::Mat &normal)
void EraseObservation(WAIKeyFrame *pKF)
WAIKeyFrame * GetReferenceKeyFrame()
bool IsInKeyFrame(WAIKeyFrame *pKF)
void IncreaseVisible(int n=1)
void ComputeDistinctiveDescriptors()
WAIMapPoint(int id, const cv::Mat &Pos, bool fixMp)
constructor used during map loading
void SetMaxDistance(float maxDist)
void IncreaseFound(int n=1)
void SetWorldPos(const cv::Mat &Pos)
WAIMapPoint * GetReplaced()
void log(const char *tag, const char *format,...)
logs a formatted string platform independently