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


Java CommonOps.divide方法代码示例

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


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

示例1: backAndForth

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Test
public void backAndForth() {
	DenseMatrix64F R = RotationMatrixGenerator.eulerXYZ(1, 2, -0.5, null);
	Vector3D_F64 T = new Vector3D_F64(0.5,0.7,-0.3);

	DenseMatrix64F E = MultiViewOps.createEssential(R, T);
	
	double param[] = new double[7];
	
	ParamFundamentalEpipolar alg = new ParamFundamentalEpipolar();
	
	DenseMatrix64F found = new DenseMatrix64F(3,3);
	alg.encode(E, param);
	alg.decode(param, found);

	// normalize to take in account scale different when testing
	CommonOps.divide(E.get(2,2),E);
	CommonOps.divide(found.get(2, 2), found);
	
	assertTrue(MatrixFeatures.isEquals(E, found, 1e-8));
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:22,代码来源:TestParamFundamentalEpipolar.java

示例2: perfectInput

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Test
public void perfectInput() {
	createScene(30,false);

	// use the linear algorithm to compute the homography
	HomographyLinear4 estimator = new HomographyLinear4(true);
	estimator.process(pairs,H);

	GeoModelRefine<DenseMatrix64F,AssociatedPair> alg = createAlgorithm();

	//give it the perfect matrix and see if it screwed it up
	assertTrue(alg.process(H, pairs, found));

	// normalize so that they are the same
	CommonOps.divide(H.get(2, 2), H);
	CommonOps.divide(found.get(2, 2), found);

	assertTrue(MatrixFeatures.isEquals(H, found, 1e-8));
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:20,代码来源:CheckRefineHomography.java

示例3: perfectInput

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Test
public void perfectInput() {
	init(30,false);

	// compute true essential matrix
	DenseMatrix64F E = MultiViewOps.createEssential(worldToCamera.getR(), worldToCamera.getT());

	GeoModelRefine<DenseMatrix64F,AssociatedPair> alg = createAlgorithm();

	//give it the perfect matrix and see if it screwed it up
	assertTrue(alg.process(E, pairs, found));

	// normalize so that they are the same
	CommonOps.divide(E.get(2, 2), E);
	CommonOps.divide(found.get(2,2),found);

	assertTrue(MatrixFeatures.isEquals(E, found, 1e-8));
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:CheckRefineFundamental.java

示例4: setupA

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
 * Sets up the system of equations which are to be solved.  This equation is derived from
 * constraints (3) and (4) in the paper.   See section 3.1.
 *
 * @param homographies set of observed homographies.
 */
private void setupA( List<DenseMatrix64F> homographies ) {
	A.reshape(2*homographies.size(),6, false);

	DenseMatrix64F h1 = new DenseMatrix64F(3,1);
	DenseMatrix64F h2 = new DenseMatrix64F(3,1);

	DenseMatrix64F v12 = new DenseMatrix64F(1,6);
	DenseMatrix64F v11 = new DenseMatrix64F(1,6);
	DenseMatrix64F v22 = new DenseMatrix64F(1,6);

	DenseMatrix64F v11m22 = new DenseMatrix64F(1,6);

	for( int i = 0; i < homographies.size(); i++ ) {
		DenseMatrix64F H = homographies.get(i);

		CommonOps.extract(H,0,3,0,1,h1,0,0);
		CommonOps.extract(H,0,3,1,2,h2,0,0);

		// normalize H by the max value to reduce numerical error when computing A
		// several numbers are multiplied against each other and could become quite large/small
		double max1 = CommonOps.elementMaxAbs(h1);
		double max2 = CommonOps.elementMaxAbs(h2);
		double max = Math.max(max1,max2);

		CommonOps.divide(max,h1);
		CommonOps.divide(max,h2);

		// compute elements of A
		computeV(h1, h2, v12);
		computeV(h1, h1, v11);
		computeV(h2, h2, v22);

		CommonOps.sub(v11,v22,v11m22);

		CommonOps.insert( v12    , A, i*2   , 0);
		CommonOps.insert( v11m22 , A, i*2+1 , 0);
	}
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:45,代码来源:Zhang99CalibrationMatrixFromHomographies.java

示例5: setupA_NoSkew

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
 * Similar to {@link #setupA(java.util.List)} but all references to B12 have been removed
 * since it will always be zero when the skew is zero
 *
 * @param homographies set of observed homographies.
 */
private void setupA_NoSkew( List<DenseMatrix64F> homographies ) {
	A.reshape(2*homographies.size(),5, false);

	DenseMatrix64F h1 = new DenseMatrix64F(3,1);
	DenseMatrix64F h2 = new DenseMatrix64F(3,1);

	DenseMatrix64F v12 = new DenseMatrix64F(1,5);
	DenseMatrix64F v11 = new DenseMatrix64F(1,5);
	DenseMatrix64F v22 = new DenseMatrix64F(1,5);

	DenseMatrix64F v11m22 = new DenseMatrix64F(1,5);

	for( int i = 0; i < homographies.size(); i++ ) {
		DenseMatrix64F H = homographies.get(i);

		CommonOps.extract(H,0,3,0,1,h1,0,0);
		CommonOps.extract(H,0,3,1,2,h2,0,0);

		// normalize H by the max value to reduce numerical error when computing A
		// several numbers are multiplied against each other and could become quite large/small
		double max1 = CommonOps.elementMaxAbs(h1);
		double max2 = CommonOps.elementMaxAbs(h2);
		double max = Math.max(max1,max2);

		CommonOps.divide(max,h1);
		CommonOps.divide(max,h2);

		// compute elements of A
		computeV_NoSkew(h1, h2, v12);
		computeV_NoSkew(h1, h1, v11);
		computeV_NoSkew(h2, h2, v22);

		CommonOps.sub(v11,v22,v11m22);

		CommonOps.insert( v12    , A, i*2   , 0);
		CommonOps.insert( v11m22 , A, i*2+1 , 0);
	}
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:45,代码来源:Zhang99CalibrationMatrixFromHomographies.java

示例6: findScaleH

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
 * The scale of H is found by computing the second smallest singular value.
 */
protected boolean findScaleH( DenseMatrix64F H ) {
	if( !svd.decompose(H) )
		return false;

	Arrays.sort(svd.getSingularValues(), 0, 3);

	double scale = svd.getSingularValues()[1];
	CommonOps.divide(scale, H);

	return true;
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:15,代码来源:AdjustHomographyMatrix.java

示例7: incorrectInput

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Test
	public void incorrectInput() {
		createScene(30,false);

		// use the linear algorithm to compute the homography
		HomographyLinear4 estimator = new HomographyLinear4(true);
		estimator.process(pairs,H);

		GeoModelRefine<DenseMatrix64F,AssociatedPair> alg = createAlgorithm();

		//give it the perfect matrix and see if it screwed it up
		DenseMatrix64F Hmod = H.copy();
		Hmod.data[0] += 0.1;
		Hmod.data[5] += 0.1;
		assertTrue(alg.process(Hmod, pairs, found));

		// normalize to allow comparison
		CommonOps.divide(H.get(2,2),H);
		CommonOps.divide(Hmod.get(2,2),Hmod);
		CommonOps.divide(found.get(2,2),found);

		double error0 = 0;
		double error1 = 0;

		// very crude error metric
		for( int i = 0; i < 9; i++ ) {
			error0 += Math.abs(Hmod.data[i]-H.data[i]);
			error1 += Math.abs(found.data[i]-H.data[i]);
		}

//		System.out.println("error "+error1);
		assertTrue(error1 < error0);
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:34,代码来源:CheckRefineHomography.java

示例8: incorrectInput

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Test
	public void incorrectInput() {
		init(30,false);

		// compute true essential matrix
		DenseMatrix64F E = MultiViewOps.createEssential(worldToCamera.getR(), worldToCamera.getT());

		// create an alternative incorrect matrix
		Vector3D_F64 T = worldToCamera.getT().copy();
		T.x += 0.1;
		DenseMatrix64F Emod = MultiViewOps.createEssential(worldToCamera.getR(), T);

		GeoModelRefine<DenseMatrix64F,AssociatedPair> alg = createAlgorithm();

		// compute and compare results
		assertTrue(alg.process(Emod, pairs,found));

		// normalize to allow comparison
		CommonOps.divide(E.get(2,2),E);
		CommonOps.divide(Emod.get(2,2),Emod);
		CommonOps.divide(found.get(2,2),found);

		double error0 = 0;
		double error1 = 0;

		// very crude error metric
		for( int i = 0; i < 9; i++ ) {
			error0 += Math.abs(Emod.data[i]-E.data[i]);
			error1 += Math.abs(found.data[i]-E.data[i]);
		}

//		System.out.println("error "+error1+"   other "+error0);
		assertTrue(error1 < error0);
	}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:35,代码来源:CheckRefineFundamental.java

示例9: divide

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
public void divide(double val) {
    CommonOps.divide(this.data, val);
}
 
开发者ID:yuval,项目名称:ninja,代码行数:4,代码来源:NinjaMatrix.java

示例10: createHomography

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
 * <p>
 * Computes a homography matrix from a rotation, translation, plane normal and plane distance:<br>
 * H = R+(1/d)*T*N<sup>T</sup>
 * </p>
 *
 * @param R Rotation matrix.
 * @param T Translation vector.
 * @param d Distance of closest point on plane to camera
 * @param N Normal of plane
 * @return Calibrated homography matrix
 */
public static DenseMatrix64F createHomography(DenseMatrix64F R, Vector3D_F64 T,
											  double d, Vector3D_F64 N)
{
	DenseMatrix64F H = new DenseMatrix64F(3,3);

	GeometryMath_F64.outerProd(T,N,H);
	CommonOps.divide(d,H);
	CommonOps.addEquals(H, R);

	return H;
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:24,代码来源:MultiViewOps.java


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