Safe Haskell | Safe-Inferred |
---|
Documentation
convolveRows :: (Image img, Num (Pixel img)) => [Pixel img] -> img -> imgSource
Given a list consisting solely of pixel values representing a 1D convolution kernel and an image, convolveRows returns the 1D discrete periodic convolution of the rows of the image with the kernel.
>>>
frog <- readImage "images/frog.pgm"
https://raw.github.com/jcollard/unm-hip/master/examples/frog.jpg
>>>
convolveRows [1,-1] frog
https://raw.github.com/jcollard/unm-hip/master/examples/convolverows.jpg
convolveCols :: (Image img, Num (Pixel img)) => [Pixel img] -> img -> imgSource
Given a list consisting solely of pixel values representing a 1D convolution kernel and an image, convolveCols returns the 1D discrete periodic convolution of the columns of the image with the kernel.
>>>
convolveCols [1,-1] frog
https://raw.github.com/jcollard/unm-hip/master/examples/convolvecols.jpg
>>>
let dx = convolveRows [1, -1] frog
>>>
let dy = convolveCols [1, -1] frog
>>>
imageMap sqrt (dx*dx + dy*dy) :: GrayImage
https://raw.github.com/jcollard/unm-hip/master/examples/convolvedxdy.jpg
convolve :: (Image img, Num (Pixel img)) => [[Pixel img]] -> img -> imgSource
Given a 2D list consisting solely of pixels representing a 2D convolution kernel and an image, convolve returns the 2D discrete periodic convolution of the image with the kernel.
>>>
convolve [[1,1,1],[1,-8,1],[1,1,1]] frog
https://raw.github.com/jcollard/unm-hip/master/examples/convolve.jpg