previous latest addition

home

2002 oct 27

using the pancito script below, and adding text with the gimp, i converted this photo into a "poster". the full resolution is 3200x4000, there's a quarter scale detail here.

you can buy this on a t-shirt here!

module Main where

import Point
import Colour
import Pancito2
import Reprocess
import IO

-- assumes inside square11
trapezium :: (Double, Double) -> (Colour, Colour) -> Image
trapezium (lo, hi) (fg, bg) p = if inside then fg else bg
 where
   x' = abs (x p)
   y' = y p
   x'' = lo + (hi - lo) * (y' + 1.0) / 2.0
   inside = x' < x''

centre :: Point -> Point
centre p = cartesian x' y'
  where
    x' = 0.5 + fromIntegral (floor (x p))
    y' = 0.5 + fromIntegral (floor (y p))

gamma :: Double -> Double -> Double
gamma a = \x -> a * x * x + (1.0 - a) * x

lim :: Double -> Double
lim x = min (max x 0.1) 0.9

stripes :: Image -> Image
stripes im p = trapezium (lo, hi) (c', white) px
  where
    im1 = im . shift (-0.5) 0.0
    im2 = im . shift 0.5 0.0
    pc = centre p
    px = rot90 $ pixelate11 p
    f mg1 = (1.0 - (v (mg1 pc))) * 1.3
    c = im pc
    s' = s c
    leaves = abs ((h c) - (h yellow)) < 0.5 
    ds = if leaves then 0.01 else 0.23
    enhance = s' > ds
    s'' = if enhance then 1.0 else 0.0
    v' = if enhance then v c else 0.0
    c' = hsva (h c) s'' v' 1.0
    lo = lim $ if enhance then 1.0 else f im1
    hi = lim $ if enhance then 1.0 else f im2

main :: IO ()
(nx, ny) = (260, 400)
pix = 3.0
scl = 10
xy = (origin, cartesian (fromIntegral nx / pix) (fromIntegral ny / pix))
nxy = (nx * scl, ny * scl)
main = do
         img <- readPpm "stripes-in.ppm" xy white
         ppmAlias xy nxy "stripes-out.ppm" (stripes img)