diff options
author | Yann Herklotz Grave <git@yannherklotzgrave.com> | 2019-02-20 19:35:51 +0000 |
---|---|---|
committer | Yann Herklotz Grave <git@yannherklotzgrave.com> | 2019-02-20 19:35:51 +0000 |
commit | 6e50c22c0d95851340f909c88f3178bf25088adf (patch) | |
tree | c4272d033f2c4b441770b475c2291fd5fe5b00d9 /src/Main.hs | |
download | median-cut-6e50c22c0d95851340f909c88f3178bf25088adf.tar.gz median-cut-6e50c22c0d95851340f909c88f3178bf25088adf.zip |
Initial files
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs new file mode 100644 index 0000000..0e5141a --- /dev/null +++ b/src/Main.hs @@ -0,0 +1,23 @@ +module Main where + +import qualified Data.ByteString as B +import qualified Data.Text as T +import PFM + +fixIntensity :: Int -> Int -> PFMColour -> Double +fixIntensity sizeY y (PFMColour r g b) = + sin (fromIntegral y / fromIntegral sizeY * pi) * (f r + f g + f b) / 3 + where + f = realToFrac +fixIntensity _ _ _ = error "Mono not supported" + +findSplit :: [Double] -> Int +findSplit = + +main :: IO () +main = do + im <- B.readFile "data/grace_latlong.pfm" + let grace = revColour $ parse im + let height = pfmHeight grace - 1 + let fixedIntensities = [fixIntensity height y <$> c | c <- pfmColour grace, y <- [0..height]] + |