Search in sources :

Example 1 with WaveletDescription

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

the class WaveletVisualizeApp method setActiveAlgorithm.

@Override
public void setActiveAlgorithm(int indexFamily, String name, Object cookie) {
    if (image == null)
        return;
    WaveletDescription<C> desc = (WaveletDescription<C>) cookie;
    WaveletTransform<T, W, C> waveletTran = FactoryWaveletTransform.create((Class) image.getClass(), desc, numLevels, 0, 255);
    panel.reset();
    W imageWavelet = waveletTran.transform(image, null);
    waveletTran.invert(imageWavelet, imageInv);
    // adjust the values inside the wavelet transform to make it easier to see
    UtilWavelet.adjustForDisplay(imageWavelet, waveletTran.getLevels(), 255);
    BufferedImage buffWavelet = VisualizeImageData.grayMagnitude(imageWavelet, null, 255);
    BufferedImage buffInv = ConvertBufferedImage.convertTo(imageInv, null, true);
    panel.addImage(buffWavelet, "Transform");
    panel.addImage(buffInv, "Inverse");
}
Also used : WaveletDescription(boofcv.struct.wavelet.WaveletDescription) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage)

Example 2 with WaveletDescription

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

the class FactoryWaveletCoiflet method generate_F32.

/**
 * Creates a description of a Coiflet of order I wavelet.
 * @param I order of the wavelet.
 * @return Wavelet description.
 */
public static WaveletDescription<WlCoef_F32> generate_F32(int I) {
    if (I != 6) {
        throw new IllegalArgumentException("Only 6 is currently supported");
    }
    WlCoef_F32 coef = new WlCoef_F32();
    coef.offsetScaling = -2;
    coef.offsetWavelet = -2;
    coef.scaling = new float[6];
    coef.wavelet = new float[6];
    double sqrt7 = Math.sqrt(7);
    double div = 16.0 * Math.sqrt(2);
    coef.scaling[0] = (float) ((1.0 - sqrt7) / div);
    coef.scaling[1] = (float) ((5.0 + sqrt7) / div);
    coef.scaling[2] = (float) ((14.0 + 2.0 * sqrt7) / div);
    coef.scaling[3] = (float) ((14.0 - 2.0 * sqrt7) / div);
    coef.scaling[4] = (float) ((1.0 - sqrt7) / div);
    coef.scaling[5] = (float) ((-3.0 + sqrt7) / div);
    coef.wavelet[0] = coef.scaling[5];
    coef.wavelet[1] = -coef.scaling[4];
    coef.wavelet[2] = coef.scaling[3];
    coef.wavelet[3] = -coef.scaling[2];
    coef.wavelet[4] = coef.scaling[1];
    coef.wavelet[5] = -coef.scaling[0];
    WlBorderCoefStandard<WlCoef_F32> inverse = new WlBorderCoefStandard<>(coef);
    return new WaveletDescription<>(new BorderIndex1D_Wrap(), coef, inverse);
}
Also used : BorderIndex1D_Wrap(boofcv.core.image.border.BorderIndex1D_Wrap) WlCoef_F32(boofcv.struct.wavelet.WlCoef_F32) WaveletDescription(boofcv.struct.wavelet.WaveletDescription) WlBorderCoefStandard(boofcv.struct.wavelet.WlBorderCoefStandard)

Aggregations

WaveletDescription (boofcv.struct.wavelet.WaveletDescription)2 BorderIndex1D_Wrap (boofcv.core.image.border.BorderIndex1D_Wrap)1 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)1 WlBorderCoefStandard (boofcv.struct.wavelet.WlBorderCoefStandard)1 WlCoef_F32 (boofcv.struct.wavelet.WlCoef_F32)1 BufferedImage (java.awt.image.BufferedImage)1