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