Search in sources :

Example 1 with Kernel1D

use of boofcv.struct.convolve.Kernel1D in project BoofCV by lessthanoptimal.

the class GImageDerivativeOps method createAnyDerivatives.

/**
 * <p>
 * Convenience function for creating an instance of {@link boofcv.abst.filter.derivative.AnyImageDerivative}.
 * This class is an any way to compute any derivative of any order using the specified kernel.  It might
 * use more memory or be more expensive the specialized code but is easy to use.
 * </p>
 *
 * @param type Type of gradient to use
 * @param inputType Type of input image.
 * @param derivType Type of derivative image
 * @param <I> Image type.
 * @param <D> Image derivative type.
 * @return AnyImageDerivative
 */
public static <I extends ImageGray<I>, D extends ImageGray<D>> AnyImageDerivative<I, D> createAnyDerivatives(DerivativeType type, Class<I> inputType, Class<D> derivType) {
    boolean isInteger = !GeneralizedImageOps.isFloatingPoint(inputType);
    KernelBase kernel = lookupKernelX(type, isInteger);
    if (kernel instanceof Kernel1D)
        return new AnyImageDerivative<>((Kernel1D) kernel, inputType, derivType);
    else
        return new AnyImageDerivative<>((Kernel2D) kernel, inputType, derivType);
}
Also used : Kernel1D(boofcv.struct.convolve.Kernel1D) KernelBase(boofcv.struct.convolve.KernelBase) Kernel2D(boofcv.struct.convolve.Kernel2D)

Example 2 with Kernel1D

use of boofcv.struct.convolve.Kernel1D in project BoofCV by lessthanoptimal.

the class TestConvolveImageStandard_IL method horizontalDiv.

/**
 * Unit test for horizontal convolution with division.
 */
public void horizontalDiv(ImageInterleaved img, ImageInterleaved dest) {
    Kernel1D ker = FactoryKernel.createKernelForImage(kernelWidth, kernelRadius, 1, img.getDataType());
    // standard symmetric odd kernel shape
    ker = FactoryKernel.random(ker.getClass(), kernelWidth, kernelRadius, 0, maxKernelValue, rand);
    checkHorizontalDiv(ker, img, dest);
    // odd non-symmetric kernel shape
    ker = FactoryKernel.random(ker.getClass(), kernelWidth, 0, 0, maxKernelValue, rand);
    checkHorizontalDiv(ker, img, dest);
    // even non-symmetric kernel shape
    ker = FactoryKernel.random(ker.getClass(), 2, 1, 0, maxKernelValue, rand);
    checkHorizontalDiv(ker, img, dest);
}
Also used : Kernel1D(boofcv.struct.convolve.Kernel1D)

Example 3 with Kernel1D

use of boofcv.struct.convolve.Kernel1D in project BoofCV by lessthanoptimal.

the class TestConvolveImageStandard_IL method vertical.

/**
 * Unit test for vertical convolution.
 */
public void vertical(ImageInterleaved img, ImageInterleaved dest) {
    Kernel1D ker = FactoryKernel.createKernelForImage(kernelWidth, kernelRadius, 1, img.getDataType());
    // standard symmetric odd kernel shape
    ker = FactoryKernel.random(ker.getClass(), kernelWidth, kernelRadius, 0, maxKernelValue, rand);
    checkVertical(ker, img, dest);
    // odd non-symmetric kernel shape
    ker = FactoryKernel.random(ker.getClass(), kernelWidth, 0, 0, maxKernelValue, rand);
    checkVertical(ker, img, dest);
    // even non-symmetric kernel shape
    ker = FactoryKernel.random(ker.getClass(), 2, 1, 0, maxKernelValue, rand);
    checkVertical(ker, img, dest);
}
Also used : Kernel1D(boofcv.struct.convolve.Kernel1D)

Example 4 with Kernel1D

use of boofcv.struct.convolve.Kernel1D in project BoofCV by lessthanoptimal.

the class TestConvolveImageStandard_SB method horizontal.

/**
 * Unit test for horizontal convolution.
 */
public void horizontal(ImageGray img, ImageGray dest) {
    Kernel1D ker = FactoryKernel.createKernelForImage(kernelWidth, kernelRadius, 1, img.getClass());
    // standard symmetric odd kernel shape
    ker = FactoryKernel.random(ker.getClass(), kernelWidth, kernelRadius, 0, maxKernelValue, rand);
    checkHorizontal(ker, img, dest);
    // odd non-symmetric kernel shape
    ker = FactoryKernel.random(ker.getClass(), kernelWidth, 0, 0, maxKernelValue, rand);
    checkHorizontal(ker, img, dest);
    // even non-symmetric kernel shape
    ker = FactoryKernel.random(ker.getClass(), 2, 1, 0, maxKernelValue, rand);
    checkHorizontal(ker, img, dest);
}
Also used : Kernel1D(boofcv.struct.convolve.Kernel1D)

Example 5 with Kernel1D

use of boofcv.struct.convolve.Kernel1D in project BoofCV by lessthanoptimal.

the class TestConvolveImageStandard_SB method horizontalDiv.

/**
 * Unit test for horizontal convolution with division.
 */
public void horizontalDiv(ImageGray img, ImageGray dest) {
    Kernel1D ker = FactoryKernel.createKernelForImage(kernelWidth, kernelRadius, 1, img.getClass());
    // standard symmetric odd kernel shape
    ker = FactoryKernel.random(ker.getClass(), kernelWidth, kernelRadius, 0, maxKernelValue, rand);
    checkHorizontalDiv(ker, img, dest);
    // odd non-symmetric kernel shape
    ker = FactoryKernel.random(ker.getClass(), kernelWidth, 0, 0, maxKernelValue, rand);
    checkHorizontalDiv(ker, img, dest);
    // even non-symmetric kernel shape
    ker = FactoryKernel.random(ker.getClass(), 2, 1, 0, maxKernelValue, rand);
    checkHorizontalDiv(ker, img, dest);
}
Also used : Kernel1D(boofcv.struct.convolve.Kernel1D)

Aggregations

Kernel1D (boofcv.struct.convolve.Kernel1D)17 Kernel2D (boofcv.struct.convolve.Kernel2D)3 FDistort (boofcv.abst.distort.FDistort)2 GrayF (boofcv.struct.image.GrayF)2 Test (org.junit.Test)2 SteerableKernel (boofcv.alg.filter.kernel.SteerableKernel)1 SteerableKernel_F32 (boofcv.alg.filter.kernel.impl.SteerableKernel_F32)1 SteerableKernel_I32 (boofcv.alg.filter.kernel.impl.SteerableKernel_I32)1 PyramidDiscreteSampleBlur (boofcv.alg.transform.pyramid.PyramidDiscreteSampleBlur)1 KernelBase (boofcv.struct.convolve.KernelBase)1 GrayF32 (boofcv.struct.image.GrayF32)1 ImageGray (boofcv.struct.image.ImageGray)1 BufferedImage (java.awt.image.BufferedImage)1