本文整理汇总了Java中org.ejml.ops.SpecializedOps类的典型用法代码示例。如果您正苦于以下问题:Java SpecializedOps类的具体用法?Java SpecializedOps怎么用?Java SpecializedOps使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpecializedOps类属于org.ejml.ops包,在下文中一共展示了SpecializedOps类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeH
import org.ejml.ops.SpecializedOps; //导入依赖的package包/类
/**
* Computes the SVD of A and extracts the homography matrix from its null space
*/
protected boolean computeH(DenseMatrix64F A, DenseMatrix64F H) {
if( !svd.decompose(A) )
return true;
if( A.numRows > 8 )
SingularOps.nullVector(svd,true,H);
else {
// handle a special case since the matrix only has 8 singular values and won't select
// the correct column
DenseMatrix64F V = svd.getV(null,false);
SpecializedOps.subvector(V, 0, 8, V.numCols, false, 0, H);
}
return false;
}
示例2: process
import org.ejml.ops.SpecializedOps; //导入依赖的package包/类
/**
* Computes the SVD of A and extracts the essential/fundamental matrix from its null space
*/
protected boolean process(DenseMatrix64F A, DenseMatrix64F F ) {
if( !svdNull.decompose(A) )
return true;
if( A.numRows > 8 )
SingularOps.nullVector(svdNull,true,F);
else {
// handle a special case since the matrix only has 8 singular values and won't select
// the correct column
DenseMatrix64F V = svdNull.getV(null,false);
SpecializedOps.subvector(V, 0, 8, V.numCols, false, 0, F);
}
return false;
}
示例3: extractVector
import org.ejml.ops.SpecializedOps; //导入依赖的package包/类
/**
* See {@link org.ejml.simple.SimpleBase#extractVector(boolean extractRow, int element)}
*/
public NinjaMatrix extractVector(boolean extractRow, int element) {
int length = extractRow ? numCols() : numRows();
NinjaMatrix result = extractRow ? new NinjaMatrix(1, length) : new NinjaMatrix(length, 1);
if (extractRow) {
SpecializedOps.subvector(this.data, element, 0, length, true, 0, result.data);
} else {
SpecializedOps.subvector(this.data, 0, element, length, false, 0, result.data);
}
return result;
}
示例4: decompose
import org.ejml.ops.SpecializedOps; //导入依赖的package包/类
/**
* Compute the rigid body motion that composes the homography matrix H. It is assumed
* that H was computed using {@link Zhang99ComputeTargetHomography}.
*
* @param H homography matrix.
* @return Found camera motion.
*/
public Se3_F64 decompose( DenseMatrix64F H )
{
// step through each calibration grid and compute its parameters
DenseMatrix64F h[] = SpecializedOps.splitIntoVectors(H, true);
// lambda = 1/norm(inv(K)*h1) or 1/norm(inv(K)*h2)
// use the average to attempt to reduce error
CommonOps.mult(K_inv,h[0],temp);
double lambda = NormOps.normF(temp);
CommonOps.mult(K_inv,h[1],temp);
lambda += NormOps.normF(temp);
lambda = 2.0/lambda;
// compute the column in the rotation matrix
CommonOps.mult(lambda,K_inv,h[0],r1);
CommonOps.mult(lambda,K_inv,h[1],r2);
CommonOps.mult(lambda,K_inv,h[2],t);
Vector3D_F64 v1 = UtilVector3D_F64.convert(r1);
Vector3D_F64 v2 = UtilVector3D_F64.convert(r2);
Vector3D_F64 v3 = v1.cross(v2);
UtilVector3D_F64.createMatrix(R, v1, v2, v3);
Se3_F64 ret = new Se3_F64();
// the R matrix is probably not a real rotation matrix. So find
// the closest real rotation matrix
RotationMatrixGenerator.approximateRotationMatrix(R,ret.getR());
ret.getT().set(t.data[0],t.data[1],t.data[2]);
return ret;
}
示例5: process
import org.ejml.ops.SpecializedOps; //导入依赖的package包/类
/**
* Given a set of homographies computed from a sequence of images that observe the same
* plane it estimates the camera's calibration.
*
* @param homographies Homographies computed from observations of the calibration grid.
*/
public void process( List<DenseMatrix64F> homographies ) {
if( assumeZeroSkew ) {
if( homographies.size() < 2 )
throw new IllegalArgumentException("At least two homographies are required");
} else if( homographies.size() < 3 ) {
throw new IllegalArgumentException("At least three homographies are required");
}
if( assumeZeroSkew ) {
setupA_NoSkew(homographies);
if( !svd.decompose(A) )
throw new RuntimeException("SVD failed");
if( homographies.size() == 2 ) {
DenseMatrix64F V = svd.getV(null,false);
SpecializedOps.subvector(V, 0, 4, V.numRows, false, 0, b);
} else {
SingularOps.nullVector(svd,true,b);
}
computeParam_ZeroSkew();
} else {
setupA(homographies);
if( !svd.decompose(A) )
throw new RuntimeException("SVD failed");
SingularOps.nullVector(svd,true,b);
computeParam();
}
}
示例6: process
import org.ejml.ops.SpecializedOps; //导入依赖的package包/类
/**
* Computes the SVD of A and extracts the essential/fundamental matrix from its null space
*/
private boolean process(DenseMatrix64F A) {
if( !svdNull.decompose(A) )
return false;
// extract the two singular vectors
// no need to sort by singular values because the two automatic null spaces are being sampled
svdNull.getV(V,false);
SpecializedOps.subvector(V, 0, 7, 9, false, 0, F1);
SpecializedOps.subvector(V, 0, 8, 9, false, 0, F2);
return true;
}
示例7: normalizeScale
import org.ejml.ops.SpecializedOps; //导入依赖的package包/类
/**
* The scale of the trifocal tensor is arbitrary. However there are situations when comparing results that
* using a consistent scale is useful. This function normalizes the sensor such that its Euclidean length
* (the f-norm) is equal to one.
*/
public void normalizeScale() {
double sum = 0;
sum += SpecializedOps.elementSumSq(T1);
sum += SpecializedOps.elementSumSq(T2);
sum += SpecializedOps.elementSumSq(T3);
double n = Math.sqrt(sum);
CommonOps.scale(1.0/n,T1);
CommonOps.scale(1.0/n,T2);
CommonOps.scale(1.0/n,T3);
}