<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Randomizing Discovery // Life :: Work :: Play &#187; proce55ing</title>
	<atom:link href="http://www.randomizingdiscovery.com/tag/proce55ing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.randomizingdiscovery.com</link>
	<description>Exploring basic programmatic concepts to create complex visualizations. The work and experiments of Corey Hankey. Processing, Actionscript,  Web Development.</description>
	<lastBuildDate>Sat, 06 Mar 2010 19:39:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Detecting Motion.</title>
		<link>http://www.randomizingdiscovery.com/2008/06/28/detecting-motion/</link>
		<comments>http://www.randomizingdiscovery.com/2008/06/28/detecting-motion/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 05:28:27 +0000</pubDate>
		<dc:creator>chankey</dc:creator>
				<category><![CDATA[Discoveries]]></category>
		<category><![CDATA[convolution]]></category>
		<category><![CDATA[image manipulation]]></category>
		<category><![CDATA[motion detection]]></category>
		<category><![CDATA[proce55ing]]></category>
		<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://www.randomizingdiscovery.com/?p=18</guid>
		<description><![CDATA[After taking a little time to research how other people were creating motion detection algorithms I decided to go with using the difference blend mode to detect what was changing from frame to frame. The first few tests I ran were very efficient but the results were not very accurate. I created a previous and [...]]]></description>
			<content:encoded><![CDATA[<p>After taking a little time to research how other people were creating motion detection algorithms I decided to go with using the difference blend mode to detect what was changing from frame to frame. The first few tests I ran were very efficient but the results were not very accurate. I created a previous and next pixel array that stored the two images&#8217; data and then blended the two images together into a new pixel array.</p>
<p>Now that I had all the pixel data I took a closer look at the convolution filter section in the Processing book. Convolution filters enhance certain features in an the image based on a multi-dimensional kernel array that is used to manipulate the pixels. After a little work and some experimenting I found a kernel that enhanced the motion changes in the image.</p>
<p>The problem now was that this process was very processor intensive and wouldn&#8217;t allow for more features to be added to the program. I shrank the camera capture dimensions and ran the algorithm on the new pixel data. Then I just scaled the final pixel data to fit the screen as it was drawn. This change took the load on the processor down from 50% to 27% while keeping the results of the motion detection.</p>
<p>Here are the Results (application zip): <a href="http://content.coreyhankey.com/motion_detect_01/motion_detect.zip" target="_blank">Motion Detection 01</a></p>
<pre class="brush: java">
import processing.video.*;
Capture cam;
PImage prev;
PImage cur;
int count;
// convolution kernal
float[][] kernal = { { -1, -2, -1 },
                     { 0, 0, 0 },
                     { 1, 2, 1 } };

void setup() {

  size(640, 480);
  count = 0;
  // If no device is specified, will just use the default.
  cam = new Capture(this, 320, 240);
  frameRate(24);
  // create previous and current images =====
  prev = createImage(width/2, height/2, RGB);
  cur = createImage(width/2, height/2, RGB);
  prev.loadPixels();
  cur.loadPixels();
}

void draw() {

  if (cam.available() == true) {
     cam.read();
    // capture every third frame into the previous image
    // this can be changed to get more drastic results =
    if(count &gt; 2)
    {
      arraycopy(cur.pixels, prev.pixels);
      count = 0;
    }
    count ++;
    cam.loadPixels();
    cur.pixels = cam.pixels;
    prev.updatePixels();
    cur.updatePixels();

    // calculate the difference in the 2 frames ==================
    cur.blend(prev,0,0,width/2,height/2,0,0,width/2,height/2, DIFFERENCE);
    cur.loadPixels();

    // create a new image to store the pixel data in =================
    PImage eImg = createImage(320, 240, RGB);

    // run convolution filter =============
    // from book : Processing pg. 360 =====
    for(int y = 1; y &lt; 240-1; y++)
    {
      for(int x =1; x &lt; 320-1; x++)
       {
          float sum = 0;
          for(int ky = -1; ky &lt;= 1; ky ++)
          {
            for(int kx= -1; kx &lt;= 1; kx ++)
            {
              // calc next pixel =========
              int pos = (y+ky)*320 + (x+kx);
              float val = red(cur.pixels[pos]);
              sum += kernal[ky+1][kx+1]+ val;
            }
          }
          eImg.pixels[y*320 + x] = color(sum);
       }
    }
     eImg.updatePixels();
     // scale image up to fill th screen ===========
     scale(2,2);

     // draw manipulated data to the screen =========
     image(eImg, 0,0);

     // thresh hold filter converts to black and white only ====
     filter(THRESHOLD, .95);
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.randomizingdiscovery.com/2008/06/28/detecting-motion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brownian Movement Gets Moving.</title>
		<link>http://www.randomizingdiscovery.com/2008/03/21/brownian-movement-gets-moving/</link>
		<comments>http://www.randomizingdiscovery.com/2008/03/21/brownian-movement-gets-moving/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 05:46:31 +0000</pubDate>
		<dc:creator>chankey</dc:creator>
				<category><![CDATA[Discoveries]]></category>
		<category><![CDATA[Bownian Movement]]></category>
		<category><![CDATA[Motion]]></category>
		<category><![CDATA[proce55ing]]></category>
		<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://www.randomizingdiscovery.com/?p=14</guid>
		<description><![CDATA[
Brownian Lines from Corey Hankey on Vimeo
Its been a while but I decided it was time to get back to it. After taking some time to read more from the processing book I discovered that processing renders at the a specified frame rate. Unlike flash which will skip to keep up with the processor, processing [...]]]></description>
			<content:encoded><![CDATA[<p><object height="254" width="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"><param value="best" name="quality" /><param value="true" name="allowfullscreen" /><param value="showAll" name="scale" /><param value="http://www.vimeo.com/moogaloop.swf?clip_id=807339&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF" name="src" /><embed height="254" width="400" src="http://www.vimeo.com/moogaloop.swf?clip_id=807339&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF" scale="showAll" allowfullscreen="true" quality="best" type="application/x-shockwave-flash"></embed></object><br />
<a href="http://www.vimeo.com/807339/l:embed_807339">Brownian Lines</a> from <a href="http://www.vimeo.com/user408861/l:embed_807339">Corey Hankey</a> on <a href="http://vimeo.com/l:embed_807339">Vimeo</a></p>
<p>Its been a while but I decided it was time to get back to it. After taking some time to read more from the processing book I discovered that processing renders at the a specified frame rate. Unlike flash which will skip to keep up with the processor, processing renders can be saved out in an image sequence similar to a 3d program like Maya or Cinema4D.</p>
<p>This concept gave me some inspiration to create more complex animations using the saveFrame() method. I started off by collecting my colors from images in my photo library containing things that I enjoyed like my wife or the great outdoors. I used a for loop to create 2000 lines on the stage at when the program was started and then grabbed a brew while processing rendered out the 300 frames that I specified.</p>
<p>I have included a few vimeo videos that I posted but&#8230;&#8230; they just don&#8217;t do the animation justice so I posted a quicktime of the blue render here: <a href="http://content.coreyhankey.com/video/brownianMovement_001.mov">Brownian Quicktime.</a><a target="_blank" href="http://www.vimeo.com/807457"><br />
Vimeo version</a></p>
<p>Screen shots:<br />
Color from my wifes portrait.<br />
<a href="http://www.flickr.com/photos/hankeys/2348469539/" title="Brownian Lines Animation by Corey Hankey, on Flickr"><img src="http://farm3.static.flickr.com/2229/2348469539_aa48e3f7d7.jpg" alt="Brownian Lines Animation" height="317" width="500" /></a></p>
<p>Colors from a day of skiing:<br />
<a href="http://www.flickr.com/photos/hankeys/2348519883/" title="Brownian Lines Get Moving by Corey Hankey, on Flickr"><img src="http://farm3.static.flickr.com/2341/2348519883_75e44346ea.jpg" alt="Brownian Lines Get Moving" height="317" width="500" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomizingdiscovery.com/2008/03/21/brownian-movement-gets-moving/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://content.coreyhankey.com/video/brownianMovement_001.mov" length="25072950" type="video/quicktime" />
		</item>
		<item>
		<title>Getting things moving.</title>
		<link>http://www.randomizingdiscovery.com/2008/02/13/getting-things-moving/</link>
		<comments>http://www.randomizingdiscovery.com/2008/02/13/getting-things-moving/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 06:42:18 +0000</pubDate>
		<dc:creator>chankey</dc:creator>
				<category><![CDATA[Discoveries]]></category>
		<category><![CDATA[brownian movement]]></category>
		<category><![CDATA[proce55ing]]></category>
		<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://www.coreyhankey.com/?p=11</guid>
		<description><![CDATA[


I recently purchased the  processing book from Ben Fry and Casey Reas and started to get more familiar with the syntax in processing. With this knowledge I was able to begin to expand on my recent Brownian Movement experiments. This time I am not using an additive stage, but instead I am clearing  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/hankeys/2261674919/" title="Brownian Movement by Corey Hankey, on Flickr"><img src="http://farm3.static.flickr.com/2252/2261674919_33f6930f32.jpg" alt="Brownian Movement" height="333" width="500" /></a></p>
<p><a href="http://www.flickr.com/photos/hankeys/2262465776/" title="Brownian Movement by Corey Hankey, on Flickr"><img src="http://farm3.static.flickr.com/2046/2262465776_64af039367.jpg" alt="Brownian Movement" height="317" width="500" /></a></p>
<p><a href="http://www.flickr.com/photos/hankeys/2262465668/" title="Brownian Movement by Corey Hankey, on Flickr"><img src="http://farm3.static.flickr.com/2116/2262465668_d3e023cb85.jpg" alt="Brownian Movement" height="317" width="500" /></a></p>
<p>I recently purchased the  processing book from <a target="_blank" href="http://b&lt;/code&gt;enfry.com/">Ben Fry</a> and <a target="_blank" href="http://reas.com/">Casey Reas</a> and started to get more familiar with the syntax in processing. With this knowledge I was able to begin to expand on my recent Brownian Movement experiments. This time I am not using an additive stage, but instead I am clearing  and redrawing the stage on every cycle to allow the particles to have a more distinct motion.</p>
<p>This is pretty basic example but the motion and the particle grouping turned out better than I expected so I figured I would share my results. I will clean the code up a bit  and post it at a later date.</p>
<p>See it in action: <a target="_blank" href="http://content.coreyhankey.com/brownian_motion_01/">Brownian Movement in Motion</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomizingdiscovery.com/2008/02/13/getting-things-moving/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
