;;; image-transformations.scm ;;; A variety of procedures that transform images, created for MP2 in ;;; CSC-151-XX SEMESTER. ;;; ;;; Author: Your Name Here ;;; Date submitted: YYYY-MM-DD ;;; ;;; Acknowledgements: ;;; ;;; * Starter code provided by SamR. That code includes this header, ;;; the "provided code" section below, and a bit of other material. ;;; * ... (import image) ; +---------------+-------------------------------------------------- ; | Provided code | ; +---------------+ ;;; (rgb-swap-rb c) -> rgb? ;;; c : rgb? ;;; Swap the red and blue components of `c`. (define rgb-swap-rb (lambda (c) (rgb (rgb-blue c) (rgb-green c) (rgb-red c)))) ;;; (swap-red-blue img) -> image? ;;; img : image? ;;; Create a new image by swapping the red and blue components of ;;; each pixel in `img`. (define swap-red-blue-old (lambda (img) (pixel-map rgb-swap-rb img))) (define swap-red-blue (lambda (img) (pixel-map (lambda (c) (rgb (rgb-blue c) (rgb-green c) (rgb-red c))) img))) ;;; (decrease-green img) -> image? ;;; img : image? ;;; Create a new image by making each pixel of `img` less green (and ;;; a bit more blue and red). (define decrease-green (lambda (img) (pixel-map (o rgb-pseudo-complement rgb-greener rgb-pseudo-complement) img))) ;;; (cyclic-add-90 n) -> integer? ;;; n : integer? ;;; Add 90 to `n`, wrapping around when we hit 256. (define cyclic-add-90 (lambda (val) (remainder (+ val 90) 256))) ;;; (l-s func left) -> function? ;;; func : function? ;;; left : any ;;; Create a new function that takes one input, `right`, and ;;; computes `(func left right)` (define l-s (lambda (func left) (lambda (right) (func left right)))) ;;; (r-s func left) -> function? ;;; func : function? ;;; left : any ;;; Create a new function that takes one input, `left`, and ;;; computes `(func left right)` (define r-s (lambda (func right) (lambda (left) (func left right)))) ;;; ??? : value? ;;; A default value (define ??? "Not yet defined") ; +-------------------------------------+---------------------------- ; | Part one: RGB-based transformations | ; +-------------------------------------+ ;;; (rgb-extreme color) -> rgb? ;;; color : rgb? ;;; ??? (define rgb-extreme ???) ;;; (extreme img) -> image? ;;; img : image? ;;; ??? (define extreme (l-s pixel-map rgb-extreme)) ;;; (rgb-enhance-dominance color) -> rgb? ;;; color : rgb? ;;; ??? (define rgb-enhance-dominance ???) ;;; (enhance-dominance img) -> image? ;;; img : image? ;;; ??? (define enhance-dominance (l-s pixel-map rgb-enhance-dominance)) ;;; (image-flatten-32 img) -> image? ;;; img : image? ;;; ??? (define image-flatten-32 ???) ;;; (eight-bit img) -> image? ;;; img : image? ;;; ??? (define eight-bit ???) ;;; (rgb-cyclic-add c1 c2) -> rgb? ;;; c1 : rgb? ;;; c2 : rgb? ;;; "Cyclically add" the corresponding components of c1 and c2, ;;; wrapping around to lower values when we reach 256. (define rgb-cyclic-add ???) ;;; (rgb-cyclic-subtract c1 c2) -> rgb? ;;; c1 : rgb? ;;; c2 : rgb? ;;; "Cyclically subtract" each component of `c2` from the corresponding ;;; components of c1, wrapping around to 255 when we go below zero. (define rgb-cyclic-subtract ???) ;;; (gamma-correct-component component gamma) -> nonnegative-integer? ;;; component : (all-of nonnegative-integer? (less-than 256)) ;;; gamma : non-negative-real? ;;; Gamma correct `component` by `gamma` using the standard algorithm. ;;; ;;; The standard algorithm is ;;; * Convert `component` to a number between 0 and 1 by dividing by 255. ;;; * Take that number to the `gamma` power. ;;; * Multiply that number by 255 ;;; * Round the result. (define gamma-correct-component ???) ;;; (gamma-correct-color c gamma) -> rgb? ;;; c : rgb? ;;; gamma : real? ;;; Gamma correct `c` by `gamma` by gamma correcting each component ;;; by `gamma`. (define gamma-correct-color ???) ;;; (gamma-correct-two img) -> image? ;;; img : image? ;;; Gamma correct `img` by correcting each pixel by 2. (define gamma-correct-two ???) ;;; (gamma-correct-half img) -> image? ;;; img : image? ;;; Gamma correct `c` by correcting each component by 1/2. (define gamma-correct-half ???) ; +-------------------------------------+---------------------------- ; | Part two: HSV-based transformations | ; +-------------------------------------+ ;;; (hsv-to-string c) -> string? ;;; c : hsv? ;;; Convert `c` to a string of the form `"hue-saturation-value"`. (define hsv-to-string (lambda (c) ???)) ;;; (string-to-hsv str) -> hsv? ;;; str : a string of the form "hue-saturation-value" ;;; Convert a string of the given form to an HSV color. (define string-to-hsv (lambda (str) ???)) ;;; (saturate img) -> image? ;;; img : image? ;;; Create a new version of `img` in which the saturation of each pixel ;;; is set to 100. (define saturate (lambda (img) ???)) ;;; (rotate-hue img angle) -> image? ;;; img : image? ;;; angle : integer? ;;; Create a new version of `img` in which the hue of each pixel is ;;; change by `angle`. (define rotate-hue ???) ;;; (set-hue img hue) -> image? ;;; img : image? ;;; hue : integer? (between 0 and 359, inclusive) ;;; Create a new version of `img` in which the hue of each pixel ;;; is set to `hue`. (define set-hue ???) ; +-----------------------+------------------------------------------ ; | Part three: Freestyle | ; +-----------------------+ ;;; (my-rgb-transformation img value) -> image? ;;; img : image? ;;; value : ??? ;;; ??? (define my-rgb-transformation ???) ;;; (my-hsv-transformation img value) -> image? ;;; img : image? ;;; value : ??? ;;; ??? (define my-hsv-transformation ???) ;; I created `kitten-rgb-transformed-01.jpg` using the following instructions: ;; ;; > ;; ;; I created `kitten-rgb-transformed-02.jpg` using the following instructions: ;; ;; > ;; I created `kitten-rgb-transformed-03.jpg` using the following instructions: ;; ;; > ;; ;; I created `kitten-hsv-transformed-01.jpg` using the following instructions: ;; ;; > ;; ;; I created `kitten-hsv-transformed-02.jpg` using the following instructions: ;; ;; > ;; ;; I created `kitten-hsv-transformed-03.jpg` using the following instructions: ;; ;; >