Search in sources :

Example 11 with WlCoef_F32

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

the class TestFactoryWaveletDaub method transform_biorthogonal_F32.

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

Example 12 with WlCoef_F32

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

the class TestUtilWavelet method checkForwardLower.

private void checkForwardLower(int offsetA, int offsetB, int expected) {
    WlCoef_F32 desc = new WlCoef_F32();
    desc.offsetScaling = offsetA;
    desc.offsetWavelet = offsetB;
    assertEquals(expected, UtilWavelet.borderForwardLower(desc));
}
Also used : WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32)

Example 13 with WlCoef_F32

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

the class TestUtilWavelet method checkForwardUpper.

private void checkForwardUpper(int offsetA, int offsetB, int lengthA, int lengthB, int dataLength, int expected) {
    WlCoef_F32 desc = new WlCoef_F32();
    desc.offsetScaling = offsetA;
    desc.offsetWavelet = offsetB;
    desc.scaling = new float[lengthA];
    desc.wavelet = new float[lengthB];
    assertEquals(expected, UtilWavelet.borderForwardUpper(desc, dataLength));
}
Also used : WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32)

Example 14 with WlCoef_F32

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

the class WaveletTransformOps method inverse1.

/**
 * <p>
 * Performs a single level inverse wavelet transform. Do not pass in a whole image which has been
 * transformed by a multilevel transform.  Just the relevant sub-image.
 * </p>
 *
 * @param desc Description of the inverse wavelet.
 * @param input Input wavelet transform. Not modified.
 * @param output Reconstruction of original image. Modified.
 * @param storage Optional storage image.  Should be the same size as the input image. If null then
 * an image is declared internally.
 * @param minValue Minimum allowed pixel value
 * @param maxValue Maximum allowed pixel value
 */
public static void inverse1(WaveletDescription<WlCoef_F32> desc, GrayF32 input, GrayF32 output, GrayF32 storage, float minValue, float maxValue) {
    UtilWavelet.checkShape(output, input);
    WlCoef_F32 coef = desc.getForward();
    if (output.width < coef.scaling.length || output.width < coef.wavelet.length)
        throw new IllegalArgumentException("Wavelet is too large for provided image.");
    if (output.height < coef.scaling.length || output.height < coef.wavelet.length)
        throw new IllegalArgumentException("Wavelet is too large for provided image.");
    storage = InputSanityCheck.checkDeclare(input, storage);
    // the faster routines can only be run on images which are not too small
    int minSize = Math.max(coef.getScalingLength(), coef.getWaveletLength()) * 3;
    if (output.getWidth() <= minSize || output.getHeight() <= minSize) {
        ImplWaveletTransformNaive.verticalInverse(desc.getBorder(), desc.getInverse(), input, storage);
        ImplWaveletTransformNaive.horizontalInverse(desc.getBorder(), desc.getInverse(), storage, output);
    } else {
        ImplWaveletTransformInner.verticalInverse(desc.getInverse().getInnerCoefficients(), input, storage);
        ImplWaveletTransformBorder.verticalInverse(desc.getBorder(), desc.getInverse(), input, storage);
        ImplWaveletTransformInner.horizontalInverse(desc.getInverse().getInnerCoefficients(), storage, output);
        ImplWaveletTransformBorder.horizontalInverse(desc.getBorder(), desc.getInverse(), storage, output);
    }
    if (minValue != -Float.MAX_VALUE && maxValue != Float.MAX_VALUE)
        PixelMath.boundImage(output, minValue, maxValue);
}
Also used : WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32)

Example 15 with WlCoef_F32

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

the class WaveletTransformOps method transform1.

/**
 * <p>
 * Performs a single level wavelet transform.
 * </p>
 *
 * @param desc Description of the wavelet.
 * @param input Input image. Not modified.
 * @param output Where the wavelet transform is written to. Modified.
 * @param storage Optional storage image.  Should be the same size as output image. If null then
 * an image is declared internally.
 */
public static void transform1(WaveletDescription<WlCoef_F32> desc, GrayF32 input, GrayF32 output, GrayF32 storage) {
    UtilWavelet.checkShape(input, output);
    WlCoef_F32 coef = desc.getForward();
    if (output.width < coef.scaling.length || output.width < coef.wavelet.length)
        throw new IllegalArgumentException("Wavelet is too large for provided image.");
    if (output.height < coef.scaling.length || output.height < coef.wavelet.length)
        throw new IllegalArgumentException("Wavelet is too large for provided image.");
    storage = InputSanityCheck.checkDeclare(output, storage);
    // the faster routines can only be run on images which are not too small
    int minSize = Math.max(coef.getScalingLength(), coef.getWaveletLength()) * 3;
    if (input.getWidth() <= minSize || input.getHeight() <= minSize) {
        ImplWaveletTransformNaive.horizontal(desc.getBorder(), coef, input, storage);
        ImplWaveletTransformNaive.vertical(desc.getBorder(), coef, storage, output);
    } else {
        ImplWaveletTransformInner.horizontal(coef, input, storage);
        ImplWaveletTransformBorder.horizontal(desc.getBorder(), coef, input, storage);
        ImplWaveletTransformInner.vertical(coef, storage, output);
        ImplWaveletTransformBorder.vertical(desc.getBorder(), coef, storage, output);
    }
}
Also used : WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32)

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