Search in sources :

Example 1 with ImageFunctionSparse

use of boofcv.abst.filter.ImageFunctionSparse in project BoofCV by lessthanoptimal.

the class FactoryDerivativeSparse method createLaplacian.

/**
 * Creates a sparse Laplacian filter.
 *
 * @see boofcv.alg.filter.derivative.LaplacianEdge
 *
 * @param imageType The type of image which is to be processed.
 * @param border How the border should be handled.  If null {@link BorderType#EXTENDED} will be used.
 * @return Filter for performing a sparse laplacian.
 */
public static <T extends ImageGray<T>> ImageFunctionSparse<T> createLaplacian(Class<T> imageType, ImageBorder<T> border) {
    if (border == null) {
        border = FactoryImageBorder.single(imageType, BorderType.EXTENDED);
    }
    if (GeneralizedImageOps.isFloatingPoint(imageType)) {
        ImageConvolveSparse<GrayF32, Kernel2D_F32> r = FactoryConvolveSparse.convolve2D(GrayF32.class, LaplacianEdge.kernel_F32);
        r.setImageBorder((ImageBorder_F32) border);
        return (ImageFunctionSparse<T>) r;
    } else {
        ImageConvolveSparse r = FactoryConvolveSparse.convolve2D(GrayI.class, LaplacianEdge.kernel_I32);
        r.setImageBorder(border);
        return (ImageFunctionSparse<T>) r;
    }
}
Also used : ImageFunctionSparse(boofcv.abst.filter.ImageFunctionSparse) GrayF32(boofcv.struct.image.GrayF32) Kernel2D_F32(boofcv.struct.convolve.Kernel2D_F32) ImageConvolveSparse(boofcv.abst.filter.convolve.ImageConvolveSparse)

Aggregations

ImageFunctionSparse (boofcv.abst.filter.ImageFunctionSparse)1 ImageConvolveSparse (boofcv.abst.filter.convolve.ImageConvolveSparse)1 Kernel2D_F32 (boofcv.struct.convolve.Kernel2D_F32)1 GrayF32 (boofcv.struct.image.GrayF32)1