当前位置: 首页>>代码示例>>C++>>正文


C++ Mat_d::resize方法代码示例

本文整理汇总了C++中Mat_d::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat_d::resize方法的具体用法?C++ Mat_d::resize怎么用?C++ Mat_d::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mat_d的用法示例。


在下文中一共展示了Mat_d::resize方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getSeedsBetween

int NewMapPtsNCC::getSeedsBetween(MapPointList& mapPts, int iCam, int jCam,
		Mat_d& seed1, Mat_d& seed2) {
	MapPoint* pHead = mapPts.getHead();
	if (!pHead)
		repErr("SLAM failed - No map point can be found!\n");
	std::vector<FeaturePoint*> vecFeatPts1, vecFeatPts2;
	for (MapPoint* p = pHead; p; p = p->next) {
		//if ((p->iLocalType == TYPE_MAPPOINT_STATIC || p->iLocalType == TYPE_MAPPOINT_DYNAMIC) && p->numVisCam >= 2 && p->pFeatures[iCam] && p->pFeatures[iCam]->f == m_curFrame && p->pFeatures[jCam] && p->pFeatures[jCam]->f == m_curFrame) {
		if (!p->isFalse() && !p->isUncertain() && p->numVisCam >= 2
				&& p->pFeatures[iCam] && p->pFeatures[iCam]->f == m_curFrame
				&& p->pFeatures[jCam] && p->pFeatures[jCam]->f == m_curFrame) {
			vecFeatPts1.push_back(p->pFeatures[iCam]);
			vecFeatPts2.push_back(p->pFeatures[jCam]);
		}
	}
	if (vecFeatPts1.empty())
		return 0;

	seed1.resize(vecFeatPts1.size(), 2);
	seed2.resize(vecFeatPts2.size(), 2);

	for (size_t i = 0; i < vecFeatPts1.size(); i++) {
		seed1.data[2 * i] = vecFeatPts1[i]->x;
		seed1.data[2 * i + 1] = vecFeatPts1[i]->y;
		seed2.data[2 * i] = vecFeatPts2[i]->x;
		seed2.data[2 * i + 1] = vecFeatPts2[i]->y;
	}
	return seed1.rows;
}
开发者ID:Kyate,项目名称:CoSLAM,代码行数:29,代码来源:SL_NewMapPointsInterCam.cpp

示例2: getMatchingFromTracks

int getMatchingFromTracks(int nTracks, const Track2D* vecPTracks, int f1, int f2, Mat_d& pts1, Mat_d& pts2) {
	if (f1 >= f2)
		repErr("getMatchingFrameTracks - f1 >= f2\n");

	pts1.resize(nTracks, 2);
	pts2.resize(nTracks, 2);

	int k = 0;
	for (int i = 0; i < nTracks; i++) {
		Track2DNode* p = vecPTracks[i].head.next;
		Track2DNode* tail = vecPTracks[i].tail->next;
		bool bFoundPts1 = false;
		while (p != tail) {
			if (p->f == f1) {
				pts1.data[2 * k] = p->x;
				pts1.data[2 * k + 1] = p->y;
				bFoundPts1 = true;
			}
			if (bFoundPts1 && p->f == f2) {
				pts2.data[2 * k] = p->x;
				pts2.data[2 * k + 1] = p->y;
				k++;
				break; //found a matching in the track, jump to the next track
			}
			p = p->next;
		}
	}
	pts1.rows = k;
	pts2.rows = k;
	return k;
}
开发者ID:AutonomyLab,项目名称:visual_coslam,代码行数:31,代码来源:SL_InitMapHelper.cpp

示例3: TracksToMeasurments

void TracksToMeasurments(const double invK[][9], std::vector<const Track2D*> vecPTracks, int nviews, Mat_d& meas, Mat_c& vmask) {

	int nTrack = vecPTracks.size();
	int nMeas = 0;
	for (int i = 0; i < nTrack; i++) {
		nMeas += vecPTracks[i]->length();
	}

	meas.resize(nMeas, 2);
	vmask.resize(nTrack, nviews);
	vmask.fill(0);

	double tmpPt[2];
	int k = 0;
	for (int i = 0; i < nTrack; i++) {
		Track2DNode* p = vecPTracks[i]->head.next;
		Track2DNode* tail = vecPTracks[i]->tail->next;
		while (p != tail) {
			int f = p->f;
			tmpPt[0] = p->x;
			tmpPt[1] = p->y;
			normPoint(invK[f], tmpPt, meas + 2 * k);
			vmask.data[i * nviews + f] = true;
			k++;
			p = p->next;
		}
	}
}
开发者ID:AutonomyLab,项目名称:visual_coslam,代码行数:28,代码来源:SL_InitMapHelper.cpp

示例4: featPoint2Mat

void featPoint2Mat(std::vector<FeaturePoint*>& pFeatPoints, Mat_d& matPts) {
	size_t num = pFeatPoints.size();
	matPts.resize(num, 2);
	for (size_t i = 0; i < num; i++) {
		matPts.data[2 * i] = pFeatPoints[i]->x;
		matPts.data[2 * i + 1] = pFeatPoints[i]->y;
	}
}
开发者ID:danping,项目名称:CoSLAM,代码行数:8,代码来源:SL_SingleSLAM.cpp

示例5: KpVec2Mat

void KpVec2Mat(const KpVec& vecPts , Mat_d& matPts) {
	int numPts = vecPts.size();
	matPts.resize(numPts, 2);
	for (int i = 0; i < numPts; i++) {
		matPts.data[2 * i] = vecPts[i].pt.x;
		matPts.data[2 * i + 1] = vecPts[i].pt.y;
	}
}
开发者ID:jacobperron,项目名称:LibVisualSLAM,代码行数:8,代码来源:cvHelper.cpp

示例6: matEyes

void matEyes(int n, Mat_d& mat) {
	mat.resize(n, n);
	mat.fill(0);
	int i;
	for (i = 0; i < n; ++i) {
		mat.data[i * n + i] = 1;
	}
}
开发者ID:jacobperron,项目名称:LibVisualSLAM,代码行数:8,代码来源:SL_Matrix.cpp

示例7: matRand

void matRand(int m, int n, Mat_d& mat) {
	mat.resize(m, n);
	int i, len = m * n;
	for (i = 0; i < len; ++i) {
		double rnd_val = double(rand()) / RAND_MAX - 0.5;
		mat.data[i] = rnd_val;
	}
}
开发者ID:jacobperron,项目名称:LibVisualSLAM,代码行数:8,代码来源:SL_Matrix.cpp

示例8: cvMat2MyMat

void cvMat2MyMat(const cv::Mat& cvMat , Mat_d& mat) {
	mat.resize(cvMat.rows, cvMat.cols);
	if (cvMat.type() == CV_64F) {
		CvMat tmpMat = cvMat;
		memcpy(mat.data, tmpMat.data.db, sizeof(double) * cvMat.rows * cvMat.cols);
	} else {
		CvMat tmpMat = cvMat;
		int len = cvMat.rows * cvMat.cols;
		for (int i = 0; i < len; i++) {
			mat.data[i] = tmpMat.data.fl[i];
		}
	}
}
开发者ID:jacobperron,项目名称:LibVisualSLAM,代码行数:13,代码来源:cvHelper.cpp

示例9: registerToKeyFrame

bool registerToKeyFrame(int camId, const KeyPose* pose, const ImgG& curImg,
		vector<MapPoint*>& matchedMapPts, Mat_d& matched2DPts) {

	assert(pose && !pose->img.empty());
	assert(!curImg.empty());

	vector<MapPoint*> mappts;
	pose->getStaticMapPoints(mappts);
	Mat_d pts3d;

	vecMapPt2Mat(mappts, pts3d);
	if( pts3d.m  == 0)
		return false;

	Mat_d keyPts(pts3d.m, 2);

	project(pose->K, pose->cam->R, pose->cam->t, pts3d.m,
			pts3d.data, keyPts.data);

	//2.find the correspondences of the projected feature points in the current image
	Mat_d curPts;
	Mat_uc flag;

	int nMatched = trackFeatureKLT(pose->img, curImg, keyPts, curPts, flag,
			23, 5, 0.001);

	if (nMatched < 0.6 * keyPts.m)
		return false;

	matched2DPts.resize(nMatched, 2);
	int k = 0;
	for (int i = 0; i < pts3d.m; i++) {
		if (flag[i] > 0) {
			matched2DPts[2 * k] = curPts[2 * i];
			matched2DPts[2 * k + 1] = curPts[2 * i + 1];
			matchedMapPts.push_back(mappts[i]);
			k++;
		}
	}
	return true;
}
开发者ID:caomw,项目名称:CoSLAM_for_Target_Following,代码行数:41,代码来源:SL_Relocalization.cpp

示例10: getPointsFromTracks

/* get points at frame f*/
void getPointsFromTracks(std::vector<const Track2D*>& vecPTracks, int f, Mat_d& pts) {
	pts.clear();
	size_t nTracks = vecPTracks.size();

	pts.resize(nTracks, 2);

	int k = 0;
	for (size_t i = 0; i < nTracks; i++) {
		Track2DNode* p = vecPTracks[i]->head.next;
		Track2DNode* tail = vecPTracks[i]->tail->next;
		while (p != tail) {
			if (p->f == f) {
				pts.data[2 * k] = p->x;
				pts.data[2 * k + 1] = p->y;
				k++;
				break;
			}
			p = p->next;
		}
	}
	pts.rows = k;
}
开发者ID:AutonomyLab,项目名称:visual_coslam,代码行数:23,代码来源:SL_InitMapHelper.cpp

示例11: matZeros

void matZeros(int m, int n, Mat_d& mat) {
	mat.resize(m, n);
	mat.fill(0);
}
开发者ID:jacobperron,项目名称:LibVisualSLAM,代码行数:4,代码来源:SL_Matrix.cpp

示例12: matOnes

void matOnes(int m, int n, Mat_d& mat) {
	mat.resize(m, n);
	mat.fill(1);
}
开发者ID:jacobperron,项目名称:LibVisualSLAM,代码行数:4,代码来源:SL_Matrix.cpp


注:本文中的Mat_d::resize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。