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


C++ VectorXd::adjoint方法代码示例

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


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

示例1: X

// Reconstruct 3D Points
void Scanner3D::Reconstruct()
{
	MatrixXd RC_H = cvmat2matrix(rotMatrixH);
	MatrixXd RC_V = cvmat2matrix(rotMatrixV);
	VectorXd TC_H = cvmat2vect(transVectorH);
	VectorXd TC_V = cvmat2vect(transVectorV);

    // Estimate parameters of reference planes (using least-squares)

	MatrixXd X(3,4);

	int colNum = X.cols();
	int rowNum = X.rows();

	X << 0, dX, dX, 0,
		 0 ,0, dY, dY,
		 0 ,0 ,0 ,0;


	Vector4d Xrow1 = X.row(0);
	Vector4d Xrow2 = X.row(1);
	Vector4d Xrow3 = X.row(2);
	Vector4d hPlane;

	hPlane = fitPlane(Xrow1,Xrow2,Xrow3);

	VectorXd diffT_vh;

	diffT_vh = TC_V - TC_H;

	MatrixXd TempX(rowNum,colNum);

	for(int i = 0; i<colNum; i++)
		TempX.col(i) = diffT_vh;

	X = RC_H.transpose()*((RC_V * X) + TempX );

	Xrow1 = X.row(0);
	Xrow2 = X.row(1);
	Xrow3 = X.row(2);
	Vector4d vPlane;

	vPlane = fitPlane(Xrow1,Xrow2,Xrow3);

	vPlane = (-1)*vPlane;

    // Calculate camera center (in "horizontal" reference coordinate system)
	Vector3d C = ((-1)*RC_H.transpose()) * TC_H;

    // Determine implicit representation for the shadow planes
	MatrixXd shadowPlaneEnter(recFrames.rows(),4); //"entering" shadow plane
	MatrixXd shadowPlaneLeave(recFrames.rows(),4); //"leaving" shadow plane

	for(int i = 0; i<recFrames.size(); i++)
	{
		Vector3d n1_v,n2_v,p1_v,p2_v;

		VectorXd vLineEnterRow = vLineEnter.row(i);
		VectorXd hLineEnterRow = hLineEnter.row(i);

    //Determine true position of the "vertical" shadow boundary (entering)
		n1_v = RC_H.transpose() * Pixel2Ray(intersectLines(vLineEnterRow,middleLine));
		n2_v = RC_H.transpose() * Pixel2Ray(intersectLines(vLineEnterRow,upperLine));
        p1_v = intersectLineWithPlane(C,n1_v,vPlane);
        p2_v = intersectLineWithPlane(C,n2_v,vPlane);

		Vector3d n1_h,n2_h,p1_h,p2_h;
    //Determine true position of the "horizontal" shadow boundary (entering)
		n1_h = RC_H.transpose() * Pixel2Ray(intersectLines(hLineEnterRow,middleLine));
		n2_h = RC_H.transpose() * Pixel2Ray(intersectLines(hLineEnterRow,lowerLine));
		p1_h = intersectLineWithPlane(C,n1_h,hPlane);
	    p2_h = intersectLineWithPlane(C,n2_h,hPlane);


		Vector3d q_v,v_v,q_h,v_h;

    // Compute the "entering" shadow plane parameters
		q_v = p1_v;
		v_v = (p2_v-p1_v).normalized();
		q_h = p1_h;
		v_h = (p2_h-p1_h).normalized();

		shadowPlaneEnter.block(i,0,1,3) = v_v.cross(v_h).transpose();
		shadowPlaneEnter.block(i,0,1,3) = shadowPlaneEnter.block(i,0,1,3).normalized();
		VectorXd shadowEnterBlock = shadowPlaneEnter.block(i,0,1,3).transpose();

		double product = shadowEnterBlock.adjoint()*(q_v+q_h);

		shadowPlaneEnter(i,3) = 0.5 * product;

    // Determine true position of the "vertical" shadow boundary (leaving)
		n1_v = RC_H.transpose() * Pixel2Ray(intersectLines(vLineEnterRow,middleLine));
        n2_v = RC_H.transpose() * Pixel2Ray(intersectLines(vLineEnterRow,upperLine));
        p1_v = intersectLineWithPlane(C,n1_v,vPlane);
        p2_v = intersectLineWithPlane(C,n2_v,vPlane);

    // Determine true position of the "horizontal" shadow boundary (leaving)
		n1_h = RC_H.transpose() * Pixel2Ray(intersectLines(hLineEnterRow,middleLine));
		n2_h = RC_H.transpose() * Pixel2Ray(intersectLines(hLineEnterRow,lowerLine));
//.........这里部分代码省略.........
开发者ID:denitiu,项目名称:Build_3D_Scanner_Project,代码行数:101,代码来源:3DScanner.cpp


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