Mercurial > vba-clojure
changeset 500:0273c08cd2ff
discovered that the gb has far fewer unique colors than I initially thought.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 12 Jun 2012 08:05:24 -0500 |
parents | 8b8053ccb33c |
children | 4c43b2b8d3c0 |
files | clojure/com/aurellem/run/image.clj gb-color-map-unique.png |
diffstat | 2 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/image.clj Tue Jun 12 03:36:47 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/image.clj Tue Jun 12 08:05:24 2012 -0500 1.3 @@ -155,7 +155,7 @@ 1.4 (.setRGB im x y (pix (+ x (* 160 y)))))) 1.5 (view im))) 1.6 1.7 -(defn-memo gb-rgb->vga-rgb [[r g b]] 1.8 +(defn gb-rgb->vga-rgb [[r g b]] 1.9 (let [vga-rgb 1.10 (first (pixels 1.11 (run-moves 1.12 @@ -200,7 +200,7 @@ 1.13 1.14 1.15 (defn gen-gb-color-image! [] 1.16 - (let [im (BufferedImage. 181 182 BufferedImage/TYPE_INT_RGB) 1.17 + (let [im (BufferedImage. 68 69 BufferedImage/TYPE_INT_RGB) 1.18 pix (vec 1.19 1.20 (reduce 1.21 @@ -219,15 +219,15 @@ 1.22 (+ 1000 (- b) r))] 1.23 det))) 1.24 (partition 1.25 - 181 181 [] 1.26 + 68 68 [] 1.27 (sort-by 1.28 (fn euclidean-distance [[r g b]] 1.29 (Math/sqrt (+ (* r r) (* g g) (* b b)))) 1.30 - (vals gb-color-map)))))) 1.31 + (seq (set (vals gb-color-map)))))))) 1.32 view (cortex.sense/view-image) 1.33 - target (File. user-home "proj/vba-clojure/gb-color-map.png")] 1.34 - (dorun (for [x (range 181) y (range 182)] 1.35 - (let [[r g b] (get pix (+ x (* 181 y)) [0 0 0]) 1.36 + target (File. user-home "proj/vba-clojure/gb-color-map-unique.png")] 1.37 + (dorun (for [x (range 68) y (range 69)] 1.38 + (let [[r g b] (get pix (+ x (* 68 y)) [0 0 0]) 1.39 rgb (+ (bit-shift-left r 16) 1.40 (bit-shift-left g 8) 1.41 b)] 1.42 @@ -271,4 +271,4 @@ 1.43 (.write (IIOImage. im nil nil)) 1.44 (.dispose)) 1.45 im)) 1.46 - 1.47 \ No newline at end of file 1.48 +
2.1 Binary file gb-color-map-unique.png has changed