Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides high level filtering functions for images.
Use Internal
if you want to create new image filters.
Filters are operations on images on which the surrounding of each processed pixel is considered according to a kernel.
See http://en.wikipedia.org/wiki/Kernel_(image_processing) for details.
The radius
argument of some filters is used to determine the kernel size.
A radius as of 1 means a kernel of size 3, 2 a kernel of size 5 and so on.
Note: filters are currently not supported on multi-channel images (RGB, RGBA ...) are currently not supported.
- class Filterable src res f
- data Filter src kernel init fold acc res
- class (Image (SeparableFilterAccumulator src res acc), ImagePixel (SeparableFilterAccumulator src res acc) ~ acc, FromFunction (SeparableFilterAccumulator src res acc), FromFunctionPixel (SeparableFilterAccumulator src res acc) ~ acc) => SeparatelyFiltrable src res acc
- dilate :: (Image src, Ord (ImagePixel src), FromFunction res, FromFunctionPixel res ~ ImagePixel src, SeparatelyFiltrable src res (ImagePixel src)) => Int -> src -> res
- erode :: (Image src, Ord (ImagePixel src), FromFunction res, FromFunctionPixel res ~ ImagePixel src, SeparatelyFiltrable src res (ImagePixel src)) => Int -> src -> res
- blur :: (Image src, Integral (ImagePixel src), FromFunction res, Num (FromFunctionPixel res), SeparatelyFiltrable src res Int32) => Int -> src -> res
- gaussianBlur :: (Image src, Integral (ImagePixel src), FromFunction res, Integral (FromFunctionPixel res), Floating acc, RealFrac acc, Storable acc, SeparatelyFiltrable src res acc) => Int -> Maybe acc -> src -> res
- data DerivativeType
- scharr :: (Image src, Integral (ImagePixel src), FromFunction res, Integral (FromFunctionPixel res), Storable (FromFunctionPixel res), SeparatelyFiltrable src res (FromFunctionPixel res)) => DerivativeType -> src -> res
- sobel :: (Image src, Integral (ImagePixel src), FromFunction res, Integral (FromFunctionPixel res), Storable (FromFunctionPixel res), SeparatelyFiltrable src res (FromFunctionPixel res)) => Int -> DerivativeType -> src -> res
- mean :: (Image src, Integral (ImagePixel src), FromFunction res, Fractional (FromFunctionPixel res), SeparatelyFiltrable src res Int32) => Size -> src -> res
Classes and type
class Filterable src res f Source #
Provides an implementation to execute a type of filter.
src
is the original image, res
the resulting image and f
the filter.
(Image src, FromFunction res, (~) * src_pix (ImagePixel src), (~) * res_pix (FromFunctionPixel res), SeparatelyFiltrable src res src_pix) => Filterable src res (SeparableFilter1 src_pix init res_pix) Source # | Separable filters initialized using the first pixel of the kernel. |
(Image src, FromFunction res, (~) * src_pix (ImagePixel src), (~) * res_pix (FromFunctionPixel res)) => Filterable src res (BoxFilter1 src_pix init res_pix) Source # | Box filters initialized using the first pixel of the kernel. |
(Image src, FromFunction res, (~) * src_pix (ImagePixel src), (~) * res_pix (FromFunctionPixel res), SeparatelyFiltrable src res acc) => Filterable src res (SeparableFilter src_pix init acc res_pix) Source # | Separable filters initialized with a given value. |
(Image src, FromFunction res, (~) * src_pix (ImagePixel src), (~) * res_pix (FromFunctionPixel res)) => Filterable src res (BoxFilter src_pix init acc res_pix) Source # | Box filters initialized with a given value. |
data Filter src kernel init fold acc res Source #
(Image src, FromFunction res, (~) * src_pix (ImagePixel src), (~) * res_pix (FromFunctionPixel res), SeparatelyFiltrable src res src_pix) => Filterable src res (SeparableFilter1 src_pix init res_pix) Source # | Separable filters initialized using the first pixel of the kernel. |
(Image src, FromFunction res, (~) * src_pix (ImagePixel src), (~) * res_pix (FromFunctionPixel res)) => Filterable src res (BoxFilter1 src_pix init res_pix) Source # | Box filters initialized using the first pixel of the kernel. |
(Image src, FromFunction res, (~) * src_pix (ImagePixel src), (~) * res_pix (FromFunctionPixel res), SeparatelyFiltrable src res acc) => Filterable src res (SeparableFilter src_pix init acc res_pix) Source # | Separable filters initialized with a given value. |
(Image src, FromFunction res, (~) * src_pix (ImagePixel src), (~) * res_pix (FromFunctionPixel res)) => Filterable src res (BoxFilter src_pix init acc res_pix) Source # | Box filters initialized with a given value. |
class (Image (SeparableFilterAccumulator src res acc), ImagePixel (SeparableFilterAccumulator src res acc) ~ acc, FromFunction (SeparableFilterAccumulator src res acc), FromFunctionPixel (SeparableFilterAccumulator src res acc) ~ acc) => SeparatelyFiltrable src res acc Source #
Used to determine the type of the accumulator image used when computing separable filters.
src
and res
are respectively the source and the result image types while
acc
is the pixel type of the accumulator.
Storable acc => SeparatelyFiltrable src (Delayed p) acc Source # | |
Storable acc => SeparatelyFiltrable src (Manifest p) acc Source # | |
Morphological operators
:: (Image src, Ord (ImagePixel src), FromFunction res, FromFunctionPixel res ~ ImagePixel src, SeparatelyFiltrable src res (ImagePixel src)) | |
=> Int | Kernel radius. |
-> src | |
-> res |
:: (Image src, Ord (ImagePixel src), FromFunction res, FromFunctionPixel res ~ ImagePixel src, SeparatelyFiltrable src res (ImagePixel src)) | |
=> Int | Kernel radius. |
-> src | |
-> res |
Blur
:: (Image src, Integral (ImagePixel src), FromFunction res, Num (FromFunctionPixel res), SeparatelyFiltrable src res Int32) | |
=> Int | Blur radius. |
-> src | |
-> res |
Blurs the image by averaging the pixel inside the kernel.
Uses an Int32
as accumulator during the averaging operation.
:: (Image src, Integral (ImagePixel src), FromFunction res, Integral (FromFunctionPixel res), Floating acc, RealFrac acc, Storable acc, SeparatelyFiltrable src res acc) | |
=> Int | Blur radius. |
-> Maybe acc | Sigma value of the Gaussian function. If not given, will be automatically computed from the radius so that the kernel fits 3σ of the distribution. |
-> src | |
-> res |
Blurs the image by averaging the pixel inside the kernel using a Gaussian function.
Derivation
scharr :: (Image src, Integral (ImagePixel src), FromFunction res, Integral (FromFunctionPixel res), Storable (FromFunctionPixel res), SeparatelyFiltrable src res (FromFunctionPixel res)) => DerivativeType -> src -> res Source #
Estimates the first derivative using the Scharr's 3x3 kernel.
Convolves the following kernel for the X derivative:
-3 0 3 -10 0 10 -3 0 3
And this kernel for the Y derivative:
-3 -10 -3 0 0 0 3 10 3
Uses an Int32
as accumulator during kernel application.
:: (Image src, Integral (ImagePixel src), FromFunction res, Integral (FromFunctionPixel res), Storable (FromFunctionPixel res), SeparatelyFiltrable src res (FromFunctionPixel res)) | |
=> Int | Kernel radius. |
-> DerivativeType | |
-> src | |
-> res |
Others
mean :: (Image src, Integral (ImagePixel src), FromFunction res, Fractional (FromFunctionPixel res), SeparatelyFiltrable src res Int32) => Size -> src -> res Source #
Computes the average of a kernel of the given size.
This is similar to blur
but with a rectangular kernel and a Fractional
result.
Uses an Int32
as accumulator during the averaging operation.