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);
}
}
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);
}
}
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);
}
}
}
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);
}
}
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);
}
Aggregations