friday 0.1.1 → 0.1.2
raw patch · 4 files changed
+15/−18 lines, 4 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Vision.Image.Grey.Type: instance FiniteBits GreyPixel
- Vision.Primitive.Shape: (:.) :: !tail -> !head -> (:.) tail head
+ Vision.Primitive.Shape: (:.) :: !tail -> !head -> :. tail head
Files
- bench/Benchmark.hs +2/−1
- friday.cabal +1/−1
- src/Vision/Image/Grey/Type.hs +2/−2
- src/Vision/Image/Transform.hs +10/−14
bench/Benchmark.hs view
@@ -14,7 +14,8 @@ import Vision.Primitive path :: FilePath-path = "bench/image.jpg"+path = "/home/rapha/Common_Kingfisher_Alcedo_atthis.jpg"+-- path = "bench/image.jpg" main :: IO () main = do
friday.cabal view
@@ -1,5 +1,5 @@ name: friday-version: 0.1.1+version: 0.1.2 synopsis: A functionnal image processing library for Haskell. homepage: https://github.com/RaphaelJ/friday license: LGPL-3
src/Vision/Image/Grey/Type.hs view
@@ -16,8 +16,8 @@ import Vision.Primitive (Rect, Size) newtype GreyPixel = GreyPixel Word8- deriving (Bits, Bounded, Enum, Eq, FiniteBits, Integral, Num, Ord, Real- , Read, Show, Storable)+ deriving (Bits, Bounded, Enum, Eq, Integral, Num, Ord, Real, Read, Show+ , Storable) type Grey = Manifest GreyPixel
src/Vision/Image/Transform.hs view
@@ -45,12 +45,10 @@ case method of TruncateInteger -> let !widthRatio = double w / double w'- !widthMiddle = (widthRatio - 1) / 2 !heightRatio = double h / double h'- !heightMiddle = (heightRatio - 1) / 2- line !y' = truncate $ double y' * heightRatio + heightMiddle+ line !y' = truncate $ (double y' + 0.5) * heightRatio - 0.5 {-# INLINE line #-}- col !x' = truncate $ double x' * widthRatio + widthMiddle+ col !x' = truncate $ (double x' + 0.5) * widthRatio - 0.5 {-# INLINE col #-} f !y !(Z :. _ :. x') = let !x = col x' in img `index` ix2 y x@@ -58,12 +56,10 @@ in fromFunctionLine size' line f NearestNeighbor -> let !widthRatio = double w / double w'- !widthMiddle = (widthRatio - 1) / 2 !heightRatio = double h / double h'- !heightMiddle = (heightRatio - 1) / 2- line !y' = round $ double y' * heightRatio + heightMiddle+ line !y' = round $ (double y' + 0.5) * heightRatio - 0.5 {-# INLINE line #-}- col !x' = round $ double x' * widthRatio + widthMiddle+ col !x' = round $ (double x' + 0.5) * widthRatio - 0.5 {-# INLINE col #-} f !y !(Z :. _ :. x') = let !x = col x' in img `index` ix2 y x@@ -71,20 +67,20 @@ in fromFunctionLine size' line f Bilinear -> let !widthRatio = w % w'- !widthMiddle = (widthRatio - 1) / 2 !maxWidth = ratio (w - 1) !heightRatio = (h - 1) % (h' - 1)- !heightMiddle = (heightRatio - 1) / 2 !maxHeight = ratio (h - 1)+ -- Limits the interpolation to inner pixel as first and last -- pixels can have out of bound coordinates. bound !limit = min limit . max 0 {-# INLINE bound #-}- line !y' = bound maxHeight $ ratio y' * heightRatio- + heightMiddle++ line !y' = bound maxHeight $ (ratio y' + 0.5) * heightRatio+ - 0.5 {-# INLINE line #-}- col !x' = bound maxWidth $ ratio x' * widthRatio- + widthMiddle+ col !x' = bound maxWidth $ (ratio x' + 0.5) * widthRatio+ - 0.5 {-# INLINE col #-} f !y !x _ = img `bilinearInterpol` RPoint x y {-# INLINE f #-}