comparison org/sense.org @ 215:f283c62bd212

fixed long standing problem with orientation of eyes in blender, fleshed out text in vision.org
author Robert McIntyre <rlm@mit.edu>
date Fri, 10 Feb 2012 02:19:24 -0700
parents 97b8caf66824
children 7bf3e3d8fb26
comparison
equal deleted inserted replaced
214:01d3e9855ef9 215:f283c62bd212
269 and return a function which takes a list of sense data, uses the 269 and return a function which takes a list of sense data, uses the
270 kernel to convert to images, and displays those images, each in 270 kernel to convert to images, and displays those images, each in
271 its own JFrame." 271 its own JFrame."
272 [sense-display-kernel] 272 [sense-display-kernel]
273 (let [windows (atom [])] 273 (let [windows (atom [])]
274 (fn [data] 274 (fn this
275 (if (> (count data) (count @windows)) 275 ([data]
276 (reset! 276 (this data nil))
277 windows (map (fn [_] (view-image)) (range (count data))))) 277 ([data save-to]
278 (dorun 278 (if (> (count data) (count @windows))
279 (map 279 (reset!
280 (fn [display datum] 280 windows
281 (display (sense-display-kernel datum))) 281 (doall
282 @windows data))))) 282 (map
283 (fn [idx]
284 (if save-to
285 (let [dir (File. save-to (str idx))]
286 (.mkdir dir)
287 (view-image dir))
288 (view-image))) (range (count data))))))
289 (dorun
290 (map
291 (fn [display datum]
292 (display (sense-display-kernel datum)))
293 @windows data))))))
294
283 295
284 (defn points->image 296 (defn points->image
285 "Take a collection of points and visuliaze it as a BufferedImage." 297 "Take a collection of points and visuliaze it as a BufferedImage."
286 [points] 298 [points]
287 (if (empty? points) 299 (if (empty? points)
462 474
463 (nb : the video was created with the following commands) 475 (nb : the video was created with the following commands)
464 476
465 *** Combine Frames with ImageMagick 477 *** Combine Frames with ImageMagick
466 #+begin_src clojure :results silent 478 #+begin_src clojure :results silent
467 (in-ns 'user) 479 (ns cortex.video.magick
468 (import java.io.File) 480 (:import java.io.File)
469 (use 'clojure.contrib.shell-out) 481 (:use clojure.contrib.shell-out))
470 (let 482
471 [idx (atom -1) 483 (defn combine-images []
472 left (rest 484 (let
473 (sort 485 [idx (atom -1)
474 (file-seq (File. "/home/r/proj/cortex/render/bind-sense0/")))) 486 left (rest
475 right (rest 487 (sort
488 (file-seq (File. "/home/r/proj/cortex/render/bind-sense0/"))))
489 right (rest
490 (sort
491 (file-seq
492 (File. "/home/r/proj/cortex/render/bind-sense1/"))))
493 sub (rest
476 (sort 494 (sort
477 (file-seq 495 (file-seq
478 (File. "/home/r/proj/cortex/render/bind-sense1/")))) 496 (File. "/home/r/proj/cortex/render/bind-senseB/"))))
479 sub (rest 497 sub* (concat sub (repeat 1000 (last sub)))]
480 (sort 498 (dorun
481 (file-seq 499 (map
482 (File. "/home/r/proj/cortex/render/bind-senseB/")))) 500 (fn [im-1 im-2 sub]
483 sub* (concat sub (repeat 1000 (last sub)))] 501 (sh "convert" (.getCanonicalPath im-1)
484 (dorun 502 (.getCanonicalPath im-2) "+append"
485 (map 503 (.getCanonicalPath sub) "-append"
486 (fn [im-1 im-2 sub] 504 (.getCanonicalPath
487 (sh "convert" (.getCanonicalPath im-1) 505 (File. "/home/r/proj/cortex/render/bind-sense/"
488 (.getCanonicalPath im-2) "+append" 506 (format "%07d.png" (swap! idx inc))))))
489 (.getCanonicalPath sub) "-append" 507 left right sub*))))
490 (.getCanonicalPath
491 (File. "/home/r/proj/cortex/render/bind-sense/"
492 (format "%07d.png" (swap! idx inc))))))
493 left right sub*)))
494 #+end_src 508 #+end_src
495 509
496 *** Encode Frames with ffmpeg 510 *** Encode Frames with ffmpeg
497 511
498 #+begin_src sh :results silent 512 #+begin_src sh :results silent
557 571
558 #+begin_src clojure :tangle ../src/cortex/test/sense.clj 572 #+begin_src clojure :tangle ../src/cortex/test/sense.clj
559 <<test-header>> 573 <<test-header>>
560 <<test>> 574 <<test>>
561 #+end_src 575 #+end_src
576
577 #+begin_src clojure :tangle ../src/cortex/video/magick.clj
578 <<magick>>
579 #+end_src