Skip to main content

Class 21: Images as Functions from Positions to Colors

Held: Monday, 27 February 2017

We consider yet another model of creating images, one in which the color of a pixel depends only on its position

Preliminaries

Overview

  • Models of images
  • Iterating over positions; images as functions
  • Blends and other positionall-computed images
  • Computing simple shapes
  • Some strange computations

Updates

News / Etc.

  • New partners!

Rotating reminders

  • Use our tutors! We have tutors available Sunday through Thursday evening from 7-10 p.m. in Science 3813/15.

Upcoming Work

  • Assignment 5 due TOMORROW at 10:30 p.m.
  • Lab writeup: 3e and 3f. (Don’t start with these; Doing the prior problems helps.)
  • Reading: Revisiting lists
  • Exam 2 arrives Wednesday. Yay!

Extra credit (Academic/Artistic)

  • CS Table, Tuesday at noon: Facial Recognition “algorithms”
  • W. Kamau Bell, Tuesday at 6pm, Harris.
  • Prazak Quartet, Tuesday, 28 February 2017, 7:30 p.m., Herrick.
  • CS Extras, Thursday at 4:15 pm, Sam’s research and PM’s research

Extra credit (Peer)

Extra credit (Misc)

  • Preventing sexual assault, Tuesday at 11am, JRC 101
  • Host a prospective student THIS COMING WEEKEND. (March 5, April 8, April 23)

Good things to do

Models of images

  • We’ve seen a variety of models of images.
    • Images that we describe by composing basic shapes.
    • Images that we create by transforming existing images.
    • Images that we create by using the Gimp tools.
    • Images that we create by a combination of techniques.
  • But there are certainly other models of image making. We’ll learn at least two more this semester.
  • Why are we learning so many models of image making? Because the basic operations you have affect the way you think about problem solving.

The image-compute model

  • In the image-variant model, we built images with a starting image and a function from colors to colors.
  • We will consider a variant of this model - images as functions from positions to colors.
  • That is, given an (x,y) pair, use a function to determine a color for the pixel at (x,y).
  • Syntax: (image-compute *function* *width* *height*)
    • No exclamation point because we are not changing anything that alread exists; we are simply computing a new image.

Examples

  • Color blends are the most natural thing to make.
  • We can also make shapes by using conditionals.
  • Given that colors are just numbers, we can also just do numeric computations and see what they give us.