hip- Haskell Image Processing (HIP) Library.

Safe HaskellNone




randomCoords :: StdGen -> Int -> Int -> [(Int, Int)] Source #

Helper function for generating a list of random co-ordinates.

saltAndPepper Source #


:: (MArray arr Y Double, Array arr Y Double) 
=> Image arr Y Double 
-> Float

Noise Intensity -> Domain : (0, 1)

-> StdGen

Instance of RandomGen

-> Image arr Y Double 

Salt and pepper noise or impulse noise is a form of noise seen on images. It is mainly caused by sharp and sudden disturbances in the image signal.

saltAndPepper generates this particular type of noise by introducing a sparse distribution of white and black pixels in the input image. The level or intensity of the noise to be introduced is a parameter of this method and is scaled between 0 and 1, that is the input Noise Intensity has a domain : (0, 1).

Usage :

>>> img <- readImageY VU "images/yield.jpg"
>>> input1 <- getLine
>>> g <- newStdGen
>>> let noiseLevel = (P.read input1 :: Float)
>>> let snpImage :: Image VU Y Double
>>> snpImage = saltAndPepper img noiseLevel g
>>> writeImage "images/yield_snp.png" snpImage