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


Java CommonOps.invert方法代码示例

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


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

示例1: setDiffusionPrecision

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Override
public void setDiffusionPrecision(int precisionIndex, final double[] matrix, double logDeterminant) {
    super.setDiffusionPrecision(precisionIndex, matrix, logDeterminant);

    assert (inverseDiffusions != null);

    final int offset = dimTrait * dimTrait * precisionIndex;
    DenseMatrix64F precision = wrap(diffusions, offset, dimTrait, dimTrait);
    DenseMatrix64F variance = new DenseMatrix64F(dimTrait, dimTrait);
    CommonOps.invert(precision, variance);
    unwrap(variance, inverseDiffusions, offset);

    if (DEBUG) {
        System.err.println("At precision index: " + precisionIndex);
        System.err.println("precision: " + precision);
        System.err.println("variance : " + variance);
    }
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:19,代码来源:MultivariateIntegrator.java

示例2: setDiffusionPrecision

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Override
public void setDiffusionPrecision(int precisionIndex, final double[] matrix, double logDeterminant) {
    super.setDiffusionPrecision(precisionIndex, matrix, logDeterminant);

    assert (diffusions != null);
    assert (inverseDiffusions != null);

    final int offset = dimTrait * dimTrait * precisionIndex;
    DenseMatrix64F precision = wrap(diffusions, offset, dimTrait, dimTrait);
    DenseMatrix64F variance = new DenseMatrix64F(dimTrait, dimTrait);
    CommonOps.invert(precision, variance);
    unwrap(variance, inverseDiffusions, offset);

    if (DEBUG) {
        System.err.println("At precision index: " + precisionIndex);
        System.err.println("precision: " + precision);
        System.err.println("variance : " + variance);
    }
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:20,代码来源:SafeMultivariateWithDriftIntegrator.java

示例3: convertPixelToNorm_intrinsic

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Test
public void convertPixelToNorm_intrinsic() {
	IntrinsicParameters intrinsic = new IntrinsicParameters(100,150,0.1,120,209,500,600,false,null);

	DenseMatrix64F K = PerspectiveOps.calibrationMatrix(intrinsic, null);
	DenseMatrix64F K_inv = new DenseMatrix64F(3,3);
	CommonOps.invert(K,K_inv);

	Point2D_F64 pixel = new Point2D_F64(100,120);
	Point2D_F64 expected = new Point2D_F64();

	GeometryMath_F64.mult(K_inv,pixel,expected);

	Point2D_F64 found = PerspectiveOps.convertPixelToNorm(intrinsic,pixel,null);

	assertEquals(expected.x, found.x, 1e-8);
	assertEquals(expected.y, found.y, 1e-8);
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:19,代码来源:TestPerspectiveOps.java

示例4: transformRectToPixel_F32

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
 * <p>
 * Creates a transform that goes from rectified to original distorted pixel coordinates.
 * Rectification includes removal of lens distortion.  Used for rendering rectified images.
 * </p>
 *
 * <p>
 * The original image coordinate system is maintained even if the intrinsic parameter flipY is true.
 * </p>
 *
 * @param param Intrinsic parameters.
 * @param rectify Transform for rectifying the image.
 * @return Transform from rectified to unrectified pixels
 */
public static PointTransform_F32 transformRectToPixel_F32(IntrinsicParameters param,
														  DenseMatrix64F rectify)
{
	AddRadialPtoP_F32 addDistortion = new AddRadialPtoP_F32();
	addDistortion.set(param.fx, param.fy, param.skew, param.cx, param.cy, param.radial);

	DenseMatrix64F rectifyInv = new DenseMatrix64F(3,3);
	CommonOps.invert(rectify,rectifyInv);
	PointTransformHomography_F32 removeRect = new PointTransformHomography_F32(rectifyInv);

	if( param.flipY) {
		PointTransform_F32 flip = new FlipVertical_F32(param.height);
		return new SequencePointTransform_F32(flip,removeRect,addDistortion,flip);
	} else {
		return new SequencePointTransform_F32(removeRect,addDistortion);
	}
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:32,代码来源:RectifyImageOps.java

示例5: transformRectToPixel_F64

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
 * <p>
 * Creates a transform that goes from rectified to original distorted pixel coordinates.
 * Rectification includes removal of lens distortion.  Used for rendering rectified images.
 * </p>
 *
 * <p>
 * The original image coordinate system is maintained even if the intrinsic parameter flipY is true.
 * </p>
 *
 * @param param Intrinsic parameters.
 * @param rectify Transform for rectifying the image.
 * @return Transform from rectified to unrectified pixels
 */
public static PointTransform_F64 transformRectToPixel_F64(IntrinsicParameters param,
														  DenseMatrix64F rectify)
{
	AddRadialPtoP_F64 addDistortion = new AddRadialPtoP_F64();
	addDistortion.set(param.fx, param.fy, param.skew, param.cx, param.cy, param.radial);

	DenseMatrix64F rectifyInv = new DenseMatrix64F(3,3);
	CommonOps.invert(rectify,rectifyInv);
	PointTransformHomography_F64 removeRect = new PointTransformHomography_F64(rectifyInv);

	if( param.flipY) {
		PointTransform_F64 flip = new FlipVertical_F64(param.height);
		return new SequencePointTransform_F64(flip,removeRect,addDistortion,flip);
	} else {
		return new SequencePointTransform_F64(removeRect,addDistortion);
	}
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:32,代码来源:RectifyImageOps.java

示例6: stuff

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Test
public void stuff() {
	PixelToNormalized_F64 alg = new PixelToNormalized_F64();
	alg.set(fx,fy,skew,x_c,y_c);

	Point2D_F64 in = new Point2D_F64(100,120);
	Point2D_F64 out = new Point2D_F64();

	alg.compute(in.x,in.y,out);

	Point2D_F64 expected = new Point2D_F64();
	DenseMatrix64F K_inv = new DenseMatrix64F(3,3,true,fx,skew,x_c,0,fy,y_c,0,0,1);
	CommonOps.invert(K_inv);

	GeometryMath_F64.mult(K_inv, in, expected);

	assertEquals(expected.x,out.x,1e-5);
	assertEquals(expected.y, out.y, 1e-5);
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:20,代码来源:TestPixelToNormalized_F64.java

示例7: convertPixelToNorm_matrix

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Test
public void convertPixelToNorm_matrix() {
	DenseMatrix64F K = new DenseMatrix64F(3,3,true,100,0.1,120,0,150,209,0,0,1);
	DenseMatrix64F K_inv = new DenseMatrix64F(3,3);
	CommonOps.invert(K,K_inv);

	Point2D_F64 pixel = new Point2D_F64(100,120);
	Point2D_F64 expected = new Point2D_F64();

	GeometryMath_F64.mult(K_inv,pixel,expected);

	Point2D_F64 found = PerspectiveOps.convertPixelToNorm(K,pixel,null);

	assertEquals(expected.x, found.x, 1e-8);
	assertEquals(expected.y, found.y, 1e-8);
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:17,代码来源:TestPerspectiveOps.java

示例8: createFundamental

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
 * Computes a Fundamental matrix given an Essential matrix and the camera calibration matrix.
 *
 * F = (K2<sup>-1</sup>)<sup>T</sup>*E*K1<sup>-1</sup>
 *
 * @param E Essential matrix
 * @param K1 Intrinsic camera calibration matrix for camera 1
 * @param K2 Intrinsic camera calibration matrix for camera 2
 * @return Fundamental matrix
 */
public static DenseMatrix64F createFundamental(DenseMatrix64F E,
											   DenseMatrix64F K1,  DenseMatrix64F K2) {
	DenseMatrix64F K1_inv = new DenseMatrix64F(3,3);
	CommonOps.invert(K1,K1_inv);
	DenseMatrix64F K2_inv = new DenseMatrix64F(3,3);
	CommonOps.invert(K2,K2_inv);

	DenseMatrix64F F = new DenseMatrix64F(3,3);
	DenseMatrix64F temp = new DenseMatrix64F(3,3);

	CommonOps.multTransA(K2_inv,E,temp);
	CommonOps.mult(temp,K1_inv,F);

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

示例9: createHomography

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
 * <p>
 * Computes a homography matrix from a rotation, translation, plane normal, plane distance, and
 * calibration matrix:<br>
 * H = K*(R+(1/d)*T*N<sup>T</sup>)*K<sup>-1</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
 * @param K Intrinsic calibration matrix
 * @return Uncalibrated homography matrix
 */
public static DenseMatrix64F createHomography(DenseMatrix64F R, Vector3D_F64 T,
											  double d, Vector3D_F64 N,
											  DenseMatrix64F K)
{
	DenseMatrix64F temp = new DenseMatrix64F(3,3);
	DenseMatrix64F K_inv = new DenseMatrix64F(3,3);

	DenseMatrix64F H = createHomography(R, T, d, N);

	// apply calibration matrix to R
	CommonOps.mult(K,H,temp);

	CommonOps.invert(K,K_inv);
	CommonOps.mult(temp,K_inv,H);

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

示例10: set

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
 * Specify camera calibration parameters
 *
 * @param fx Focal length x-axis in pixels
 * @param fy Focal length y-axis in pixels
 * @param skew skew in pixels
 * @param cx camera center x-axis in pixels
 * @param cy center center y-axis in pixels
 * @param radial Radial distortion parameters
 */
public void set(double fx, double fy, double skew, double cx, double cy, double[] radial) {

	K_inv.set(0, 0, fx);
	K_inv.set(1,1,fy);
	K_inv.set(0,1,skew);
	K_inv.set(0,2,cx);
	K_inv.set(1,2,cy);
	K_inv.set(2,2,1);

	CommonOps.invert(K_inv);

	this.cx = cx;
	this.cy = cy;

	this.radial = new double[radial.length];
	for( int i = 0; i < radial.length; i++ ) {
		this.radial[i] = radial[i];
	}
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:30,代码来源:AddRadialPtoP_F64.java

示例11: stuff

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
@Test
public void stuff() {
	PixelToNormalized_F32 alg = new PixelToNormalized_F32();
	alg.set(fx,fy,skew,x_c,y_c);

	Point2D_F32 in = new Point2D_F32(100,120);
	Point2D_F32 out = new Point2D_F32();

	alg.compute(in.x,in.y,out);

	Point2D_F32 expected = new Point2D_F32();
	DenseMatrix64F K_inv = new DenseMatrix64F(3,3,true,fx,skew,x_c,0,fy,y_c,0,0,1);
	CommonOps.invert(K_inv);

	GeometryMath_F32.mult(K_inv, in, expected);

	assertEquals(expected.x,out.x,1e-5);
	assertEquals(expected.y,out.y,1e-5);
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:20,代码来源:TestPixelToNormalized_F32.java

示例12: set

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
 * Specify camera calibration parameters
 *
 * @param fx Focal length x-axis in pixels
 * @param fy Focal length y-axis in pixels
 * @param skew skew in pixels
 * @param x_c camera center x-axis in pixels
 * @param y_c center center y-axis in pixels
 * @param radial Radial distortion parameters
 */
public void set(double fx, double fy, double skew, double x_c, double y_c, double... radial) {

	K_inv.set(0,0,fx);
	K_inv.set(1,1,fy);
	K_inv.set(0,1,skew);
	K_inv.set(0,2,x_c);
	K_inv.set(1,2,y_c);
	K_inv.set(2,2,1);

	CommonOps.invert(K_inv);

	this.x_c = (float)x_c;
	this.y_c = (float)y_c;

	this.radial = new float[radial.length];
	for( int i = 0; i < radial.length; i++ ) {
		this.radial[i] = (float)radial[i];
	}
}
 
开发者ID:intrack,项目名称:BoofCV-master,代码行数:30,代码来源:RemoveRadialPtoN_F32.java

示例13: calc

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
public Matrix calc(Matrix source) {
	DenseMatrix64F matrix = null;
	if (source instanceof EJMLDenseDoubleMatrix2D) {
		matrix = ((EJMLDenseDoubleMatrix2D) source).getWrappedObject();
	} else {
		matrix = new EJMLDenseDoubleMatrix2D(source).getWrappedObject();
	}
	DenseMatrix64F ret = new DenseMatrix64F(matrix.numRows, matrix.numCols);
	CommonOps.invert(matrix, ret);
	return new EJMLDenseDoubleMatrix2D(ret);
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:12,代码来源:Inv.java

示例14: safeInvert

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
public static InversionResult safeInvert(DenseMatrix64F source, DenseMatrix64F destination, boolean getDeterminant) {

        final int dim = source.getNumCols();
        final int finiteCount = countFiniteNonZeroDiagonals(source);
        double det = 0;

        if (finiteCount == dim) {
            if (getDeterminant) {
                det = invertAndGetDeterminant(source, destination);
            } else {
                CommonOps.invert(source, destination);
            }
            return new InversionResult(FULLY_OBSERVED, dim, det);
        } else {
            if (finiteCount == 0) {
                Arrays.fill(destination.getData(), 0);
                return new InversionResult(NOT_OBSERVED, 0, 0);
            } else {
                final int[] finiteIndices = new int[finiteCount];
                getFiniteNonZeroDiagonalIndices(source, finiteIndices);

                final DenseMatrix64F subSource = new DenseMatrix64F(finiteCount, finiteCount);
                gatherRowsAndColumns(source, subSource, finiteIndices, finiteIndices);

                final DenseMatrix64F inverseSubSource = new DenseMatrix64F(finiteCount, finiteCount);
                if (getDeterminant) {
                    det = invertAndGetDeterminant(subSource, inverseSubSource);
                } else {
                    CommonOps.invert(subSource, inverseSubSource);
                }

                scatterRowsAndColumns(inverseSubSource, destination, finiteIndices, finiteIndices, true);

                return new InversionResult(PARTIALLY_OBSERVED, finiteCount, det);
            }
        }
    }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:38,代码来源:MissingOps.java

示例15: rotationPca

import org.ejml.ops.CommonOps; //导入方法依赖的package包/类
/**
	 * Computes a rotation transformation from the source to target.
	 * @param src
	 * @param tgt
	 * @return
	 */
	public static <T extends RealType<T>> AffineTransform rotationPca(
			IterableInterval<T> src, IterableInterval<T> tgt ){
		
		int ndims = src.numDimensions();
		
		ImgMoment srcMom = new ImgMoment();
		double[] srcOr = srcMom.orientation(src);
		srcMom.orientationEvalsEvecs(srcOr);
		
		ImgMoment tgtMom = new ImgMoment();
		double[] tgtOr = tgtMom.orientation(tgt);
		tgtMom.orientationEvalsEvecs(tgtOr);
		
		DenseMatrix64F srcR = new DenseMatrix64F( ndims, ndims );
		srcR.setData( srcMom.getEvecs() );
		DenseMatrix64F srcMtx = rotationCenteredMtx(srcR, srcMom.centroid());
		
		DenseMatrix64F tgtR = new DenseMatrix64F( ndims, ndims );
		tgtR.setData( tgtMom.getEvecs() );
		DenseMatrix64F tgtMtx = rotationCenteredMtx(tgtR, tgtMom.centroid());
		
		DenseMatrix64F res =  new DenseMatrix64F( ndims+1, ndims+1 );
//		CommonOps.invert(srcMtx);
//		CommonOps.mult( tgtMtx, srcMtx, res );
		
		CommonOps.invert(tgtMtx);
		CommonOps.mult( srcMtx, tgtMtx, res );
		
		return toAffineTransform(res);
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:37,代码来源:TransformTools.java


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