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

Graphics.Image.Processing.Hough

Description

Hough Transform is used as a part of feature extraction in images. It is a tool that makes it far easier to identify straight lines in the source image, whatever their orientation.

Warning - This module is experimental and likely doesn't work as expected

Synopsis

# Documentation

sub :: Num x => (x, x) -> (x, x) -> (x, x) Source #

Some helper functions : | Trivial function for subtracting co-ordinate pairs

dotProduct :: Num x => (x, x) -> (x, x) -> x Source #

Compute the sum of squares or dot product of a given pair of co-ordinates

fromIntegralP :: (Integral x, Num y) => (x, x) -> (y, y) Source #

Conversion of pair fromIntegral

mag :: Floating x => (x, x) -> x Source #

Compute magnitude

hough :: forall arr. (MArray arr Y Double, Array arr Y Double, Array arr Y Word8) => Image arr Y Double -> Int -> Int -> Image arr Y Word8 Source #

hough computes the Linear Hough Transform and maps each point in the target image, (ρ, θ) to the average color of the pixels on the corresponding line of the source image (x,y) - space, where the line corresponds to points of the form (xcosθ + ysinθ = ρ(rho)).

The idea is that where there is a straight line in the original image, it corresponds to a bright (or dark, depending on the color of the background field) spot; by applying a suitable filter to the results of the transform, it is possible to extract the locations of the lines in the original image.  Usage :

>>> yield <- readImageRGB VU "yield.jpg"
>>> input1 <- getLine
>>> input2 <- getLine
>>> let thetaSz = (P.read input1 :: Int)
>>> let distSz = (P.read input2 :: Int)
>>> let houghImage :: Image VU RGB Double
>>> houghImage = hough yield thetaSz distSz
>>> writeImage "test.png" houghImage