diff --git a/CHANGELOG.md b/CHANGELOG.md index 7207c9c..3284c3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,15 @@ +1.5.5.0 +======= + +* Ability to encode animated gifs + 1.5.4.0 ======= * Addition of `disable-chart` flag * Bunch of semi-functional stuff from GSoC 2018 -1.5.2.0 +1.5.3.0 ======= * Fixed FFT performace issue diff --git a/src/Graphics/Image/Processing/Ahe.hs b/src/Graphics/Image/Processing/Ahe.hs index ea49214..4b53748 100644 --- a/src/Graphics/Image/Processing/Ahe.hs +++ b/src/Graphics/Image/Processing/Ahe.hs @@ -5,6 +5,8 @@ -- | Adaptive histogram equalization is used to improve contrast in images. -- It adjusts image intensity in small regions (neighborhood) in the image. +-- +-- /__Warning__/ - This module is experimental and likely doesn't work as expected module Graphics.Image.Processing.Ahe where import Control.Monad (forM_, when) diff --git a/src/Graphics/Image/Processing/Hough.hs b/src/Graphics/Image/Processing/Hough.hs index 089c5b9..5e88ef4 100644 --- a/src/Graphics/Image/Processing/Hough.hs +++ b/src/Graphics/Image/Processing/Hough.hs @@ -2,9 +2,11 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} --- | Hough Transform is used as a part of feature extraction in images. +-- | 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 module Graphics.Image.Processing.Hough where import Control.Monad (forM_, when) @@ -18,7 +20,7 @@ import Graphics.Image.Interface as I import Graphics.Image.Types as IP -- | Some helper functions : --- | Trivial function for subtracting co-ordinate pairs +-- | Trivial function for subtracting co-ordinate pairs sub :: Num x => (x, x) -> (x, x) -> (x, x) sub (x1, y1) (x2, y2) = (x1 - x2, y1 - y2) @@ -34,25 +36,25 @@ fromIntegralP (x1, y1) = (fromIntegral x1, fromIntegral y1) mag :: Floating x => (x, x) -> x mag x = sqrt (dotProduct x x) --- | '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)). +-- | '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 +-- 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 : --- --- >>> frog <- readImageRGB VU "yield.jpg" +-- 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 frog thetaSz distSz +-- >>> houghImage = hough yield thetaSz distSz -- >>> writeImage "test.png" houghImage -- hough @@ -80,7 +82,7 @@ hough image thetaSz distSz = I.map (fmap toWord8) hImage slopeMap = [ ((x, y), slope x y) | x <- [0 .. widthMax], y <- [0 .. heightMax] ] distMax :: Double -- Compute Maximum distance - distMax = (sqrt . fromIntegral $ (heightMax + 1) ^ (2 :: Int) + (widthMax + 1) ^ (2 :: Int)) / 2 + distMax = (sqrt . fromIntegral $ (heightMax + 1) ^ (2 :: Int) + (widthMax + 1) ^ (2 :: Int)) / 2 accBin = runSTArray $ -- Core part of Algo begins here. Working in a safe way with a mutable array. do arr <- newArray ((0, 0), (thetaSz, distSz)) (0 :: Double) -- Build a new array, with every element initialised to the supplied value. @@ -99,11 +101,10 @@ hough image thetaSz distSz = I.map (fmap toWord8) hImage writeArray arr idx (old + 1) return arr - maxAcc = F.maximum accBin + maxAcc = F.maximum accBin hTransform (x, y) = let l = 255 - truncate ((accBin ! (x, y)) / maxAcc * 255) -- pixel generating function in PixelY l hImage :: Image arr Y Word8 hImage = makeImage (thetaSz, distSz) hTransform -