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


C++ DblVector::ExportForPSTricks方法代码示例

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


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

示例1: AlignSequence

void SharedImageSequence::AlignSequence(int noItMax, bool circular)
{
	boost::progress_timer t(std::clog);
	SharedImageSequence::iterator it0, it1, it2, it3, it4;
	Mat3d rot; Vec3d trans;
	DblVector maxRots;
	DblVector maxTranss;

	OrientAlongPrincipalAxises(true);

	/// Main iteration
	for(int i=0; i<noItMax; i++)
	{
		double maxRot=0, maxTrans=0, maxNorm=0, normSum = 0.0;
		//std::cout << "\nIt " << i << std::endl;
		int k=0, l=0;
		bool flag=false;
		for(it0=begin(); it0!=end(); it0++)
		{
			/// Update iterators
			it1=it0;
			it1++;
			l=k+1;
			if(it1==end())
			{
				OrientAlongPrincipalAxises(true);
				if(circular)
				{
					it1=begin();
					l=0;
					flag = true;
				}
				else break;
			}
			
			/// Find the transformation between neighbors
			if(it0->GetTransformation(*it1, &rot, &trans)==RET_FAILED) continue;
			
			/// Output the strength of transformatiom
			Frame F;
			ConvertFrame(rot, trans, F);
			//std::cout << "Views " << k << " " << l << std::endl;
			double normTrans = Point3Dbl(F[0], F[1], F[2]).AbsVal();
			double degRot = F[3]*180.0/THE_PI_DEF;
			double norm = normTrans + F[3] * ROT_FACTOR;
			normSum += norm;
			if(norm>maxNorm) maxNorm = norm;
			if(maxRot<degRot) maxRot=degRot;
			if(maxTrans<normTrans) maxTrans=normTrans;
			//std::cout << "Strength (rot, trans): " << degRot << " (deg) " << normTrans << " (mm) " << std::endl;
			////std::cout << "Statistics (count, mean, sigma): " << noPoints << " " << mean[k] << " " << sigma[k] << std::endl;

			/// Apply transformation to the tail and update means
			if(!flag)
			{
				for(it2=it1; it2!=end(); it2++)
				{	
					it2->ApplyTransformationToCoordImage(*it2, rot, trans);
				}
			}
			else
			{
				double n=0;
				for(it2=it1; it2!=end(); it2++, n++)
				{	
				
					/// Get weight of transformation
					Frame G=F;
					Mat3d wRot; Vec3d wTrans;
				
					double weight = 1.0/exp((double)n);//((double)size()-n)/(double)size();
					
					/// Alter frame
					
					G[0]*=weight; G[1]*=weight;
					G[2]*=weight; G[3]*=weight;	

					ConvertFrameBack(G, wRot, wTrans);
					it2->ApplyTransformationToCoordImage(*it2, wRot, wTrans);
				}
			}
			//std::cout << std::endl;
			k++;
		}

		//std::cout << "Max rot  : " << maxRot << " (deg) " << std::endl;
		//std::cout << "Max trans: " << maxTrans << " (mm) " << std::endl;
		//std::cout << "Max norm: " << maxNorm  << std::endl;
		double avgNorm = normSum/(double)k;
		//std::cout << "Avg norm: " << avgNorm  << std::endl;
		maxRots.push_back(maxRot);
		maxTranss.push_back(maxTrans);
	}
	
	OrientAlongPrincipalAxises(true);

	std::string rotStr = maxRots.ExportForPSTricks();
	std::ofstream rotf("maxRotations.txt");
	rotf << rotStr;
	std::string transStr = maxTranss.ExportForPSTricks();
//.........这里部分代码省略.........
开发者ID:Yanzqing,项目名称:cob_object_perception,代码行数:101,代码来源:SharedImageSequence.cpp


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