hip-1.0.1: Haskell Image Processing (HIP) Library.

Copyright(c) Alexey Kuleshevich 2016
LicenseBSD3
MaintainerAlexey Kuleshevich <lehins@yandex.ru>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Graphics.Image.Processing.Complex

Contents

Description

 

Synopsis

Rectangular form

(!+!) :: (Array arr cs e, Array arr cs (Complex e)) => Image arr cs e -> Image arr cs e -> Image arr cs (Complex e) infix 6 Source

Constrcut a complex image from two images representing real and imaginary parts.

>>> frog <- readImageRGB "images/frog.jpg"
>>> frog !+! 0
<Image VectorUnboxed RGB (Complex Double): 200x320>
>>> frog !+! frog
<Image VectorUnboxed RGB (Complex Double): 200x320>

realPart' :: (Array arr cs e, Array arr cs (Complex e), RealFloat e) => Image arr cs (Complex e) -> Image arr cs e Source

Extracts the real part of a complex image.

imagPart' :: (Array arr cs e, Array arr cs (Complex e), RealFloat e) => Image arr cs (Complex e) -> Image arr cs e Source

Extracts the imaginary part of a complex image.

Polar form

mkPolar' :: (Array arr cs e, Array arr cs (Complex e), RealFloat e) => Image arr cs e -> Image arr cs e -> Image arr cs (Complex e) Source

Form a complex image from polar components of magnitude and phase.

cis' :: (Array arr cs e, Array arr cs (Complex e), RealFloat e) => Image arr cs e -> Image arr cs (Complex e) Source

cis' t is a complex image with magnitude 1 and phase t (modulo 2*pi).

polar' :: (Array arr cs e, Array arr cs (Complex e), RealFloat e) => Image arr cs (Complex e) -> (Image arr cs e, Image arr cs e) Source

The function polar' takes a complex image and returns a (magnitude, phase) pair of images in canonical form: the magnitude is nonnegative, and the phase in the range (-pi, pi]; if the magnitude is zero, then so is the phase.

magnitude' :: (Array arr cs e, Array arr cs (Complex e), RealFloat e) => Image arr cs (Complex e) -> Image arr cs e Source

The nonnegative magnitude of a complex image.

phase' :: (Array arr cs e, Array arr cs (Complex e), RealFloat e) => Image arr cs (Complex e) -> Image arr cs e Source

The phase of a complex image, in the range (-pi, pi]. If the magnitude is zero, then so is the phase.

Conjugate

conjugate' :: (Array arr cs e, Array arr cs (Complex e), RealFloat e) => Image arr cs (Complex e) -> Image arr cs (Complex e) Source

The conjugate of a complex image.

Processing

makeFilter Source

Arguments

:: (ManifestArray arr cs e, RealFloat e) 
=> (Int, Int)

Dimensions of the filter. Both m and n have to be powers of 2, i.e. m == 2^k, where k is some integer.

-> ((Int, Int) -> Pixel cs e) 
-> Image arr cs e 

Make a filter by using a function that works around a regular (x, y) coordinate system.

applyFilter Source

Arguments

:: (ManifestArray arr cs e, ManifestArray arr cs (Complex e), RealFloat e) 
=> Image arr cs e

Source image.

-> Image arr cs e

Filter.

-> Image arr cs e 

Apply a filter to an image created by makeFilter.

Fourier Transform

fft :: (ManifestArray arr cs (Complex e), Num e, RealFloat e) => Image arr cs (Complex e) -> Image arr cs (Complex e) Source

Fast Fourier Transform

ifft :: (ManifestArray arr cs (Complex e), Num e, RealFloat e) => Image arr cs (Complex e) -> Image arr cs (Complex e) Source

Inverse Fast Fourier Transform