hip- Haskell Image Processing (HIP) Library.

Safe HaskellNone



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



simpleFilter :: (Array arr cs e, Array arr X e) => Direction -> Border (Pixel cs e) -> Filter arr cs e Source #

Supplementary function for applying border resolution and a general mask.

ahe Source #


:: (MArray arr Y Double, Array arr Y Double, Array arr Y Word16, MArray arr Y Word16, Array arr X Double) 
=> Image arr Y Double 
-> Int

width of output image

-> Int

height of output image

-> Int

neighborhood size factor

-> Image arr Y Word16 

ahe operates on small contextual regions of the image. It enhances the contrast of each region and this technique works well when the distribution of pixel values is similar throughout the image.

The idea is to perform contrast enhancement in 'neighborhood region' of each pixel and the size of the region is a parameter of the method. It constitutes a characteristic length scale: contrast at smaller scales is enhanced, while contrast at larger scales is reduced (For general purposes, a size factor of 5 tends to give pretty good results).

Usage :

>>> img <- readImageY VU "images/yield.jpg"
>>> input1 <- getLine
>>> input2 <- getLine
>>> let thetaSz = (P.read input1 :: Int)
>>> let distSz = (P.read input2 :: Int)
>>> let neighborhoodFactor = (P.read input2 :: Int)
>>> let aheImage = ahe img thetaSz distSz neighborhoodFactor :: Image VU RGB Double
>>> writeImage "images/yield_ahe.png" (toImageRGB aheImage)