2015-12-18 Images

posted Dec 18, 2015, 4:51 AM by Samuel Konstantinovich   [ updated Dec 18, 2015, 7:51 AM ]
Goal: Image manipulation using patches:

Homework: Complete Your cellular Automata Lab!

1. import-pcolors  - loads a predetermined image file by setting patches to that color

2. Try to shift the image downwards. How can we do this?

3. Can we make the image grayscale?


Get the files here:

http://marge.stuy.edu/~konstans/



Demo Code here:

patches-own [ nextcolor ]

to setup
  ca
  reset-ticks
  import-pcolors "kitten.png"
end

to go

  every .05[

    ask patches[
       
      ask patch-at 0 1 [ set nextcolor ([pcolor] of myself)  ]
    ]
    ask patches[
      set pcolor nextcolor
    ]
    tick
  ]
end
Comments