Skip to main content

Class 7: Transforming Images

Held: Wednesday, 1 February 2017

We consider some basic control stuctures that will allow us to write more general image filters.

Preliminaries

Overview

  • From transforming colors to transforming images
  • Sectioning
  • Anonymous transformations

Updates

News / Etc.

  • New partners!
  • Please don’t leave your completed/graded quizzes in the room.
  • Still working on grading HW1. Sorry.
  • I hope to get through preliminaries quickly so that you have most of class for lab.
  • You should have received a message from Stacy Turley requesting note-taking for this class. It looks like many of you are taking very nice notes (better than I do). I hope that you will respond to the request.
  • I’m supposed to remind you that Friday is the add/drop deadline.
  • Reminder: The lab writeups go to csc151-01-grader@grinnell.edu.
  • Quiz Friday!
    • Numbers and numeric operations.
    • RGB colors and color operations.
    • Color transformations.
    • The compose operation.
    • Scheme order of evaluation.
    • The questions you should ask about types.

Reminders

  • We have tutors available Sunday through Thursday evening from 7-10 p.m. in Science 3813/15.
  • Starting this week, we will have mentor sessions on Wednesday and Thursday evenings from 8:00-9:00 p.m. in the CS Commons. Wednesdays will be more Q&A, Thursdays will include sample quizzes.
  • I run review sessions on Thursdays at 9am in this room.
  • We have individual tutors available for those who take advantage of the above and find that it’s not enough.

Upcoming Work

Extra credit (Academic/Artistic)

  • Thursday extras, Thursday, 4:15 p.m., Science 3821: LaTeX.
  • CS Table next Tuesday.

Extra credit (Misc)

  • Any one of the activities relating to last Friday’s executive order.
    • See VP Connor’s email
    • Thursday at 7pm in Saints Rest

Extra credit (Peer)

  • Swimming and Diving meet 1pm on Saturday.
  • Ritalin Test Squad Improv Troupe is looking for new members and will be holding try outs this weekend. Auditions will be on Saturday Feb 4th, 1-3 pm in The Wall (Bucksbaum 152).

Good things to do

  • Care for the people around you.
  • More of the activities relating to last Friday’s executive order.
  • Divest rally Friday at 3pm in ARH 302.

All of these notes come from the old model of this course.

Transforming images by transforming each pixel

  • We saw in the color transformation lab that we can apply a transformation to each pixel, getting it and then setting it to a new value.
  • This generalizes that strategy.
  • (image-variant image color-transform) - build a new image by applying color-transform to every pixel.
  • image-transform! image color-transform - change the pixels “in place”
  • Interesting new concept: We can write procedures that take other procedures as parameters.

Sequencing transformations with compose

  • When you need to do more than one transformation, you can sequence them with compose (also o).
  • (image-variant image (o rgb-redder rgb-bluer))
  • Note: This is a new approach. Traditionally, procedures appear immediately after parentheses, and they are doing the work. Now they are inputs to other procedures, and so do not have parentheses.

Anonymous transformations

  • You don’t even need to name those transformations.
  • (image-variant image (lambda (rgb) ...))