Search in sources :

Example 1 with ImageDataType

use of boofcv.struct.image.ImageDataType in project BoofCV by lessthanoptimal.

the class FactoryImageDenoise method waveletVisu.

/**
 * Denoises an image using VISU Shrink wavelet denoiser.
 *
 * @param imageType The type of image being transform.
 * @param numLevels Number of levels in the wavelet transform.  If not sure, try using 3.
 * @param minPixelValue Minimum allowed pixel intensity value
 * @param maxPixelValue Maximum allowed pixel intensity value
 * @return filter for image noise removal.
 */
public static <T extends ImageGray<T>> WaveletDenoiseFilter<T> waveletVisu(Class<T> imageType, int numLevels, double minPixelValue, double maxPixelValue) {
    ImageDataType info = ImageDataType.classToType(imageType);
    WaveletTransform descTran = createDefaultShrinkTransform(info, numLevels, minPixelValue, maxPixelValue);
    DenoiseWavelet denoiser = FactoryDenoiseWaveletAlg.visu(imageType);
    return new WaveletDenoiseFilter<>(descTran, denoiser);
}
Also used : DenoiseWavelet(boofcv.alg.denoise.DenoiseWavelet) FactoryWaveletTransform(boofcv.factory.transform.wavelet.FactoryWaveletTransform) WaveletTransform(boofcv.abst.transform.wavelet.WaveletTransform) ImageDataType(boofcv.struct.image.ImageDataType)

Example 2 with ImageDataType

use of boofcv.struct.image.ImageDataType in project BoofCV by lessthanoptimal.

the class FactoryImageDenoise method waveletBayes.

/**
 * Denoises an image using BayesShrink wavelet denoiser.
 *
 * @param imageType The type of image being transform.
 * @param numLevels Number of levels in the wavelet transform.  If not sure, try using 3.
 * @param minPixelValue Minimum allowed pixel intensity value
 * @param maxPixelValue Maximum allowed pixel intensity value
 * @return filter for image noise removal.
 */
public static <T extends ImageGray<T>> WaveletDenoiseFilter<T> waveletBayes(Class<T> imageType, int numLevels, double minPixelValue, double maxPixelValue) {
    ImageDataType info = ImageDataType.classToType(imageType);
    WaveletTransform descTran = createDefaultShrinkTransform(info, numLevels, minPixelValue, maxPixelValue);
    DenoiseWavelet denoiser = FactoryDenoiseWaveletAlg.bayes(null, imageType);
    return new WaveletDenoiseFilter<>(descTran, denoiser);
}
Also used : DenoiseWavelet(boofcv.alg.denoise.DenoiseWavelet) FactoryWaveletTransform(boofcv.factory.transform.wavelet.FactoryWaveletTransform) WaveletTransform(boofcv.abst.transform.wavelet.WaveletTransform) ImageDataType(boofcv.struct.image.ImageDataType)

Example 3 with ImageDataType

use of boofcv.struct.image.ImageDataType in project BoofCV by lessthanoptimal.

the class FactoryImageDenoise method waveletSure.

/**
 * Denoises an image using SureShrink wavelet denoiser.
 *
 * @param imageType The type of image being transform.
 * @param numLevels Number of levels in the wavelet transform.  If not sure, try using 3.
 * @param minPixelValue Minimum allowed pixel intensity value
 * @param maxPixelValue Maximum allowed pixel intensity value
 * @return filter for image noise removal.
 */
public static <T extends ImageGray<T>> WaveletDenoiseFilter<T> waveletSure(Class<T> imageType, int numLevels, double minPixelValue, double maxPixelValue) {
    ImageDataType info = ImageDataType.classToType(imageType);
    WaveletTransform descTran = createDefaultShrinkTransform(info, numLevels, minPixelValue, maxPixelValue);
    DenoiseWavelet denoiser = FactoryDenoiseWaveletAlg.sure(imageType);
    return new WaveletDenoiseFilter<>(descTran, denoiser);
}
Also used : DenoiseWavelet(boofcv.alg.denoise.DenoiseWavelet) FactoryWaveletTransform(boofcv.factory.transform.wavelet.FactoryWaveletTransform) WaveletTransform(boofcv.abst.transform.wavelet.WaveletTransform) ImageDataType(boofcv.struct.image.ImageDataType)

Example 4 with ImageDataType

use of boofcv.struct.image.ImageDataType in project BoofCV by lessthanoptimal.

the class GeneralChecksInterpolationPixelMB method compareToSingleBand.

/**
 * Compares interpolation to two single band images and sees if they produce nearly identical results
 */
@Test
public void compareToSingleBand() {
    T origMB = createImage(30, 40, 2);
    GImageMiscOps.fillUniform(origMB, rand, 0, 100);
    ImageDataType dataType = origMB.getImageType().getDataType();
    ImageGray band0 = GeneralizedImageOps.createSingleBand(dataType, origMB.width, origMB.height);
    ImageGray band1 = GeneralizedImageOps.createSingleBand(dataType, origMB.width, origMB.height);
    for (int y = 0; y < origMB.height; y++) {
        for (int x = 0; x < origMB.width; x++) {
            double val0 = GeneralizedImageOps.get(origMB, x, y, 0);
            double val1 = GeneralizedImageOps.get(origMB, x, y, 1);
            GeneralizedImageOps.set(band0, x, y, val0);
            GeneralizedImageOps.set(band1, x, y, val1);
        }
    }
    InterpolatePixelS interpBand0 = wrapSingle(band0, 0, 255);
    InterpolatePixelS interpBand1 = wrapSingle(band1, 0, 255);
    InterpolatePixelMB<T> interpMB = wrap(origMB, 0, 255);
    interpBand0.setBorder(FactoryImageBorder.genericValue(0, band0.getImageType()));
    interpBand1.setBorder(FactoryImageBorder.genericValue(0, band1.getImageType()));
    interpMB.setBorder(FactoryImageBorder.genericValue(0, interpMB.getImageType()));
    interpBand0.setImage(band0);
    interpBand1.setImage(band1);
    interpMB.setImage(origMB);
    float[] values = new float[2];
    for (int y = 0; y < origMB.height - 1; y++) {
        for (int x = 0; x < origMB.width - 1; x++) {
            float val0 = interpBand0.get(x + 0.2f, y + 0.3f);
            float val1 = interpBand1.get(x + 0.2f, y + 0.3f);
            interpMB.get(x + 0.2f, y + 0.3f, values);
            assertEquals(val0, values[0], 1e-4f);
            assertEquals(val1, values[1], 1e-4f);
        }
    }
}
Also used : InterpolatePixelS(boofcv.alg.interpolate.InterpolatePixelS) ImageGray(boofcv.struct.image.ImageGray) ImageDataType(boofcv.struct.image.ImageDataType) Test(org.junit.Test)

Aggregations

ImageDataType (boofcv.struct.image.ImageDataType)4 WaveletTransform (boofcv.abst.transform.wavelet.WaveletTransform)3 DenoiseWavelet (boofcv.alg.denoise.DenoiseWavelet)3 FactoryWaveletTransform (boofcv.factory.transform.wavelet.FactoryWaveletTransform)3 InterpolatePixelS (boofcv.alg.interpolate.InterpolatePixelS)1 ImageGray (boofcv.struct.image.ImageGray)1 Test (org.junit.Test)1