changeset 0:163bf9b2fd13

initial import
author Robert McIntyre <rlm@mit.edu>
date Thu, 19 Aug 2010 22:24:41 -0400
parents
children 6d9bdaf919f7
files lib/OpenCV.jar lib/clojure-contrib-src.jar lib/clojure-contrib.jar lib/clojure-sources.jar lib/clojure.jar lib/commons-cli.jar lib/commons-exec-1.0.1.jar lib/commons-io-1.4.jar lib/commons-logging-1.1.jar lib/core.jar lib/edu.mit.jwi_2.1.5_jdk.jar lib/ffmpeg-java.jar lib/genesis_clojure.jar lib/icollections.jar lib/ij.jar lib/jai_core.jar lib/javacup_11a_beta-kab_mods-with-JLex_1_2_6.jar lib/javacv.jar lib/jgraph.jar lib/jmf.jar lib/jna.jar lib/junit.jar lib/logback-classic.jar lib/logback-core.jar lib/nailgun-0.7.1.jar lib/sisc.jar lib/slf4j-api.jar lib/stanford-parser-2007-08-19.jar lib/swank-clojure.jar lib/twitter4j-core-2.1.2.jar lib/ws-commons-util-1.0.2.jar lib/xmlrpc-client-3.1-sources.jar lib/xmlrpc-client-3.1.jar lib/xmlrpc-common-3.1-sources.jar lib/xmlrpc-common-3.1.jar lib/xmlrpc-server-3.1-sources.jar lib/xmlrpc-server-3.1.jar lib/xstream-1.2.2.jar lib/xuggle-xuggler-test.jar lib/xuggle-xuggler.jar lib/yamlbeans-1.0.jar slime-port.txt src/laser/rasterize.clj swank-laser
diffstat 44 files changed, 72 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
     1.1 Binary file lib/OpenCV.jar has changed
     2.1 Binary file lib/clojure-contrib-src.jar has changed
     3.1 Binary file lib/clojure-contrib.jar has changed
     4.1 Binary file lib/clojure-sources.jar has changed
     5.1 Binary file lib/clojure.jar has changed
     6.1 Binary file lib/commons-cli.jar has changed
     7.1 Binary file lib/commons-exec-1.0.1.jar has changed
     8.1 Binary file lib/commons-io-1.4.jar has changed
     9.1 Binary file lib/commons-logging-1.1.jar has changed
    10.1 Binary file lib/core.jar has changed
    11.1 Binary file lib/edu.mit.jwi_2.1.5_jdk.jar has changed
    12.1 Binary file lib/ffmpeg-java.jar has changed
    13.1 Binary file lib/genesis_clojure.jar has changed
    14.1 Binary file lib/icollections.jar has changed
    15.1 Binary file lib/ij.jar has changed
    16.1 Binary file lib/jai_core.jar has changed
    17.1 Binary file lib/javacup_11a_beta-kab_mods-with-JLex_1_2_6.jar has changed
    18.1 Binary file lib/javacv.jar has changed
    19.1 Binary file lib/jgraph.jar has changed
    20.1 Binary file lib/jmf.jar has changed
    21.1 Binary file lib/jna.jar has changed
    22.1 Binary file lib/junit.jar has changed
    23.1 Binary file lib/logback-classic.jar has changed
    24.1 Binary file lib/logback-core.jar has changed
    25.1 Binary file lib/nailgun-0.7.1.jar has changed
    26.1 Binary file lib/sisc.jar has changed
    27.1 Binary file lib/slf4j-api.jar has changed
    28.1 Binary file lib/stanford-parser-2007-08-19.jar has changed
    29.1 Binary file lib/swank-clojure.jar has changed
    30.1 Binary file lib/twitter4j-core-2.1.2.jar has changed
    31.1 Binary file lib/ws-commons-util-1.0.2.jar has changed
    32.1 Binary file lib/xmlrpc-client-3.1-sources.jar has changed
    33.1 Binary file lib/xmlrpc-client-3.1.jar has changed
    34.1 Binary file lib/xmlrpc-common-3.1-sources.jar has changed
    35.1 Binary file lib/xmlrpc-common-3.1.jar has changed
    36.1 Binary file lib/xmlrpc-server-3.1-sources.jar has changed
    37.1 Binary file lib/xmlrpc-server-3.1.jar has changed
    38.1 Binary file lib/xstream-1.2.2.jar has changed
    39.1 Binary file lib/xuggle-xuggler-test.jar has changed
    40.1 Binary file lib/xuggle-xuggler.jar has changed
    41.1 Binary file lib/yamlbeans-1.0.jar has changed
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/slime-port.txt	Thu Aug 19 22:24:41 2010 -0400
    42.3 @@ -0,0 +1,1 @@
    42.4 +4005
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/src/laser/rasterize.clj	Thu Aug 19 22:24:41 2010 -0400
    43.3 @@ -0,0 +1,65 @@
    43.4 +(ns laser.rasterize)
    43.5 +
    43.6 +(import '(java.io File))
    43.7 +(import '(org.apache.commons.io FileUtils))
    43.8 +(import '(javax.imageio ImageIO) )
    43.9 +(import '(javax.swing JFrame))
   43.10 +(import '(java.awt Color BorderLayout))
   43.11 +(import '(ij ImagePlus IJ))
   43.12 +(import '(java.lang Math))
   43.13 +
   43.14 +(import '(ij Macro))
   43.15 +
   43.16 +(import '(java.io BufferedReader InputStreamReader))
   43.17 +(import '(java.awt.image BufferedImage))
   43.18 +
   43.19 +(use 'clojure.contrib.str-utils)
   43.20 +
   43.21 +(use 'clojure.contrib.combinatorics)
   43.22 +
   43.23 +
   43.24 +(use 'clojure.contrib.repl-utils)
   43.25 +
   43.26 +(set! *print-length* 20)
   43.27 +
   43.28 +
   43.29 +(def img "/home/r/graster/test.png")
   43.30 +
   43.31 +(defn frame-hash
   43.32 +  "yields a convienent representation for the pixles in an image.
   43.33 +   Because of the size of the structvre generated, this must only be used
   43.34 +   in a transient way so that java can do it's garbage collection."
   43.35 +  [#^java.lang.String image-name]
   43.36 +  (let [image+ (ImagePlus. image-name)]
   43.37 +    (with-meta
   43.38 +      (let [buf (.. image+ getBufferedImage)
   43.39 +	    color (.getColorModel buf)]
   43.40 +	(apply hash-map 
   43.41 +	       (interleave 
   43.42 +		(doall (for [x (range (.getWidth image+)) y (range (.getHeight image+))]
   43.43 +			 (vector x y)))
   43.44 +		(doall (for [x (range (.getWidth image+)) y (range (.getHeight image+))]
   43.45 +			 (let [data (.getRGB buf x y)] 
   43.46 +			   (hash-map :r (bit-shift-right (bit-and 0xff0000 data) 16)
   43.47 +				     :g (bit-shift-right (bit-and 0x00ff00 data) 8)
   43.48 +				     :b (bit-and 0x0000ff data))))))))
   43.49 +      {:width  (.getWidth image+) :height (.getHeight image+)})))
   43.50 +
   43.51 +
   43.52 +(defn frame-hash->bufferedImage
   43.53 +  [frame-hash]
   43.54 +    (let [data  (meta frame-hash)
   43.55 +	image (BufferedImage. (:width data) (:height data) BufferedImage/TYPE_INT_BGR)]
   43.56 +	
   43.57 +	(doall (for [element frame-hash] 
   43.58 +	  (let [coord  (key element) 
   43.59 +		rgb   (val element)
   43.60 +		packed-RGB 
   43.61 +		(+ (bit-shift-left (:r rgb) 16)
   43.62 +		   (bit-shift-left (:g rgb) 8)
   43.63 +		                   (:b rgb))]
   43.64 +	    (.setRGB image (first coord) (last coord) packed-RGB))))
   43.65 +	image))
   43.66 +
   43.67 +
   43.68 +
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/swank-laser	Thu Aug 19 22:24:41 2010 -0400
    44.3 @@ -0,0 +1,6 @@
    44.4 +":";exec java -verbose:gc -Xmn700M -Xms1g -Xmx1g -cp $HOME/lasercutter/src:$HOME/lasercutter/lib/* clojure.main $0 $*;
    44.5 +
    44.6 +(do 
    44.7 +  (require 'swank.swank) 
    44.8 +;  (use :reload-all ['mobius :only ['switch-mobius]])
    44.9 +  (swank.swank/start-repl 4005))