Bitmap/Histogram: Difference between revisions

m
Line 393:
import Bitmap.Netpbm
import Control.Monad.ST
import Data.Array.ST
 
main = do
Line 402 ⟶ 401:
 
histogram :: Color c => Image s c -> ST s [Int]
histogram i = doliftM f . getPixels where
hf <-= newArrayelems . accumArray (+) 0 (0, 255) 0. ::map ST(\i s-> (STArrayluminance si, Int Int1))
let increment i = readArray h i >>= writeArray h i . (+1)
getPixels i >>= mapM_ (increment . luminance)
getElems h
 
medianIndex :: [Int] -> Int
Anonymous user