repa-algorithms-3.2.3.1: Algorithms using the Repa array library.

Safe HaskellNone

Data.Array.Repa.Algorithms.Convolve

Contents

Description

Generic stencil based convolutions.

If your stencil fits within a 7x7 tile and is known at compile-time then using then using the built-in stencil support provided by the main Repa package will be 5-10x faster.

If you have a larger stencil, the coefficients are not statically known, or need more complex boundary handling than provided by the built-in functions, then use this version instead.

Synopsis

Arbitrary boundary handling

convolvePSource

Arguments

:: (Num a, Unbox a, Monad m) 
=> (DIM2 -> a)

Function to get border elements when the stencil does not apply.

-> Array U DIM2 a

Stencil to use in the convolution.

-> Array U DIM2 a

Input image.

-> m (Array U DIM2 a) 

Image-kernel convolution, which takes a function specifying what value to return when the kernel doesn't apply.

Specialised boundary handling

type GetOut aSource

Arguments

 = (DIM2 -> a)

The original get function.

-> DIM2

The shape of the image.

-> DIM2

Index of element we were trying to get.

-> a 

A function that gets out of range elements from an image.

outAs :: a -> GetOut aSource

Use the provided value for every out-of-range element.

outClamp :: GetOut aSource

If the requested element is out of range use the closest one from the real image.

convolveOutPSource

Arguments

:: (Num a, Unbox a, Monad m) 
=> GetOut a

How to handle out-of-range elements.

-> Array U DIM2 a

Stencil to use in the convolution.

-> Array U DIM2 a

Input image.

-> m (Array U DIM2 a) 

Image-kernel convolution, which takes a function specifying what value to use for out-of-range elements.