Skip to content

Instantly share code, notes, and snippets.

@jcollard
Created October 24, 2013 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcollard/7147088 to your computer and use it in GitHub Desktop.
Save jcollard/7147088 to your computer and use it in GitHub Desktop.
Example usage of outline' on a ColorImage
import Data.Image
import Data.Image.Interactive
import System.IO.Unsafe
stopImage = unsafePerformIO $ do
stop <- readColorImage "images/stop.ppm"
return stop
binaryStop = (r + g + b) .> 196 where
(r, g, b) = colorImageToRGB stopImage
grayToColor img = makeImage (rows img) (cols img) toColor where
toColor r c = RGB (g, g, g) where
g = ref img r c
outlineBlue :: ColorImage
outlineBlue = outline' white blue (grayToColor binaryStop) where
white = RGB (1,1,1)
blue = RGB (0,0,1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment