use of georegression.struct.homography.Homography2D_F64 in project BoofCV by lessthanoptimal.
the class TestPixelTransformHomography_F32 method constructor_64.
@Test
public void constructor_64() {
Homography2D_F64 a = new Homography2D_F64(1, 2, 3, 4, 5, 6, 7, 8, 9);
PixelTransformHomography_F32 alg = new PixelTransformHomography_F32();
alg.set(a);
alg.compute(2, 3);
Point2D_F64 p = new Point2D_F64(2, 3);
Point2D_F64 expected = new Point2D_F64();
HomographyPointOps_F64.transform(a, p, expected);
assertEquals(expected.x, alg.distX, 1e-4);
assertEquals(expected.y, alg.distY, 1e-4);
}
use of georegression.struct.homography.Homography2D_F64 in project BoofCV by lessthanoptimal.
the class UtilImageMotion method createPixelTransform.
/**
* Given a motion model create a PixelTransform used to distort the image
*
* @param transform Motion transform
* @return PixelTransform_F32 used to distort the image
*/
public static PixelTransform2_F32 createPixelTransform(InvertibleTransform transform) {
PixelTransform2_F32 pixelTran;
if (transform instanceof Homography2D_F64) {
Homography2D_F32 t = ConvertFloatType.convert((Homography2D_F64) transform, null);
pixelTran = new PixelTransformHomography_F32(t);
} else if (transform instanceof Homography2D_F32) {
pixelTran = new PixelTransformHomography_F32((Homography2D_F32) transform);
} else if (transform instanceof Affine2D_F64) {
Affine2D_F32 t = UtilAffine.convert((Affine2D_F64) transform, null);
pixelTran = new PixelTransformAffine_F32(t);
} else if (transform instanceof Affine2D_F32) {
pixelTran = new PixelTransformAffine_F32((Affine2D_F32) transform);
} else {
throw new RuntimeException("Unknown model type");
}
return pixelTran;
}
use of georegression.struct.homography.Homography2D_F64 in project BoofCV by lessthanoptimal.
the class FactoryStitchingTransform method createAffine_F64.
public static StitchingTransform<Affine2D_F64> createAffine_F64() {
return new StitchingTransform<Affine2D_F64>() {
Affine2D_F32 input_F32 = new Affine2D_F32();
@Override
public PixelTransform2_F32 convertPixel(Affine2D_F64 input, PixelTransform2_F32 output) {
ConvertFloatType.convert(input, input_F32);
if (output != null) {
((PixelTransformAffine_F32) output).set(input_F32);
} else {
PixelTransformAffine_F32 a = new PixelTransformAffine_F32();
a.set(input_F32);
output = a;
}
return output;
}
@Override
public Homography2D_F64 convertH(Affine2D_F64 input, Homography2D_F64 output) {
if (output == null)
output = new Homography2D_F64();
output.set(input.a11, input.a12, input.tx, input.a21, input.a22, input.ty, 0, 0, 1);
return output;
}
};
}
Aggregations