# HG changeset patch # User Robert McIntyre # Date 1329452068 25200 # Node ID 47fe4f7b74b3715e244ce5879f1590a096f2350a # Parent 85f3ff3e3f26d81de8a4f25ae07f6ae770bb9dd3 rendering video for the first time! diff -r 85f3ff3e3f26 -r 47fe4f7b74b3 org/integration.org --- a/org/integration.org Thu Feb 16 20:05:54 2012 -0700 +++ b/org/integration.org Thu Feb 16 21:14:28 2012 -0700 @@ -391,74 +391,8 @@ 29 :pinky-1-e ) - - -;; rotate touch 180 - -;; rotate mucles 90 counter-clockwise -;; scale muscles to 15x60 - -finger width : 113 -finger height : 357 - -thumb width : 113 - -pinky --- 0,195 -ring --- 111,100 -middle --- 228,0 -pointer -- 436,96 -thumb --- 486,420 - - - -within a finger (coordinates of top left corner (x,y)): - -tip-flexor : 0,7 -tip-extensor : 98,7 -tip : 18,0 - -joint-2-3 : 32,79 - -mid-flexor : 19,131 -mid-extensor : 80,131 -mid : 30,133 - -joint-1-2 : 32,193 - -base-flexor : 19,245 -base-extensor : 80,245 -base : 39,247 - -joint-palm-1 : 32,307 - - -Thumb is the same as finger, except it has two more pieces - -extra-flexor-1 : 2,131 -extra-flexor-2 : 100,131 - -;; rotate entire thumb 45 degrees clockwise - -within vision -gray -- 165,577 -green -- 278,577 -blue -- 165,682 -red -- 278,682 - -entire hand : 809, 22 -main view : 78,202 -hearing : 784,819 - -hand-size: 688x769 - - -total image size: -1600x894 - (def base (File. "/home/r/proj/cortex/render/hand")) - - (defn prepare-muscle [muscle] ["(" muscle "-rotate" "90" "-scale" "15x60!" ")"]) @@ -484,6 +418,97 @@ joint-1-2 "-geometry" "+32+193" "-composite" ")"]) +(defn file-names [#^File dir] + (map #(.getCanonicalPath %) (next (sort (file-seq dir))))) + +(defn file-groups [& paths] + (apply (partial map list ) + (map (comp file-names #(File. base %)) + paths))) + + +(defn pinky [] + (file-groups + "muscle/18" + "muscle/19" + "touch/5" + "proprio/7" + + "muscle/17" + "muscle/16" + "touch/4" + "proprio/8" + + "muscle/28" + "muscle/29" + "touch/3" + "proprio/10")) + +(defn ring [] + (file-groups + "muscle/21" + "muscle/20" + "touch/11" + "proprio/5" + + "muscle/22" + "muscle/23" + "touch/10" + "proprio/6" + + "muscle/25" + "muscle/24" + "touch/9" + "proprio/12")) + +(defn middle [] + (file-groups + "muscle/14" + "muscle/15" + "touch/2" + "proprio/1" + + "muscle/12" + "muscle/13" + "touch/1" + "proprio/0" + + "muscle/8" + "muscle/9" + "touch/0" + "proprio/9")) + +(defn pointer [] + (file-groups + "muscle/10" + "muscle/11" + "touch/8" + "proprio/4" + + "muscle/1" + "muscle/0" + "touch/7" + "proprio/3" + + "muscle/5" + "muscle/4" + "touch/6" + "proprio/11")) + +(defn thumb [] + (file-groups + "muscle/7" + "muscle/6" + "touch/13" + "proprio/2" + + "muscle/27" + "muscle/26" + "muscle/3" + "muscle/2" + "touch/12" + "proprio/13")) + (defn generate-finger [tip-flexor tip-extensor tip joint-2-3 @@ -520,13 +545,6 @@ (prepare-muscle mid-extensor-2) "-geometry" "+100+131" "-composite" ")"]) -pinky --- 0,195 -ring --- 111,100 -middle --- 228,0 -pointer -- 436,96 -thumb --- 486,420 - - (defn generate-hand [pinky-pieces ring-pieces @@ -558,8 +576,6 @@ red "-geometry" "+113+105" "-composite" ")"]) - - (def test-muscle (File. base "muscle/0/0000000.png")) (def test-proprio (File. base "proprio/0/0000000.png")) (def test-tip (File. base "touch/2/0000000.png")) @@ -568,41 +584,45 @@ (def test-hearing (File. base "hearing/0/0000000.png")) (def test-main (File. base "main/0000000.png")) - (def test-target (File. base "output.png")) (def background (File. base "background.png")) (use 'clojure.contrib.shell-out) -(defn final-image [muscle proprio tip mid vision hearing main] - (let [[muscle proprio tip mid vision hearing main] (map #(.getCanonicalPath %) - [muscle proprio tip mid vision - hearing main]) - finger-pieces [muscle muscle tip - proprio - muscle muscle mid - proprio - muscle muscle mid - proprio] - thumb-pieces [muscle muscle tip - proprio - muscle muscle muscle muscle mid - proprio]] - - - (apply + +(defn vision [] + (file-groups + "vision/0" + "vision/1" + "vision/2" + "vision/3")) + +(defn hearing [] + (file-names (File. base "hearing/0"))) + +(defn main [] + (file-names (File. base "main"))) + +(defn targets [] + (map + (comp #(.getCanonicalPath %) + #(File. (str base "/out/" (format "%07d.png" %)))) + (range 0 (count (main))))) + + +(defn final-image [main [all red green blue] hearing + pinky ring middle pointer thumb target] + (println target) + (apply sh (flatten ["convert" (.getCanonicalPath background) - (generate-hand finger-pieces - finger-pieces - finger-pieces - finger-pieces - thumb-pieces) + + (generate-hand pinky ring middle pointer thumb) "-geometry" "+809+22" "-composite" - (generate-vision vision vision vision vision) + (generate-vision all red green blue) "-geometry" "+974+599" "-composite" hearing @@ -611,17 +631,32 @@ main "-geometry" "+78+202" "-composite" - (.getCanonicalPath test-target)])))) + target]))) +(defn convert-files [] + (dorun + (pmap final-image + (main) + (vision) + (hearing) + (pinky) + (ring) + (middle) + (pointer) + (thumb) + (targets)))) +#+end_src - +#+begin_src sh +cd /home/r/proj/cortex/render/hand - +ffmpeg -r 60 -i out/%07d.png -i main.wav -b:a 128k \ + -b:v 9000k -c:a libvorbis -c:v libtheora hand.ogg #+end_src #+results: integration -: #'cortex.integration/test-everything! +: #'cortex.integration/convert-files * COMMENT purgatory #+begin_src clojure