Safe Haskell | None |
---|---|

Language | Haskell98 |

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.

- convolveP :: (Num a, Unbox a, Monad m) => (DIM2 -> a) -> Array U DIM2 a -> Array U DIM2 a -> m (Array U DIM2 a)
- type GetOut a = (DIM2 -> a) -> DIM2 -> DIM2 -> a
- outAs :: a -> GetOut a
- outClamp :: GetOut a
- convolveOutP :: (Num a, Unbox a, Monad m) => GetOut a -> Array U DIM2 a -> Array U DIM2 a -> m (Array U DIM2 a)

# Arbitrary boundary handling

:: (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

= (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.

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