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


C++ Pose::GetMatrix方法代码示例

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


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

示例1: cvCreateMat

void MultiMarker::PointCloudCorners3d(double edge_length, Pose &pose, CvPoint3D64f corners[4]) {
	// Transformation from origin to current marker
	CvMat *m3 = cvCreateMat(4,4,CV_64F); cvSetIdentity(m3);
	pose.GetMatrix(m3);

	for(size_t j = 0; j < 4; ++j)
	{
		// TODO: This should be exactly the same as in Marker class.
		//       Should we get the values from there somehow?
		double X_data[4] = {0, 0, 0, 1};
		if (j == 0) { 
			int zzzz=2;			
			//X_data[0] = -0.5*edge_length;
			//X_data[1] = -0.5*edge_length;
		} else if (j == 1) {
			X_data[0] = +0.5*edge_length;
			X_data[1] = -0.5*edge_length;
		} else if (j == 2) {
			X_data[0] = +0.5*edge_length;
			X_data[1] = +0.5*edge_length;
		} else if (j == 3) {
			X_data[0] = -0.5*edge_length;
			X_data[1] = +0.5*edge_length;
		}

		CvMat X  = cvMat(4, 1, CV_64F, X_data);
		cvMatMul(m3, &X, &X);

		corners[j].x = X_data[0] / X_data[3];
		corners[j].y = X_data[1] / X_data[3];
		corners[j].z = X_data[2] / X_data[3];
	}
	cvReleaseMat(&m3);
}
开发者ID:130s,项目名称:ar_track_alvar,代码行数:34,代码来源:MultiMarker.cpp

示例2: updateMarkerPoses

bool MultiMarkerInitializer::updateMarkerPoses(vector<MarkerMeasurement> &markers, const Pose &pose) {
	bool found_new = false;
	for (vector<MarkerMeasurement>::iterator i = markers.begin(); i != markers.end(); ++i) {
		MarkerMeasurement &marker = *i;
		int id = marker.GetId();
		int index = get_id_index(id);
		if (index > 0 && !marker.globalPose) {
			// Compute absolute marker pose.
			double cam_posed[16];
			double mar_posed[16];
			CvMat cam_mat = cvMat(4, 4, CV_64F, cam_posed);
			CvMat mar_mat = cvMat(4, 4, CV_64F, mar_posed);
			pose.GetMatrix(&cam_mat);
			marker.pose.GetMatrix(&mar_mat);
			cvInvert(&cam_mat, &cam_mat);
			cvMatMul(&cam_mat, &mar_mat, &mar_mat);
			marker.pose.SetMatrix(&mar_mat);
			// Put marker into point cloud
			CvPoint3D64f corners[4];
			PointCloudCorners3d(marker.GetMarkerEdgeLength(), marker.pose, corners);
			for(size_t j = 0; j < 4; ++j) {
				CvPoint3D64f p;
				int p_index = pointcloud_index(id, j);
				p.x = pointcloud_filtered[3*p_index+0].next(corners[j].x);
				p.y = pointcloud_filtered[3*p_index+1].next(corners[j].y);
				p.z = pointcloud_filtered[3*p_index+2].next(corners[j].z);
				if (pointcloud_filtered[3*p_index+0].getCurrentSize() >= filter_buffer_min) {
					pointcloud[p_index] = p;
					marker_status[index] = 1;
				}
			}
			marker.globalPose = 1;
			found_new = true;
		}
	}
	return found_new;
}
开发者ID:gabrielcruzarias,项目名称:lis_turtlebots,代码行数:37,代码来源:MultiMarkerInitializer.cpp

示例3: _Update

double MultiMarkerFiltered::_Update(MarkerIterator &begin, MarkerIterator &end, 
                                    Camera* cam, Pose& pose, IplImage* image)
{
	if (_GetPose(begin, end, cam, pose, NULL) == -1) return -1;

	// For every detected marker
  for (MarkerIterator &i = begin.reset(); i != end; ++i)
	{
		const Marker* marker = *i;
		int id = marker->GetId();
		int index = get_id_index(id);
		if (index < 0) continue;

		// Initialize marker pose
		if (marker_status[index] == 0)
		{
			double cam_posed[16];
			double mar_posed[16];

			CvMat cam_mat = cvMat(4, 4, CV_64F, cam_posed);
			CvMat mar_mat = cvMat(4, 4, CV_64F, mar_posed);

			pose.GetMatrix(&cam_mat);
			marker->pose.GetMatrix(&mar_mat);

			cvInvert(&cam_mat, &cam_mat);
			cvMatMul(&cam_mat, &mar_mat, &mar_mat);

			Pose p;
			p.SetMatrix(&mar_mat);
			PointCloudAverage(id, marker->GetMarkerEdgeLength(), p);
		}
	}

	// When the pointcloud is updated we will get the new "better" pose...
	return _GetPose(begin, end, cam, pose, image);
}
开发者ID:130s,项目名称:ar_track_alvar,代码行数:37,代码来源:MultiMarkerFiltered.cpp


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