本文整理汇总了C++中MapPoint::setUncertain方法的典型用法代码示例。如果您正苦于以下问题:C++ MapPoint::setUncertain方法的具体用法?C++ MapPoint::setUncertain怎么用?C++ MapPoint::setUncertain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapPoint
的用法示例。
在下文中一共展示了MapPoint::setUncertain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reconstructTracks
int NewMapPtsSURF::reconstructTracks(Track2D tracks[], int numTracks, int curFrame, std::vector<MapPoint*>& mapPts, //new map points that are generated
int minLen,
double maxRpErr) {
std::vector<FeaturePoint*> reconFeatPts[SLAM_MAX_NUM];
int num = 0;
for (int k = 0; k < numTracks; k++) {
if (tracks[k].length() >= minLen) {
Mat_d ms(numCams, 2);
Mat_d nms(numCams, 2);
Mat_d Ks(numCams, 9);
Mat_d Rs(numCams, 9);
Mat_d Ts(numCams, 3);
int npts = 0;
for (Track2DNode* pTkNode = tracks[k].head.next; pTkNode; pTkNode = pTkNode->next) {
int camId = m_camGroup.camIds[pTkNode->f];
ms.data[2 * npts] = pTkNode->x;
ms.data[2 * npts + 1] = pTkNode->y;
//normalize the image coordinates of the feature points
normPoint(m_invK[camId], ms.data + 2 * npts, nms.data + 2 * npts);
memcpy(Ks.data + 9 * npts, m_K[camId], sizeof(double) * 9);
memcpy(Rs.data + 9 * npts, m_R[camId], sizeof(double) * 9);
memcpy(Ts.data + 3 * npts, m_t[camId], sizeof(double) * 3);
npts++;
}
double M[4];
triangulateMultiView(npts, Rs.data, Ts.data, nms.data, M);
bool outlier = false;
//check re-projection error
for (int i = 0; i < npts; i++) {
double rm[2];
project(Ks.data + 9 * i, Rs.data + 9 * i, Ts.data + 3 * i, M, rm);
double err = dist2(ms.data + 2 * i, rm);
if (err > maxRpErr || isAtCameraBack(Rs.data + 9 * i, Ts.data + 3 * i, M)) {
outlier = true;
break;
}
}
//if it is a inlier, a new map point is generated
if (!outlier) {
MapPoint* pM = new MapPoint(M[0], M[1], M[2], curFrame);
mapPts.push_back(pM);
//get the triangulation covariance
getTriangulateCovMat(npts, Ks.data, Rs.data, Ts.data, M, pM->cov, Const::PIXEL_ERR_VAR);
for (Track2DNode* pTkNode = tracks[k].head.next; pTkNode; pTkNode = pTkNode->next) {
int camId = m_camGroup.camIds[pTkNode->f];
FeaturePoint* fp = pTkNode->pt;
reconFeatPts[pTkNode->f].push_back(fp);
fp->reprojErr = reprojErrorSingle(fp->K, fp->cam->R, fp->cam->t, M, fp->m);
pM->addFeature(camId, fp);
}
pM->setUncertain();
num++;
}
}
}
//test
logInfo("%d new map points are generated!\n", num);
for (int c = 0; c < numCams; c++) {
int camId = m_camGroup.camIds[c];
pCoSLAM->slam[camId].feedExtraFeatPtsToTracker(reconFeatPts[camId]);
}
return num;
}