Today’s start-of-class procedure
Warning! You are being recorded (and transcribed) (provided the technology is working correctly).
Approximate overview
Here’s a sample response to #4 that illustrates what I like.
(overlay (image1 image2 image3))
(beside (i1 i2 i3))
(define xxx
(lambda (color size)
...
(define image1 (solid-circle 10 "blue" 5))
(define image2 (outlined-rectangle 10 20 "black" 7))
(rotate img angle)
(hflip img) or (vflip img)
(hshift img amt) or (vshift img amt)
(scale img amt)
(crop img left top width height)
Scholarly
Artistic
Multicultural
Peer
Musical, theatric, sporting, and academic events involving this section’s students are welcome.
Wellness
Misc
These do not earn tokens, but are worth your consideration.
Will I have an opportunity to retake this Quiz/LA if I did not pass?
Certainly! That’s the whole point of mastery grading.
In general, your option will be to take it again on the next SoLA. However, since this is your first quiz, you will also have an option before class next Wednesday (section 1) or after class next Wednesday (sections 2 and 3).
Can you explain further on part 4, and go over how to format the DrRacket, and turn it in? I do not want to have to take a lot of time figuring it out.
I’ll try to demo that in class.
I want to know the difference between “overlay” and “overlay/origin”. I have tried using both of them in coding the overlapped hollow-orange-circle and orange circle. However, I don’t really understand why the images look so different.
overlay
overlays the two images, matching the centers.overlay/origin
overlays the two images, matching their upper-left-hand corners.
I’ll try demoing.
How are “code” and “procedure” different?
A procedure is a parameterized set of code. Procedures only run when you call them. Code is the stuff that goes in procedures, but can also be written by itself.
(solid-square 100 "blue")
is code, but not a procedure.
Why do programmers working in image processing use test images like the kitten image, Mandrill, Peppers, Lena image, etc. instead of simply using swatches of color (like test patterns for TVs)?
I don’t know about others, but I find it more fun.
Can we go over why the color-merge procedure is the way it is. I couldn’t discern why some things were being added together and what the “quotient” was meant to do.
;;; (color-merge-red-green c) -> color?
;;; c : color?
;;; Make both the red and green components closer to the average of the
;;; two components.
(define color-merge-red-green
(lambda (c)
(rgb (quotient (+ (color-red c) (color-red c) (color-green c)) 3)
(quotient (+ (color-red c) (color-green c) (color-green c)) 3)
(color-blue c))))
We’re trying to make the red component a bit greener and the green component a bit redder.
For the new red component, we’re using two parts “old red” and one part “old green”. Since there are three parts we’re adding together, we need to divide by 3.
quotient
is the “divide-by” procedure.
When I tried to load the cat image, I got this message: bitmap/file: could not find the file kitten.jpg
. Is that a problem on my end or does the image not exist anymore?
Racket can be weird in loading files. We’ll talk a bit about that.
What do pixel-map and image-map do?
Both of them apply the given color transformation to every color in the image.
In the color-pseudo-complement
code, I didn’t get why c is a “color” or a code (rgb …) Won’t the computer intepret it as numerical value like size in the lambda (size)?
;;; (color-pseudo-complement c) -> color?
;;; c : color?
;;; Compute the pseudo-complement of a color
(define color-pseudo-complement
(lambda (c)
(rgb (- 255 (color-red c))
(- 255 (color-green c))
(- 255 (color-blue c)))))
rgb-colors.rkt
(in the same folder as
your kitten.jpg
).rgb-colors.rkt
and kitten.jpg
.