diff 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
line wrap: on
line diff
     1.1 --- a/org/sense.org	Thu Feb 09 09:04:17 2012 -0700
     1.2 +++ b/org/sense.org	Fri Feb 10 02:19:24 2012 -0700
     1.3 @@ -271,15 +271,27 @@
     1.4     its own JFrame."
     1.5    [sense-display-kernel]
     1.6    (let [windows (atom [])]
     1.7 -    (fn [data]
     1.8 -      (if (> (count data) (count @windows))
     1.9 -        (reset! 
    1.10 -         windows (map (fn [_] (view-image)) (range (count data)))))
    1.11 -      (dorun
    1.12 -       (map
    1.13 -        (fn [display datum]
    1.14 -          (display (sense-display-kernel datum)))
    1.15 -        @windows data)))))
    1.16 +    (fn this
    1.17 +      ([data]
    1.18 +       (this data nil))
    1.19 +      ([data save-to]
    1.20 +         (if (> (count data) (count @windows))
    1.21 +           (reset! 
    1.22 +            windows
    1.23 +            (doall 
    1.24 +             (map
    1.25 +             (fn [idx]
    1.26 +               (if save-to
    1.27 +                 (let [dir (File. save-to (str idx))]
    1.28 +                   (.mkdir dir)
    1.29 +                   (view-image dir))
    1.30 +                 (view-image))) (range (count data))))))
    1.31 +         (dorun
    1.32 +          (map
    1.33 +           (fn [display datum]
    1.34 +             (display (sense-display-kernel datum)))
    1.35 +           @windows data))))))
    1.36 +         
    1.37  
    1.38  (defn points->image
    1.39    "Take a collection of points and visuliaze it as a BufferedImage."
    1.40 @@ -464,33 +476,35 @@
    1.41  
    1.42  *** Combine Frames with ImageMagick
    1.43  #+begin_src clojure :results silent
    1.44 -(in-ns 'user)
    1.45 -(import java.io.File)
    1.46 -(use 'clojure.contrib.shell-out)
    1.47 -(let
    1.48 -    [idx (atom -1)
    1.49 -     left (rest 
    1.50 -           (sort
    1.51 -           (file-seq (File. "/home/r/proj/cortex/render/bind-sense0/"))))
    1.52 -     right (rest
    1.53 +(ns cortex.video.magick
    1.54 +  (:import java.io.File)
    1.55 +  (:use clojure.contrib.shell-out))
    1.56 +
    1.57 +(defn combine-images []
    1.58 +  (let    
    1.59 +      [idx (atom -1)
    1.60 +       left (rest 
    1.61 +             (sort
    1.62 +              (file-seq (File. "/home/r/proj/cortex/render/bind-sense0/"))))
    1.63 +       right (rest
    1.64 +              (sort
    1.65 +               (file-seq
    1.66 +                (File. "/home/r/proj/cortex/render/bind-sense1/"))))
    1.67 +       sub (rest
    1.68              (sort
    1.69               (file-seq
    1.70 -              (File. "/home/r/proj/cortex/render/bind-sense1/"))))
    1.71 -     sub (rest
    1.72 -          (sort
    1.73 -           (file-seq
    1.74 -            (File. "/home/r/proj/cortex/render/bind-senseB/"))))
    1.75 -     sub* (concat sub (repeat 1000 (last sub)))]
    1.76 -  (dorun
    1.77 -   (map  
    1.78 -    (fn [im-1 im-2 sub]
    1.79 -      (sh "convert" (.getCanonicalPath im-1)
    1.80 -          (.getCanonicalPath im-2) "+append"
    1.81 -          (.getCanonicalPath sub) "-append"
    1.82 -          (.getCanonicalPath
    1.83 -           (File. "/home/r/proj/cortex/render/bind-sense/"
    1.84 -                  (format "%07d.png" (swap! idx inc))))))
    1.85 -    left right sub*)))
    1.86 +              (File. "/home/r/proj/cortex/render/bind-senseB/"))))
    1.87 +       sub* (concat sub (repeat 1000 (last sub)))]
    1.88 +    (dorun
    1.89 +     (map  
    1.90 +      (fn [im-1 im-2 sub]
    1.91 +        (sh "convert" (.getCanonicalPath im-1)
    1.92 +            (.getCanonicalPath im-2) "+append"
    1.93 +            (.getCanonicalPath sub) "-append"
    1.94 +            (.getCanonicalPath
    1.95 +             (File. "/home/r/proj/cortex/render/bind-sense/"
    1.96 +                    (format "%07d.png" (swap! idx inc))))))
    1.97 +      left right sub*))))
    1.98  #+end_src
    1.99  
   1.100  *** Encode Frames with ffmpeg
   1.101 @@ -559,3 +573,7 @@
   1.102  <<test-header>>
   1.103  <<test>>
   1.104  #+end_src
   1.105 +
   1.106 +#+begin_src clojure :tangle ../src/cortex/video/magick.clj
   1.107 +<<magick>>
   1.108 +#+end_src