Search in sources :

Example 1 with ImplBilinearPixel_U8

use of boofcv.alg.interpolate.impl.ImplBilinearPixel_U8 in project BoofCV by lessthanoptimal.

the class TestLensDistortionOps method changeCameraModel.

/**
 * This is a bit hard to test accurately. That would require computing distorted image and seeing everything lines
 * up properly. For now we just check tos ee if things blow up.
 */
@Test
void changeCameraModel() {
    CameraPinholeBrown original = new CameraPinholeBrown(200, 200, 0, 200, 200, 400, 400);
    CameraPinhole desired = new CameraPinholeBrown(300, 300, 0, 200, 200, 400, 400);
    CameraPinhole modified = new CameraPinhole();
    BorderType[] borders = new BorderType[] { BorderType.EXTENDED, BorderType.SKIP, BorderType.ZERO, BorderType.REFLECT, BorderType.WRAP };
    for (AdjustmentType adj : AdjustmentType.values()) {
        for (BorderType border : borders) {
            ImageDistort<GrayU8, GrayU8> alg = LensDistortionOps.changeCameraModel(adj, border, original, desired, modified, ImageType.single(GrayU8.class));
            // do a few more tests to see of dubious value. if the underlying implementation changes
            // this test will need to be updated
            assertTrue(alg instanceof ImageDistortCache_SB);
            ImageDistortCache_SB _alg = (ImageDistortCache_SB) alg;
            assertTrue(_alg.interp instanceof ImplBilinearPixel_U8);
        }
    }
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) GrayU8(boofcv.struct.image.GrayU8) CameraPinhole(boofcv.struct.calib.CameraPinhole) BorderType(boofcv.struct.border.BorderType) ImplBilinearPixel_U8(boofcv.alg.interpolate.impl.ImplBilinearPixel_U8) Test(org.junit.jupiter.api.Test)

Aggregations

ImplBilinearPixel_U8 (boofcv.alg.interpolate.impl.ImplBilinearPixel_U8)1 BorderType (boofcv.struct.border.BorderType)1 CameraPinhole (boofcv.struct.calib.CameraPinhole)1 CameraPinholeBrown (boofcv.struct.calib.CameraPinholeBrown)1 GrayU8 (boofcv.struct.image.GrayU8)1 Test (org.junit.jupiter.api.Test)1