# HG changeset patch # User Robert McIntyre # Date 1362626862 0 # Node ID 09461dce2e2fbbe244380903e6512fe773582af8 # Parent fc5bb270596aaf5f06af2783e98d5d5eba1f6e16 cleanup. diff -r fc5bb270596a -r 09461dce2e2f org/gabor.org --- a/org/gabor.org Thu Mar 07 03:12:25 2013 +0000 +++ b/org/gabor.org Thu Mar 07 03:27:42 2013 +0000 @@ -17,8 +17,7 @@ (:import ij.ImagePlus) (:import org.opencv.core.Mat) (:use cortex.sense) - (:use cortex.util) - ) + (:use cortex.util)) (defn load-opencv "Load the opencv native library. Must be called before any OpenCV @@ -55,10 +54,12 @@ (+ (* 2 Math/PI (/ x' wavelength)) phase-offset)))) - half-width (max - (int (* 5 (/ sigma aspect-ratio))) - (int (* 5 sigma)) - (int (* 5 (/ aspect-ratio sigma)))) + half-width + (let [std-dev-capture 5] + (max + (int (* std-dev-capture (/ sigma aspect-ratio))) + (int (* std-dev-capture sigma)) + (int (* std-dev-capture (/ aspect-ratio sigma))))) grid (let [axis (range (- half-width) (inc half-width))] (for [y (reverse axis) x axis] (vector x y))) @@ -70,18 +71,13 @@ mat-width (+ 1 (* 2 half-width)) mat (Mat. mat-width mat-width CvType/CV_32F)] - (.put mat 0 0 (float-array (map gabor grid))) - mat + mat)) - ;;(map gabor grid) - - )) - -(defn show-kernel [kernel] - (let [output "/home/r/proj/cortex/tmp/kernel.png" +(defn draw-kernel! [kernel img-path] + (let [output img-path size (.size kernel) width (int (.width size)) height (int (.height size)) @@ -97,8 +93,12 @@ scaled-vals (map #(* 255 (- % low) (/ (- high low))) vals) new-mat (Mat. height width CvType/CV_32F)] (.put new-mat 0 0 (float-array scaled-vals)) - (org.opencv.highgui.Highgui/imwrite output new-mat) - (view (ImagePlus. output))))) + (org.opencv.highgui.Highgui/imwrite output new-mat)))) + +(defn show-kernel [kernel] + (let [img-path "/home/r/proj/cortex/tmp/kernel.png"] + (draw-kernel kernel img-path) + (view (ImagePlus. output)))) (defn print-kernel [kernel] (println (.dump kernel))) @@ -130,9 +130,7 @@ (org.opencv.highgui.Highgui/imwrite "/home/r/ppp.png" new-mat) (view (ImagePlus. input)) - (view (ImagePlus. output)) - - )) + (view (ImagePlus. output))))