diff src/clojureDemo/MegaDeath.clj @ 1:6d9bdaf919f7

added clojureDemo source
author Robert McIntyre <rlm@mit.edu>
date Fri, 20 Aug 2010 00:32:44 -0400
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/clojureDemo/MegaDeath.clj	Fri Aug 20 00:32:44 2010 -0400
     1.3 @@ -0,0 +1,90 @@
     1.4 +(ns clojureDemo.MegaDeath)
     1.5 +
     1.6 +(import '(java.io File))
     1.7 +(import '(org.apache.commons.io FileUtils))
     1.8 +(import '(javax.imageio ImageIO) )
     1.9 +
    1.10 +(import '(ij.plugin PlugIn))
    1.11 +(import '(ij ImagePlus IJ))
    1.12 +
    1.13 +(import '(ij Macro))
    1.14 +
    1.15 +(import '(java.io BufferedReader InputStreamReader))
    1.16 +(import '(java.awt.image BufferedImage))
    1.17 +
    1.18 +
    1.19 +
    1.20 +(use '[clojureDemo.Xuggle :only (video-seq trans-save flash video-data display)])
    1.21 +
    1.22 +
    1.23 +(use 'clojure.contrib.repl-utils)
    1.24 +(use ['clojureDemo.Defines 
    1.25 +      :only '(
    1.26 +	     lian look getto human0 blow base app0 app1 app2 app3 app4 app5 
    1.27 +		  bounce0 bounce1 bounce2 bounce3 bounce4 bounce5 bounce6
    1.28 +		  collide0 collide1 collide2 collide3 collide4  
    1.29 +		  give0 give1 give2 give3 give4 target default)])
    1.30 +
    1.31 +
    1.32 +(def hamster  (first (video-seq look)))
    1.33 +(def ham (.getImage hamster))
    1.34 +
    1.35 +(set! *print-length* 10)
    1.36 +
    1.37 +
    1.38 +
    1.39 +(defn final-ficker
    1.40 +  "wtf?"
    1.41 +  [& vars]
    1.42 +  (class (last vars)))
    1.43 +
    1.44 +(defmulti log-polar (fn [& args] (class (last args))))
    1.45 +
    1.46 +(defmethod log-polar clojure.lang.LazySeq
    1.47 +  ([X Y video-seq]
    1.48 +     (with-meta (map #(log-polar % X Y) video-seq) (meta video-seq)))
    1.49 +  ([video-seq]
    1.50 +     (with-meta (map #(log-polar %) video-seq) (meta video-seq))))
    1.51 +
    1.52 +
    1.53 +(defmethod log-polar ij.ImagePlus
    1.54 +     [imageP]
    1.55 +     (let [thread (Thread/currentThread)
    1.56 +	   options ""]
    1.57 +       (.setName thread "Run$_polar-transform")
    1.58 +       (Macro/setOptions thread options)
    1.59 +       (IJ/runPlugIn imageP "clojureDemo.Polar_Transformer" "")
    1.60 +       (let [return-image (IJ/getImage)]
    1.61 +	 (.hide return-image)
    1.62 +	 return-image)))
    1.63 +
    1.64 +(defn x-polar2 
    1.65 +     [imageP]
    1.66 +     (let [thread (Thread/currentThread)
    1.67 +	   options ""]
    1.68 +       (.setName thread "Run$_polar-transform")
    1.69 +       (Macro/setOptions thread options)
    1.70 +       (IJ/runPlugIn imageP "clojureDemo.Polar_Transformer" "")))
    1.71 +
    1.72 +
    1.73 +
    1.74 +(defn follow-object
    1.75 +     "takes in a video stream and does the most basic and simple forms of object detection."
    1.76 +     [video-seq]
    1.77 +)
    1.78 +
    1.79 +
    1.80 +
    1.81 +
    1.82 +
    1.83 +
    1.84 +
    1.85 +
    1.86 +
    1.87 +
    1.88 +
    1.89 +(comment
    1.90 +
    1.91 +(do (use :reload-all 'clojureDemo.MegaDeath) (in-ns 'clojureDemo.MegaDeath))
    1.92 +(map #(ns-unmap 'user %)(keys (ns-interns 'user)))
    1.93 +)