Copyright | (c) Alexey Kuleshevich 2017 |
---|---|

License | BSD3 |

Maintainer | Alexey Kuleshevich <lehins@yandex.ru> |

Stability | experimental |

Portability | non-portable |

Safe Haskell | None |

Language | Haskell2010 |

## Synopsis

- data Filter arr cs e = Filter (Image arr cs e -> Image arr cs e)
- applyFilter :: Filter arr cs e -> Image arr cs e -> Image arr cs e
- data Direction
- gaussianLowPass :: (Array arr cs e, Array arr X e, Floating e, Fractional e) => Int -> e -> Border (Pixel cs e) -> Filter arr cs e
- gaussianBlur :: (Array arr cs e, Array arr X e, Floating e, RealFrac e) => e -> Filter arr cs e
- sobelFilter :: (Array arr cs e, Array arr X e) => Direction -> Border (Pixel cs e) -> Filter arr cs e
- sobelOperator :: (Array arr cs e, Array arr X e, Floating e) => Image arr cs e -> Image arr cs e
- prewittFilter :: (Array arr cs e, Array arr X e) => Direction -> Border (Pixel cs e) -> Filter arr cs e
- prewittOperator :: (Array arr cs e, Array arr X e, Floating e) => Image arr cs e -> Image arr cs e
- laplacianFilter :: (Array arr cs e, Array arr X e) => Border (Pixel cs e) -> Filter arr cs e
- logFilter :: (Array arr cs e, Array arr X e) => Border (Pixel cs e) -> Filter arr cs e
- gaussianSmoothingFilter :: (Fractional e, Array arr cs e, Array arr X e) => Border (Pixel cs e) -> Filter arr cs e
- meanFilter :: (Fractional e, Array arr cs e, Array arr X e) => Border (Pixel cs e) -> Filter arr cs e
- unsharpMaskingFilter :: (Fractional e, Array arr cs e, Array arr X e) => Border (Pixel cs e) -> Filter arr cs e

# Filter

Filter that can be applied to an image using `applyFilter`

.

*Since: 1.5.3*

applyFilter :: Filter arr cs e -> Image arr cs e -> Image arr cs e Source #

Apply a filter to an image

# Gaussian

:: (Array arr cs e, Array arr X e, Floating e, Fractional e) | |

=> Int | Radius |

-> e | Sigma |

-> Border (Pixel cs e) | Border resolution technique. |

-> Filter arr cs e |

Create a Gaussian Filter.

*Since: 1.5.3*

Create a Gaussian Blur filter. Radius will be derived from standard
deviation: `ceiling (2*sigma)`

and `Edge`

border resolution will be
utilized. If custom radius and/or border resolution is desired,
`gaussianLowPass`

can be used instead.

*Since: 1.5.3*

# Sobel

sobelFilter :: (Array arr cs e, Array arr X e) => Direction -> Border (Pixel cs e) -> Filter arr cs e Source #

sobelOperator :: (Array arr cs e, Array arr X e, Floating e) => Image arr cs e -> Image arr cs e Source #

# Prewitt

prewittFilter :: (Array arr cs e, Array arr X e) => Direction -> Border (Pixel cs e) -> Filter arr cs e Source #

prewittOperator :: (Array arr cs e, Array arr X e, Floating e) => Image arr cs e -> Image arr cs e Source #

# Laplacian

laplacianFilter :: (Array arr cs e, Array arr X e) => Border (Pixel cs e) -> Filter arr cs e Source #

The Laplacian of an image highlights regions of rapid intensity change and is therefore often used for edge detection. It is often applied to an image that has first been smoothed with something approximating a Gaussian smoothing filter in order to reduce its sensitivity to noise. More info about the algo at https://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm

# Laplacian of Gaussian

logFilter :: (Array arr cs e, Array arr X e) => Border (Pixel cs e) -> Filter arr cs e Source #

'Laplacian of Gaussian' (LOG) filter is a two step process of smoothing an image before applying some derivative filter on it. This comes in need for reducing the noise sensitivity while working with noisy datasets or in case of approximating second derivative measurements.

The LoG operator takes the second derivative of the image. Where the image is basically uniform, the LoG will give zero. Wherever a change occurs, the LoG will give a positive response on the darker side and a negative response on the lighter side. More info about the algo at https://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm

# Gaussian Smoothing

gaussianSmoothingFilter :: (Fractional e, Array arr cs e, Array arr X e) => Border (Pixel cs e) -> Filter arr cs e Source #

The Gaussian smoothing operator is a 2-D convolution operator that is used to
`blur`

images and remove detail and noise. The idea of Gaussian smoothing is to use
this 2-D distribution as a `point-spread' function, and this is achieved by convolution.
Since the image is stored as a collection of discrete pixels we need to produce a
discrete approximation to the Gaussian function before we can perform the convolution.
More info about the algo at https://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm

# Mean

meanFilter :: (Fractional e, Array arr cs e, Array arr X e) => Border (Pixel cs e) -> Filter arr cs e Source #

The mean filter is a simple sliding-window spatial filter that replaces the center value in the window with the average (mean) of all the pixel values in the window. The window, or kernel, can be any shape, but this one uses the most common 3x3 square kernel. More info about the algo at http://homepages.inf.ed.ac.uk/rbf/HIPR2/mean.htm

# Unsharp Masking

unsharpMaskingFilter :: (Fractional e, Array arr cs e, Array arr X e) => Border (Pixel cs e) -> Filter arr cs e Source #

The unsharp-masking filter is a sharpening operator which derives its name from the fact that it enhances edges (and other high frequency components in an image) via a procedure which subtracts an unsharp, or smoothed, version of an image from the original image. It is commonly used in the photographic and printing industries for crispening edges. More info about the algo at https://homepages.inf.ed.ac.uk/rbf/HIPR2/unsharp.htm