Search in sources :

Example 1 with WlCoef_F32

use of boofcv.struct.wavelet.WlCoef_F32 in project BoofCV by lessthanoptimal.

the class TestFactoryWaveletCoiflet method generate_F32.

/**
 * Sees if the standard CoifI wavelets have the expected characteristics
 */
@Test
public void generate_F32() {
    for (int i = 6; i <= 6; i += 2) {
        WaveletDescription<WlCoef_F32> desc = FactoryWaveletCoiflet.generate_F32(i);
        WlCoef_F32 coef = desc.forward;
        double sumScaling = UtilWavelet.sumCoefficients(coef.scaling);
        double sumWavelet = UtilWavelet.sumCoefficients(coef.wavelet);
        assertEquals(Math.sqrt(2), sumScaling, 1e-4);
        assertEquals(0, sumWavelet, 1e-4);
        double energyScaling = UtilWavelet.computeEnergy(coef.scaling);
        double energyWavelet = UtilWavelet.computeEnergy(coef.wavelet);
        assertEquals(1, energyScaling, 1e-4);
        assertEquals(1, energyWavelet, 1e-4);
        int polyOrder = i / 2 - 1;
        checkPolySumToZero(coef.scaling, polyOrder, -2);
        checkPolySumToZero(coef.wavelet, polyOrder - 1, 0);
        checkBiorthogonal_F32(desc);
    }
}
Also used : WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32) Test(org.junit.Test)

Example 2 with WlCoef_F32

use of boofcv.struct.wavelet.WlCoef_F32 in project BoofCV by lessthanoptimal.

the class TestFactoryWaveletDaub method daubJ_F32_forward.

/**
 * Sees if the standard DaubJ wavelets have the expected characteristics
 */
@Test
public void daubJ_F32_forward() {
    for (int i = 4; i <= 4; i += 2) {
        // test forward coefficients for the expected properties
        WaveletDescription<WlCoef_F32> desc = FactoryWaveletDaub.daubJ_F32(i);
        WlCoef_F32 forwardCoef = desc.forward;
        double sumScaling = UtilWavelet.sumCoefficients(forwardCoef.scaling);
        double sumWavelet = UtilWavelet.sumCoefficients(forwardCoef.wavelet);
        assertEquals(Math.sqrt(2), sumScaling, 1e-4);
        assertEquals(0, sumWavelet, 1e-4);
        double energyScaling = UtilWavelet.computeEnergy(forwardCoef.scaling);
        double energyWavelet = UtilWavelet.computeEnergy(forwardCoef.wavelet);
        assertEquals(1, energyScaling, 1e-4);
        assertEquals(1, energyWavelet, 1e-4);
        int polyOrder = i / 2 - 1;
        checkPolySumToZero(forwardCoef.wavelet, polyOrder, 0);
        // should coefficients should be orthogonal
        checkBiorthogonal_F32(desc);
    }
}
Also used : WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32) Test(org.junit.Test)

Example 3 with WlCoef_F32

use of boofcv.struct.wavelet.WlCoef_F32 in project BoofCV by lessthanoptimal.

the class TestFactoryWaveletDaub method biorthogonal_F32_inverse.

@Test
public 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.core.image.border.BorderType) Test(org.junit.Test)

Example 4 with WlCoef_F32

use of boofcv.struct.wavelet.WlCoef_F32 in project BoofCV by lessthanoptimal.

the class TestFactoryWaveletDaub method biorthogonal_F32_forward.

@Test
public void biorthogonal_F32_forward() {
    for (int i = 5; i <= 5; i += 2) {
        WlCoef_F32 forward = FactoryWaveletDaub.biorthogonal_F32(i, borderDefault).getForward();
        double sumScaling = UtilWavelet.sumCoefficients(forward.scaling);
        double sumWavelet = UtilWavelet.sumCoefficients(forward.wavelet);
        assertEquals(1, sumScaling, 1e-4);
        assertEquals(0, sumWavelet, 1e-4);
        double energyScaling = UtilWavelet.computeEnergy(forward.scaling);
        double energyWavelet = UtilWavelet.computeEnergy(forward.wavelet);
        assertTrue(Math.abs(1 - energyScaling) > 1e-4);
        assertTrue(Math.abs(1 - energyWavelet) > 1e-4);
        int polyOrder = i / 2 - 1;
        checkPolySumToZero(forward.wavelet, polyOrder, -1);
        checkPolySumToZero(forward.scaling, polyOrder, -2);
    }
}
Also used : WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32) Test(org.junit.Test)

Example 5 with WlCoef_F32

use of boofcv.struct.wavelet.WlCoef_F32 in project BoofCV by lessthanoptimal.

the class TestFactoryWaveletHaar method checkProperties_F32.

@Test
public void checkProperties_F32() {
    WaveletDescription<WlCoef_F32> desc = FactoryWaveletHaar.generate(false, 32);
    WlCoef_F32 coef = desc.getForward();
    double energyScaling = UtilWavelet.computeEnergy(coef.scaling);
    double energyWavelet = UtilWavelet.computeEnergy(coef.wavelet);
    assertEquals(1, energyScaling, 1e-4);
    assertEquals(1, energyWavelet, 1e-4);
    double sumWavelet = UtilWavelet.sumCoefficients(coef.wavelet);
    assertEquals(0, sumWavelet, 1e-4);
    checkBiorthogonal_F32(desc);
}
Also used : WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32) Test(org.junit.Test)

Aggregations

WlCoef_F32 (boofcv.struct.wavelet.WlCoef_F32)18 Test (org.junit.Test)7 BorderType (boofcv.core.image.border.BorderType)2 WlCoef (boofcv.struct.wavelet.WlCoef)2 WaveletTransform (boofcv.abst.transform.wavelet.WaveletTransform)1 BorderIndex1D (boofcv.core.image.border.BorderIndex1D)1 BorderIndex1D_Wrap (boofcv.core.image.border.BorderIndex1D_Wrap)1 FactoryWaveletTransform (boofcv.factory.transform.wavelet.FactoryWaveletTransform)1 GrayF32 (boofcv.struct.image.GrayF32)1 ImageDimension (boofcv.struct.image.ImageDimension)1 WaveletDescription (boofcv.struct.wavelet.WaveletDescription)1 WlBorderCoefStandard (boofcv.struct.wavelet.WlBorderCoefStandard)1 WlCoef_I32 (boofcv.struct.wavelet.WlCoef_I32)1 DMatrixRMaj (org.ejml.data.DMatrixRMaj)1