本文整理汇总了Java中org.openimaj.math.geometry.point.Point2d.transform方法的典型用法代码示例。如果您正苦于以下问题:Java Point2d.transform方法的具体用法?Java Point2d.transform怎么用?Java Point2d.transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openimaj.math.geometry.point.Point2d
的用法示例。
在下文中一共展示了Point2d.transform方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeResidual
import org.openimaj.math.geometry.point.Point2d; //导入方法依赖的package包/类
@Override
public double computeResidual(IndependentPair<Point2d, Point2d> data) {
final Point2d p1 = data.getFirstObject();
final Point2d p2 = data.getSecondObject();
final Point2d p1t = p1.transform(transform);
final Point2d p2t = p2.transform(transformInv);
final float p1x = p1.getX();
final float p1y = p1.getY();
final float p1tx = p1t.getX();
final float p1ty = p1t.getY();
final float p2x = p2.getX();
final float p2y = p2.getY();
final float p2tx = p2t.getX();
final float p2ty = p2t.getY();
final float dx12t = (p1x - p2tx);
final float dy12t = (p1y - p2ty);
final float dx1t2 = (p1tx - p2x);
final float dy1t2 = (p1ty - p2y);
return dx12t * dx12t + dy12t * dy12t + dx1t2 * dx1t2 + dy1t2 * dy1t2;
}
示例2: transformWithNoise
import org.openimaj.math.geometry.point.Point2d; //导入方法依赖的package包/类
private static List<Point2d> transformWithNoise(List<Point2d> correctPoints,
Matrix correctH)
{
final List<Point2d> pts = new ArrayList<Point2d>();
final Random rng = new Random(0);
for (final Point2d correct : correctPoints) {
final Point2dImpl pt = (Point2dImpl) correct.transform(correctH);
pt.x += rng.nextGaussian();
pt.y += rng.nextGaussian();
pts.add(pt);
}
return pts;
}
示例3: calculatePosition
import org.openimaj.math.geometry.point.Point2d; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* @see org.openimaj.vis.DataUnitsTransformer#calculatePosition(java.lang.Object)
*/
@Override
public double[] calculatePosition( final Double units )
{
if( this.transform == null ) this.precalc();
final Point2d p = new Point2dImpl( units.floatValue(), 0f );
final Point2d p2 = p.transform( this.transform );
return new double[] {p2.getX(), p2.getY()};
}
示例4: calculateUnitsAt
import org.openimaj.math.geometry.point.Point2d; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* @see org.openimaj.vis.DataUnitsTransformer#calculateUnitsAt(java.lang.Object)
*/
@Override
public Double calculateUnitsAt( final double[] position )
{
if( this.transform == null ) this.precalc( );
final Point2d p = new Point2dImpl( (float)position[0], (float)position[1] );
final Point2d p2 = p.transform( this.transform.inverse() );
return new Double(p2.getX());
}
示例5: project
import org.openimaj.math.geometry.point.Point2d; //导入方法依赖的package包/类
/**
* Project a 2d point (technically a 3d point on the z=0 world plane)
*
* @param pt
* the point to project in world coordinates
* @return the image coordinates
*/
public Point2d project(Point2d pt) {
final Matrix H = this.computeHomography();
final Point2d p = pt.transform(H);
return intrinsicParameters.applyDistortion(p);
}
示例6: estimateRadialDistortion
import org.openimaj.math.geometry.point.Point2d; //导入方法依赖的package包/类
/**
* Produce an initial estimate of the radial distortion parameters, and
* update the intrinsics
*/
protected void estimateRadialDistortion()
{
final CameraIntrinsics ci = cameras.get(0).intrinsicParameters;
int totalPoints = 0;
for (int i = 0; i < points.size(); i++)
totalPoints += points.get(i).size();
final Matrix D = new Matrix(2 * totalPoints, 2);
final Matrix d = new Matrix(2 * totalPoints, 1);
for (int i = 0, k = 0; i < points.size(); i++) {
final List<? extends IndependentPair<? extends Point2d, ? extends Point2d>> pointPairs = points.get(i);
final Matrix idealH = cameras.get(i).computeHomography();
for (int j = 0; j < pointPairs.size(); j++, k++) {
// model point
final Point2d XY = pointPairs.get(j).firstObject();
// transformed ideal point
final Point2d uv = XY.transform(idealH);
// observed point
final Point2d ipt = pointPairs.get(j).secondObject();
d.set(k * 2 + 0, 0, ipt.getX() - uv.getX());
d.set(k * 2 + 1, 0, ipt.getY() - uv.getY());
final double tmp1 = uv.getX() - ci.getPrincipalPointX(); // u-u0
final double tmp2 = uv.getY() - ci.getPrincipalPointY(); // v-v0
final double x = tmp1 / ci.getFocalLengthX(); // (u-u0)/fx
final double y = tmp2 / ci.getFocalLengthY(); // (v-v0)/fy
final double r2 = x * x + y * y;
final double r4 = r2 * r2;
D.set(k * 2 + 0, 0, tmp1 * r2);
D.set(k * 2 + 0, 1, tmp1 * r4);
D.set(k * 2 + 1, 0, tmp2 * r2);
D.set(k * 2 + 1, 1, tmp2 * r4);
}
}
final Matrix result = D.solve(d);
ci.k1 = result.get(0, 0);
ci.k2 = result.get(1, 0);
ci.k3 = 0;
}
示例7: predict
import org.openimaj.math.geometry.point.Point2d; //导入方法依赖的package包/类
@Override
public Point2d predict(Point2d p) {
return p.transform(transform);
}
示例8: predict
import org.openimaj.math.geometry.point.Point2d; //导入方法依赖的package包/类
@Override
public Point2d predict(Point2d data) {
return data.transform(homography);
}