friday-0.2.3.2: A functional image processing library for Haskell.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Vision.Image.Class

Synopsis

Classes

class Pixel p where Source #

Determines the number of channels and the type of each pixel of the image and how images are represented.

Associated Types

type PixelChannel p Source #

Methods

pixNChannels :: p -> Int Source #

Returns the number of channels of the pixel.

Must not consume p (could be undefined).

pixIndex :: p -> Int -> PixelChannel p Source #

Instances

Instances details
Pixel Int16 Source # 
Instance details

Defined in Vision.Image.Class

Associated Types

type PixelChannel Int16 Source #

Pixel Int32 Source # 
Instance details

Defined in Vision.Image.Class

Associated Types

type PixelChannel Int32 Source #

Pixel Word16 Source # 
Instance details

Defined in Vision.Image.Class

Associated Types

type PixelChannel Word16 Source #

Pixel Word32 Source # 
Instance details

Defined in Vision.Image.Class

Associated Types

type PixelChannel Word32 Source #

Pixel Word8 Source # 
Instance details

Defined in Vision.Image.Class

Associated Types

type PixelChannel Word8 Source #

Pixel GreyPixel Source # 
Instance details

Defined in Vision.Image.Grey.Type

Associated Types

type PixelChannel GreyPixel Source #

Pixel HSVPixel Source # 
Instance details

Defined in Vision.Image.HSV.Type

Associated Types

type PixelChannel HSVPixel Source #

Pixel RGBPixel Source # 
Instance details

Defined in Vision.Image.RGB.Type

Associated Types

type PixelChannel RGBPixel Source #

Pixel RGBAPixel Source # 
Instance details

Defined in Vision.Image.RGBA.Type

Associated Types

type PixelChannel RGBAPixel Source #

Pixel Bool Source # 
Instance details

Defined in Vision.Image.Class

Associated Types

type PixelChannel Bool Source #

Pixel Double Source # 
Instance details

Defined in Vision.Image.Class

Associated Types

type PixelChannel Double Source #

Pixel Float Source # 
Instance details

Defined in Vision.Image.Class

Associated Types

type PixelChannel Float Source #

Pixel Int Source # 
Instance details

Defined in Vision.Image.Class

Associated Types

type PixelChannel Int Source #

Pixel Word Source # 
Instance details

Defined in Vision.Image.Class

Associated Types

type PixelChannel Word Source #

class Storable (ImagePixel i) => MaskedImage i where Source #

Provides an abstraction for images which are not defined for each of their pixels. The interface is similar to Image except that indexing functions don't always return.

Image origin (ix2 0 0) is located in the upper left corner.

Minimal complete definition

shape, (maskedIndex | maskedLinearIndex)

Associated Types

type ImagePixel i Source #

Methods

shape :: i -> Size Source #

maskedIndex :: i -> Point -> Maybe (ImagePixel i) Source #

Returns the pixel's value at 'Z :. y, :. x'.

maskedLinearIndex :: i -> Int -> Maybe (ImagePixel i) Source #

Returns the pixel's value as if the image was a single dimension vector (row-major representation).

values :: i -> Vector (ImagePixel i) Source #

Returns the non-masked values of the image.

class MaskedImage i => Image i where Source #

Provides an abstraction over the internal representation of an image.

Image origin (ix2 0 0) is located in the upper left corner.

Minimal complete definition

index | linearIndex

Methods

index :: i -> Point -> ImagePixel i Source #

Returns the pixel value at 'Z :. y :. x'.

linearIndex :: i -> Int -> ImagePixel i Source #

Returns the pixel value as if the image was a single dimension vector (row-major representation).

vector :: i -> Vector (ImagePixel i) Source #

Returns every pixel values as if the image was a single dimension vector (row-major representation).

Instances

Instances details
Storable p => Image (Delayed p) Source # 
Instance details

Defined in Vision.Image.Type

Storable p => Image (Manifest p) Source # 
Instance details

Defined in Vision.Image.Type

class FromFunction i where Source #

Provides ways to construct an image from a function.

Minimal complete definition

fromFunction

Associated Types

type FromFunctionPixel i Source #

Methods

fromFunction :: Size -> (Point -> FromFunctionPixel i) -> i Source #

Generates an image by calling the given function for each pixel of the constructed image.

fromFunctionLine :: Size -> (Int -> a) -> (a -> Point -> FromFunctionPixel i) -> i Source #

Generates an image by calling the last function for each pixel of the constructed image.

The first function is called for each line, generating a line invariant value.

This function is faster for some image representations as some recurring computation can be cached.

fromFunctionCol :: Storable b => Size -> (Int -> b) -> (b -> Point -> FromFunctionPixel i) -> i Source #

Generates an image by calling the last function for each pixel of the constructed image.

The first function is called for each column, generating a column invariant value.

This function *can* be faster for some image representations as some recurring computations can be cached. However, it may requires a vector allocation for these values. If the column invariant is cheap to compute, prefer fromFunction.

fromFunctionCached Source #

Arguments

:: Storable b 
=> Size 
-> (Int -> a)

Line function

-> (Int -> b)

Column function

-> (a -> b -> Point -> FromFunctionPixel i)

Pixel function

-> i 

Generates an image by calling the last function for each pixel of the constructed image.

The two first functions are called for each line and for each column, respectively, generating common line and column invariant values.

This function is faster for some image representations as some recurring computation can be cached. However, it may requires a vector allocation for column values. If the column invariant is cheap to compute, prefer fromFunctionLine.

Instances

Instances details
FromFunction (Delayed p) Source # 
Instance details

Defined in Vision.Image.Type

Associated Types

type FromFunctionPixel (Delayed p) Source #

Methods

fromFunction :: Size -> (Point -> FromFunctionPixel (Delayed p)) -> Delayed p Source #

fromFunctionLine :: Size -> (Int -> a) -> (a -> Point -> FromFunctionPixel (Delayed p)) -> Delayed p Source #

fromFunctionCol :: Storable b => Size -> (Int -> b) -> (b -> Point -> FromFunctionPixel (Delayed p)) -> Delayed p Source #

fromFunctionCached :: Storable b => Size -> (Int -> a) -> (Int -> b) -> (a -> b -> Point -> FromFunctionPixel (Delayed p)) -> Delayed p Source #

Storable p => FromFunction (DelayedMask p) Source # 
Instance details

Defined in Vision.Image.Type

Associated Types

type FromFunctionPixel (DelayedMask p) Source #

Storable p => FromFunction (Manifest p) Source # 
Instance details

Defined in Vision.Image.Type

Associated Types

type FromFunctionPixel (Manifest p) Source #

Methods

fromFunction :: Size -> (Point -> FromFunctionPixel (Manifest p)) -> Manifest p Source #

fromFunctionLine :: Size -> (Int -> a) -> (a -> Point -> FromFunctionPixel (Manifest p)) -> Manifest p Source #

fromFunctionCol :: Storable b => Size -> (Int -> b) -> (b -> Point -> FromFunctionPixel (Manifest p)) -> Manifest p Source #

fromFunctionCached :: Storable b => Size -> (Int -> a) -> (Int -> b) -> (a -> b -> Point -> FromFunctionPixel (Manifest p)) -> Manifest p Source #

class (MaskedImage src, MaskedImage res) => FunctorImage src res where Source #

Defines a class for images on which a function can be applied. The class is different from Functor as there could be some constraints and transformations the pixel and image types.

Methods

map :: (ImagePixel src -> ImagePixel res) -> src -> res Source #

Instances

Instances details
(Image src, Storable p) => FunctorImage src (Delayed p) Source # 
Instance details

Defined in Vision.Image.Type

Methods

map :: (ImagePixel src -> ImagePixel (Delayed p)) -> src -> Delayed p Source #

(MaskedImage src, Storable p) => FunctorImage src (DelayedMask p) Source # 
Instance details

Defined in Vision.Image.Type

Methods

map :: (ImagePixel src -> ImagePixel (DelayedMask p)) -> src -> DelayedMask p Source #

(Image src, Storable p) => FunctorImage src (Manifest p) Source # 
Instance details

Defined in Vision.Image.Type

Methods

map :: (ImagePixel src -> ImagePixel (Manifest p)) -> src -> Manifest p Source #

Functions

(!) :: Image i => i -> Point -> ImagePixel i Source #

Alias of index.

(!?) :: MaskedImage i => i -> Point -> Maybe (ImagePixel i) Source #

Alias of maskedIndex.

nChannels :: (Pixel (ImagePixel i), MaskedImage i) => i -> Int Source #

Returns the number of channels of an image.

pixel :: MaskedImage i => i -> ImagePixel i Source #

Returns an undefined instance of a pixel of the image. This is sometime useful to satisfy the type checker as in a call to pixNChannels :

nChannels img = pixNChannels (pixel img)