Search in sources :

Example 1 with BorderType

use of boofcv.struct.border.BorderType 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)

Example 2 with BorderType

use of boofcv.struct.border.BorderType in project BoofCV by lessthanoptimal.

the class TestFactoryWaveletDaub method transform_biorthogonal_I32.

@Test
void transform_biorthogonal_I32() {
    for (BorderType type : borderTypes) {
        for (int i = 5; i <= 5; i += 2) {
            WaveletDescription<WlCoef_I32> desc = FactoryWaveletDaub.biorthogonal_I32(i, type);
            checkEncodeDecode_I32(desc);
        }
    }
}
Also used : WlCoef_I32(boofcv.struct.wavelet.WlCoef_I32) BorderType(boofcv.struct.border.BorderType) Test(org.junit.jupiter.api.Test)

Example 3 with BorderType

use of boofcv.struct.border.BorderType in project BoofCV by lessthanoptimal.

the class TestFactoryWaveletDaub method biorthogonal_F32_inverse.

@Test
void biorthogonal_F32_inverse() {
    for (BorderType type : borderTypes) {
        for (int i = 5; i <= 5; i += 2) {
            WaveletDescription<WlCoef_F32> desc = FactoryWaveletDaub.biorthogonal_F32(i, type);
            checkBiorthogonal_F32(desc);
        }
    }
}
Also used : WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32) BorderType(boofcv.struct.border.BorderType) Test(org.junit.jupiter.api.Test)

Example 4 with BorderType

use of boofcv.struct.border.BorderType in project BoofCV by lessthanoptimal.

the class PermuteWaveletCompare method runTest.

private void runTest(int widthIn, int heightIn, int widthOut, int heightOut, boolean swapSize) {
    if (swapSize) {
        int t = widthIn;
        widthIn = widthOut;
        widthOut = t;
        t = heightIn;
        heightIn = heightOut;
        heightOut = t;
    }
    ImageGray input = GeneralizedImageOps.createSingleBand(inputType, widthIn, heightIn);
    ImageGray found = GeneralizedImageOps.createSingleBand(outputType, widthOut, heightOut);
    ImageGray expected = GeneralizedImageOps.createSingleBand(outputType, widthOut, heightOut);
    GImageMiscOps.fillUniform(input, rand, 0, 50);
    // test different descriptions lengths and offsets, and borders
    for (BorderType type : BorderType.values()) {
        for (int o = 0; o <= 2; o++) {
            for (int l = 2 + o; l <= 5; l++) {
                // System.out.println("type "+type+" o = "+o+" l = "+l);
                GImageMiscOps.fill(found, 0);
                GImageMiscOps.fill(expected, 0);
                // create a random wavelet. does not have to be a real once
                // since it just is checking that two functions produce the same output
                WaveletDescription<?> desc = createDesc(-o, l, type);
                applyValidation(desc, input, expected);
                // make sure it works on sub-images
                BoofTesting.checkSubImage(this, "innerTest", false, input, found, expected, desc);
            }
        }
    }
}
Also used : ImageGray(boofcv.struct.image.ImageGray) BorderType(boofcv.struct.border.BorderType)

Example 5 with BorderType

use of boofcv.struct.border.BorderType in project BoofCV by lessthanoptimal.

the class TestFactoryWaveletDaub method transform_biorthogonal_F32.

@Test
void transform_biorthogonal_F32() {
    for (BorderType type : borderTypes) {
        for (int i = 5; i <= 5; i += 2) {
            WaveletDescription<WlCoef_F32> desc = FactoryWaveletDaub.biorthogonal_F32(i, type);
            checkEncodeDecode_F32(desc);
        }
    }
}
Also used : WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32) BorderType(boofcv.struct.border.BorderType) Test(org.junit.jupiter.api.Test)

Aggregations

BorderType (boofcv.struct.border.BorderType)7 Test (org.junit.jupiter.api.Test)5 WlCoef_F32 (boofcv.struct.wavelet.WlCoef_F32)2 WlCoef_I32 (boofcv.struct.wavelet.WlCoef_I32)2 ImplBilinearPixel_U8 (boofcv.alg.interpolate.impl.ImplBilinearPixel_U8)1 CameraPinhole (boofcv.struct.calib.CameraPinhole)1 CameraPinholeBrown (boofcv.struct.calib.CameraPinholeBrown)1 GrayF32 (boofcv.struct.image.GrayF32)1 GrayU8 (boofcv.struct.image.GrayU8)1 ImageGray (boofcv.struct.image.ImageGray)1 Function (deepboof.Function)1 ParseBinaryTorch7 (deepboof.io.torch7.ParseBinaryTorch7)1 Tensor_F32 (deepboof.tensors.Tensor_F32)1 File (java.io.File)1