<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>andybest.net</title>
	
	<link>http://andybest.net</link>
	<description>The Website and Portfolio of Andy Best</description>
	<lastBuildDate>Fri, 26 Feb 2010 04:34:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Andybestnet" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="andybestnet" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>5 Processing Video Tutorials</title>
		<link>http://andybest.net/2010/01/5-processing-video-tutorials/</link>
		<comments>http://andybest.net/2010/01/5-processing-video-tutorials/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 21:50:45 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://andybest.net/?p=181</guid>
		<description><![CDATA[Not had the chance to post for a while since I&#8217;ve been very busy with work, but I thought I&#8217;d share this series of 5 Processing video tutorials that I did for Switchboard back in November. They explore the basics of Processing as well as the use of FFT to create audio reactive sketches. You [...]]]></description>
			<content:encoded><![CDATA[<p>Not had the chance to post for a while since I&#8217;ve been very busy with work, but I thought I&#8217;d share this series of 5 Processing video tutorials that I did for <a href="http://switchboardonline.co.uk/">Switchboard</a> back in November. They explore the basics of Processing as well as the use of FFT to create audio reactive sketches.</p>
<p>You can find the original post on Switchboard <a href="http://switchboardonline.co.uk/?p=66">here</a>, and I have embedded the 5 videos after the break for the sake of convenience.</p>
<p><span id="more-181"></span><object type="application/x-shockwave-flash" width="460" height="360" data="http://www.vimeo.com/moogaloop.swf?clip_id=7577907&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=7577907&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object></p>
<p><object type="application/x-shockwave-flash" width="460" height="360" data="http://www.vimeo.com/moogaloop.swf?clip_id=7578037&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=7578037&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object></p>
<p><object type="application/x-shockwave-flash" width="460" height="360" data="http://www.vimeo.com/moogaloop.swf?clip_id=7578280&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=7578280&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object></p>
<p><object type="application/x-shockwave-flash" width="460" height="360" data="http://www.vimeo.com/moogaloop.swf?clip_id=7586074&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=7586074&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object></p>
<p><object type="application/x-shockwave-flash" width="460" height="360" data="http://www.vimeo.com/moogaloop.swf?clip_id=7596987&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=7596987&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Andybestnet?a=61RUaqwo3dQ:WHElA1NuSrQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Andybestnet?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=61RUaqwo3dQ:WHElA1NuSrQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=61RUaqwo3dQ:WHElA1NuSrQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=61RUaqwo3dQ:WHElA1NuSrQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=61RUaqwo3dQ:WHElA1NuSrQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=61RUaqwo3dQ:WHElA1NuSrQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=61RUaqwo3dQ:WHElA1NuSrQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=61RUaqwo3dQ:WHElA1NuSrQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=61RUaqwo3dQ:WHElA1NuSrQ:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://andybest.net/2010/01/5-processing-video-tutorials/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Twitter Generative Music</title>
		<link>http://andybest.net/2009/07/twitter-generative-music/</link>
		<comments>http://andybest.net/2009/07/twitter-generative-music/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 16:31:56 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andybest.net/?p=172</guid>
		<description><![CDATA[I haven&#8217;t written a post for a while, and I think that it is about time that I put some of my MA work on here, so I&#8217;ll just show a quick sample of one of the prototypes. In my MA project, I explore ways to produce sound from sources of data like Twitter. I [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t written a post for a while, and I think that it is about time that I put some of my MA work on here, so I&#8217;ll just show a quick sample of one of the prototypes.</p>
<p>In my MA project, I explore ways to produce sound from sources of data like Twitter. I not only wanted to produce something that sounds interesting, I also wanted to have some meaning behind what was produced, so I am developing a system to relate the sounds produced to the content of the messages. I shall explain more about this system in a later post once I have finished the work I am doing on it at the moment, but for now, I shall share a sample from a prototype of the project written in Processing.</p>
<p>What you&#8217;re hearing is Processing &#8230;processing&#8230; the Twitter feed and outputting MIDI notes to Ableton live. This was an early prototype which was keyword based.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Andybestnet?a=BBdZDTsDSk8:aQdrgOuI1Es:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Andybestnet?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=BBdZDTsDSk8:aQdrgOuI1Es:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=BBdZDTsDSk8:aQdrgOuI1Es:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=BBdZDTsDSk8:aQdrgOuI1Es:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=BBdZDTsDSk8:aQdrgOuI1Es:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=BBdZDTsDSk8:aQdrgOuI1Es:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=BBdZDTsDSk8:aQdrgOuI1Es:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=BBdZDTsDSk8:aQdrgOuI1Es:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=BBdZDTsDSk8:aQdrgOuI1Es:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://andybest.net/2009/07/twitter-generative-music/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
<enclosure url="http://andybest.net/content/music/twitter_improv_dist.mp3" length="3964342" type="audio/mpeg" />
		</item>
		<item>
		<title>Experiments in Social Network Recursion</title>
		<link>http://andybest.net/2009/03/experiments-in-social-network-recursion/</link>
		<comments>http://andybest.net/2009/03/experiments-in-social-network-recursion/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 23:08:48 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://andybest.net/2009/03/experiments-in-social-network-recursion/</guid>
		<description><![CDATA[http://twitter.com/andybest/status/1313198417]]></description>
			<content:encoded><![CDATA[<p><a href="http://twitter.com/andybest/status/1313198417">http://twitter.com/andybest/status/1313198417</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Andybestnet?a=5eH8iDAQqOA:MtYRbWEy_G0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Andybestnet?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=5eH8iDAQqOA:MtYRbWEy_G0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=5eH8iDAQqOA:MtYRbWEy_G0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=5eH8iDAQqOA:MtYRbWEy_G0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=5eH8iDAQqOA:MtYRbWEy_G0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=5eH8iDAQqOA:MtYRbWEy_G0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=5eH8iDAQqOA:MtYRbWEy_G0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=5eH8iDAQqOA:MtYRbWEy_G0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=5eH8iDAQqOA:MtYRbWEy_G0:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://andybest.net/2009/03/experiments-in-social-network-recursion/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Processing Sketches in a Tweet</title>
		<link>http://andybest.net/2009/02/processing-sketches-in-a-tweet/</link>
		<comments>http://andybest.net/2009/02/processing-sketches-in-a-tweet/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 00:28:15 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.andybest.net/?p=147</guid>
		<description><![CDATA[Today I have been writing Processing sketches that fit within Twitter&#8217;s 140 character limit. Why, I don&#8217;t quite know, but it certainly is fun. Here are some of my attempts. My first attempt- a resizing circle thingy&#8230; int c,f;void setup&#40;&#41;&#123;size&#40;640,480&#41;;c=0;f=255;colorMode&#40;HSB&#41;;&#125; void draw&#40;&#41;&#123;background&#40;color&#40;c,f,f&#41;&#41;;ellipse&#40;320,240,c,c&#41;;c=&#40;c++&#62;255&#41;?0:c;&#125; My second attempt- printing the colour spectrum in squares. int w = 160;int [...]]]></description>
			<content:encoded><![CDATA[<p>Today I have been writing Processing sketches that fit within Twitter&#8217;s 140 character limit. Why, I don&#8217;t quite know, but it certainly is fun. Here are some of my attempts.</p>
<p>My first attempt- a resizing circle thingy&#8230;</p>
<div class="processing geshi no processing" style="font-family:monospace;"><span class="kw3">int</span> c,f;void <span class="kw2">setup</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><span class="kw2">size</span><span class="br0">&#40;</span><span class="nu0">640</span>,<span class="nu0">480</span><span class="br0">&#41;</span>;c=0;f=<span class="nu0">255</span>;colorMode<span class="br0">&#40;</span><span class="kw14">HSB</span><span class="br0">&#41;</span>;<span class="br0">&#125;</span><br />
<span class="kw3">void</span> <span class="kw2">draw</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><span class="kw2">background</span><span class="br0">&#40;</span><span class="kw3">color</span><span class="br0">&#40;</span>c,f,f<span class="br0">&#41;</span><span class="br0">&#41;</span>;ellipse<span class="br0">&#40;</span><span class="nu0">320</span>,<span class="nu0">240</span>,c,c<span class="br0">&#41;</span>;c=<span class="br0">&#40;</span>c++<span class="sy0">&gt;</span><span class="nu0">255</span><span class="br0">&#41;</span><span class="sy0">?</span>0:c;<span class="br0">&#125;</span></div>
<p>My second attempt- printing the colour spectrum in squares.</p>
<div class="processing geshi no processing" style="font-family:monospace;"><span class="kw3">int</span> w = <span class="nu0">160</span>;int c=0;colorMode<span class="br0">&#40;</span><span class="kw14">HSB</span><span class="br0">&#41;</span>;size<span class="br0">&#40;</span>w,w<span class="br0">&#41;</span>;for<span class="br0">&#40;</span><span class="kw3">int</span> i=0;i<span class="sy0">&lt;</span>w;i+=<span class="nu0">10</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
<span class="kw9">for</span><span class="br0">&#40;</span><span class="kw3">int</span> j=0;j<span class="sy0">&lt;</span>w;j+=<span class="nu0">10</span><span class="br0">&#41;</span><span class="br0">&#123;</span><span class="kw2">fill</span><span class="br0">&#40;</span>c,<span class="nu0">255</span>,<span class="nu0">255</span><span class="br0">&#41;</span>;rect<span class="br0">&#40;</span>i,j,<span class="nu0">10</span>,<span class="nu0">10</span><span class="br0">&#41;</span>;c++;<span class="br0">&#125;</span><span class="br0">&#125;</span></div>
<p>My third (and favourite!) attempt- Oldschool plasma effect (<a href="http://www.andybest.net/processing/plasma_condensed/">Online version</a>)</p>
<div class="processing geshi no processing" style="font-family:monospace;"><span class="kw3">int</span> t,f,x,y;void <span class="kw2">draw</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>f=<span class="nu0">256</span>;colorMode<span class="br0">&#40;</span><span class="kw14">HSB</span><span class="br0">&#41;</span>;for<span class="br0">&#40;</span>x=0;x<span class="sy0">&lt;</span>f;x++<span class="br0">&#41;</span><br />
<span class="kw9">for</span><span class="br0">&#40;</span>y=0;y<span class="sy0">&lt;</span>f;y++<span class="br0">&#41;</span><span class="kw2">set</span><span class="br0">&#40;</span>x,y,<span class="kw3">color</span><span class="br0">&#40;</span>f/<span class="nu0">4</span><span class="sy0">*</span><span class="br0">&#40;</span><span class="kw2">sin</span><span class="br0">&#40;</span>x/<span class="nu0">16.0</span><span class="br0">&#41;</span>+<span class="kw2">sin</span><span class="br0">&#40;</span>y/<span class="nu0">16.0</span><span class="br0">&#41;</span><span class="br0">&#41;</span>+t<span class="sy0">%</span>f,f,f<span class="br0">&#41;</span><span class="br0">&#41;</span>;t++;<span class="br0">&#125;</span></div>
<p>I hearby challenge you all to come up with Processing sketches that will fit into 140 character tweets! (post your sketches as a comment :D )</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Andybestnet?a=P9_3uAnYGao:H_BKc1WC90g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Andybestnet?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=P9_3uAnYGao:H_BKc1WC90g:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=P9_3uAnYGao:H_BKc1WC90g:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=P9_3uAnYGao:H_BKc1WC90g:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=P9_3uAnYGao:H_BKc1WC90g:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=P9_3uAnYGao:H_BKc1WC90g:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=P9_3uAnYGao:H_BKc1WC90g:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=P9_3uAnYGao:H_BKc1WC90g:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=P9_3uAnYGao:H_BKc1WC90g:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://andybest.net/2009/02/processing-sketches-in-a-tweet/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Processing.org Twitterers</title>
		<link>http://andybest.net/2009/02/processingorg-twitterers/</link>
		<comments>http://andybest.net/2009/02/processingorg-twitterers/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 21:05:22 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.andybest.net/?p=135</guid>
		<description><![CDATA[I thought that since I&#8217;ve found Twitter such a valuable tool, I would put together a quick list of some of the Twitterers in the Processing world that I am following. Memo Akten Bio: mad scientist (Twitter ID- memotv ) (website: http://www.memo.tv/) Peter Kirn Bio: Digital visualist-musician / technologist and creative tech blogger for CDM, [...]]]></description>
			<content:encoded><![CDATA[<p>I thought that since I&#8217;ve found Twitter such a valuable tool, I would put together a quick list of some of the Twitterers in the Processing world that I am following.</p>
<p><strong>Memo Akten</strong></p>
<ul>
<li><strong>Bio:</strong> <span class="bio">mad scientist</span></li>
<li>(Twitter ID- <a href="http://twitter.com/memotv">memotv</a> )</li>
<li>(website: <a href="http://www.memo.tv/">http://www.memo.tv/</a>)</li>
</ul>
<p><strong>Peter Kirn</strong></p>
<ul>
<li><strong>Bio:</strong> <span class="bio">Digital visualist-musician / technologist and creative tech blogger for CDM, see @cdmblogs</span></li>
<li>(Twitter ID- <a href="http://twitter.com/peterkirn">peterkirn</a> )</li>
<li>(websites: <a href="http://www.createdigitalmotion.com">http://www.createdigitalmotion.com</a> <a href="http://www.createdigitalmusic.com/">http://www.createdigitalmusic.com/</a>)</li>
</ul>
<p><span id="more-135"></span><br />
<strong>LennyJPG</strong></p>
<ul>
<li><strong>Bio:</strong> <span class="bio">CodeFormTypeColorLove</span></li>
<li>(Twitter ID- <a href="http://twitter.com/lennyjpg">lennyjpg</a>)</li>
</ul>
<p><strong>Stefan Goodchild</strong></p>
<ul>
<li><strong>Bio: </strong><span class="bio">Jack of all trades, master of some.  All round web geek and wonky music producer.</span></li>
<li>(Twitter ID- <a href="http://twitter.com/stefangoodchild">stefangoodchild</a> )</li>
<li>(website: <a href="http://stefangoodchild.com/">http://stefangoodchild.com/</a> )</li>
</ul>
<p><strong>Daniel Shiffman</strong></p>
<ul>
<li>(Twitter ID- <a href="http://twitter.com/shiffman">shiffman</a> )</li>
<li>(website: <a href="http://www.shiffman.net/">http://www.shiffman.net/</a>)</li>
</ul>
<p><strong>Robert Hodgin (Flight404)</strong></p>
<ul>
<li>(Twitter ID- <a href="http://twitter.com/flight404">flight404</a> )</li>
<li>(website: <a href="http://www.flight404.com/">http://www.flight404.com/</a>)</li>
</ul>
<p><strong>Toxi</strong></p>
<ul>
<li><strong>Bio:</strong> <span class="bio">design, sweat &amp; code and anything between</span></li>
<li>(Twitter ID- <a href="http://twitter.com/toxi">toxi</a>)</li>
<li>(website: <a href="http://postspectacular.com/">http://postspectacular.com/</a>)</li>
</ul>
<p><strong>Golan Levin </strong></p>
<ul>
<li><strong>Bio: </strong><span class="bio">We fling flongs all day long.</span></li>
<li>(Twitter ID- <a href="http://twitter.com/golan">golan</a>)</li>
<li>(website: <a href="http://www.flong.com/">http://www.flong.com/</a> )</li>
</ul>
<p><strong>John Maeda </strong></p>
<ul>
<li><strong>Bio:</strong> <span class="bio">President of Rhode Island School of Design (RISD)</span></li>
<li>(Twitter ID- <a href="http://twitter.com/johnmaeda">johnmaeda</a> )</li>
<li>(website: <a href="http://www.maedastudio.com/index.php">http://www.maedastudio.com/index.php</a> )</li>
</ul>
<p>This is by no means a complete list and there are tonnes of cool people that I&#8217;ve left out, but you should definitely check out their Twitter feeds. If you&#8217;ve still got room for some more Twitter love, you can always check out <a href="http://twitter.com/andybest">my twitter stream</a> ;)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Andybestnet?a=RPCyIXjJyes:J1o3rVZxRWg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Andybestnet?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=RPCyIXjJyes:J1o3rVZxRWg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=RPCyIXjJyes:J1o3rVZxRWg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=RPCyIXjJyes:J1o3rVZxRWg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=RPCyIXjJyes:J1o3rVZxRWg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=RPCyIXjJyes:J1o3rVZxRWg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=RPCyIXjJyes:J1o3rVZxRWg:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=RPCyIXjJyes:J1o3rVZxRWg:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=RPCyIXjJyes:J1o3rVZxRWg:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://andybest.net/2009/02/processingorg-twitterers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Processing OpenCV Tutorial #2- bubbles</title>
		<link>http://andybest.net/2009/02/processing-opencv-tutorial-2-bubbles/</link>
		<comments>http://andybest.net/2009/02/processing-opencv-tutorial-2-bubbles/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 18:45:39 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.andybest.net/?p=80</guid>
		<description><![CDATA[This is my second Processing and Open CV tutorial! (The first ran on CreateDigitalMotion.com) I decided to write some tutorials because I am very much into Processing as a tool. As an Interaction Designer/ visualist, I find Processing very useful as it allows me to put my ideas into practice very quickly without the hassle [...]]]></description>
			<content:encoded><![CDATA[<p>This is my second Processing and Open CV tutorial! (The first ran on <a href="http://createdigitalmotion.com/2009/02/06/processing-tutorials-getting-started-with-video-processing-via-opencv/trackback/">CreateDigitalMotion.com</a>)</p>
<p>I decided to write some tutorials because I am very much into Processing as a tool. As an Interaction Designer/ visualist, I find Processing very useful as it allows me to put my ideas into practice very quickly without the hassle of having to set up an environment first. The fact that Processing is based in Java means that while it isn&#8217;t as fast as a higher level language like C, it makes up for it with the huge amount of libraries availiable to the Java platform. If speed is what you&#8217;re after though, I&#8217;d definitely recommend the C++ framework <a href="http://www.openframeworks.cc">OpenFrameworks</a>.</p>
<p><i><strong>Edit:</strong> I should probably note that I&#8217;m not trying to stop people using Processing and move to Open Frameworks. Processing is a very powerful tool, and is much easier to get to grips with- I was just pointing out that there are alternatives :)</i></p>
<p>In this tutorial, I will show you how to use a thresholded frame difference (motion) image in order to perform collision detection with objects onscreen. Essentially we will be creating something similar to one of the old webcam games where you can &#8216;pop bubbles&#8217; with your hands (or indeed anything that moves). I&#8217;ve embedded a video below to illustrate what I mean:</p>
<p><object type="application/x-shockwave-flash" width="460" height="360" data="http://www.vimeo.com/moogaloop.swf?clip_id=2499593&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2499593&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object></p>
<p><span id="more-80"></span></p>
<p>Here is an outline of how it will work:</p>
<ul>
<li>A frame is captured from the camera</li>
<li>An absolute difference is taken of the current frame and the previous frame. This is converted to greyscale and run through a threshold filter so that only pixels that have changed (i.e. where there is movement) will be white. All other pixels will be black.</li>
<li>For each bubble onscreen, check whether there are any white pixels (movement) in the difference image in the space that the bubble occupies.</li>
<li>If there is movement, &#8220;pop&#8221; the bubble. (Remove it from the screen)</li>
<li>If there isn&#8217;t movement, draw the bubble.</li>
</ul>
<p>We will first create a class for bubbles to store information about each bubble (location, size, etc.) If you are not familiar with classes, I suggest you read a tutorial on the subject, such as <a href="https://java.sun.com/docs/books/tutorial/java/concepts/index.html">this one.</a></p>
<p>The class will need to store information about each bubble:</p>
<ul>
<li>The X, Y location of the bubble&#8217;s top left corner,</li>
<li>and the width and height of the bubble.</li>
</ul>
<p>It will also contain an &#8216;update&#8217; function that will check for collisions and draw the bubble to the screen. There is a basic outline of the class below:</p>
<div class="processing geshi no processing" style="font-family:monospace;"><span class="kw13">class</span> Bubble<br />
<span class="br0">&#123;</span></p>
<p><span class="kw3">int</span> bubbleX, bubbleY, bubbleWidth, bubbleHeight;  <span class="co1">//  Variables to hold the bubble&#39;s coordinates and width/height</span></p>
<p>Bubble <span class="br0">&#40;</span> <span class="kw3">int</span> bX, <span class="kw3">int</span> bY, <span class="kw3">int</span> bW, <span class="kw3">int</span> bH <span class="br0">&#41;</span>  <span class="co1">//  Class constructor- sets all the values when a new bubble object is created</span><br />
<span class="br0">&#123;</span><br />
bubbleX = bX;<br />
bubbleY = bY;<br />
bubbleWidth = bW;<br />
bubbleHeight = bH;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw3">int</span> update<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
<span class="coMULTI">/*  The bubble update code goes here  */</span></p>
<p><span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
<p>You may have noticed that the update function for this class returns an integer. This is because the return value (0 or 1) will be used to determine if the bubble is &#8220;popped&#8221; or not.</p>
<p>We shall now write the setup and draw routines for the sketch.</p>
<p>In order to manage a number of Bubble objects, we shall use a Java ArrayList (<a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html">documentation</a>). This has a number of benefits over a regular array, as we can add and remove objects at any point and the array will automatically resize and elements will automatically be shifted around.</p>
<p>So, before the setup and draw routines, we have to import some stuff and declare some variables.</p>
<div class="processing geshi no processing" style="font-family:monospace;"><span class="kw13">import</span> hypermedia.<span class="me1">video</span>.*;          <span class="co1">//  Imports the OpenCV library</span></p>
<p>OpenCV opencv;                      <span class="co1">//  Creates a new OpenCV object</span><br />
<span class="kw3">PImage</span> movementImg;                 <span class="co1">//  Creates a new PImage to hold the movement image</span><br />
<span class="kw3">int</span> poppedBubbles;                  <span class="co1">//  Creates a variable to hold the total number of popped bubbles</span><br />
ArrayList bubbles;                  <span class="co1">//  Creates an ArrayList to hold the Bubble objects</span><br />
<span class="kw3">PImage</span> bubblePNG;                   <span class="co1">//  Creates a PImage that will hold the image of the bubble</span><br />
<span class="kw3">PFont</span> font;                         <span class="co1">//  Creates a new font object</span></div>
<p>The comments should hopefully explain what all of the stuff is for well enough. I am using the built in font functionality of Processing to display some stuff onscreen. You can check out the <a href="http://www.processing.org/reference/PFont.html">reference page</a> for PFont if you are unfamiliar.</p>
<p>So now we create the setup routine:</p>
<div class="processing geshi no processing" style="font-family:monospace;"><span class="kw3">void</span> <span class="kw2">setup</span><span class="br0">&#40;</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
<span class="kw2">size</span> <span class="br0">&#40;</span> <span class="nu0">640</span>, <span class="nu0">480</span> <span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Window size of 640 x 480</span><br />
opencv = <span class="kw12">new</span> OpenCV<span class="br0">&#40;</span> <span class="kw13">this</span> <span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Initialises the OpenCV library</span><br />
opencv.<span class="me1">capture</span><span class="br0">&#40;</span> <span class="nu0">640</span>, <span class="nu0">480</span> <span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;Sets the capture size to 640 x 480</span><br />
movementImg = <span class="kw12">new</span> <span class="kw3">PImage</span><span class="br0">&#40;</span> <span class="nu0">640</span>, <span class="nu0">480</span> <span class="br0">&#41;</span>; &nbsp; <span class="co1">// &nbsp;Initialises the PImage that holds the movement image</span><br />
poppedBubbles = 0;</p>
<p>bubbles = <span class="kw12">new</span> ArrayList<span class="br0">&#40;</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Initialises the ArrayList</span></p>
<p>bubblePNG = <span class="kw2">loadImage</span><span class="br0">&#40;</span><span class="st0">&quot;bubble.png&quot;</span><span class="br0">&#41;</span>; &nbsp; &nbsp;<span class="co1">// &nbsp;Load the bubble image into memory</span><br />
font = <span class="kw2">loadFont</span><span class="br0">&#40;</span><span class="st0">&quot;Serif-48.vlw&quot;</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Load the font file into memory</span><br />
<span class="kw2">textFont</span><span class="br0">&#40;</span>font, <span class="nu0">32</span><span class="br0">&#41;</span>;</p>
<p><span class="br0">&#125;</span></div>
<p>So, nothing too out of the ordinary happening here, just initialising and setting some stuff. By the way, I&#8217;ll include a zipped sketch folder at the end of the post that will have both the bubble.png that I made as well as the font file.</p>
<p>So now onto the buisiness end of the sketch. The draw routine.</p>
<div class="processing geshi no processing" style="font-family:monospace;"><span class="kw3">void</span> <span class="kw2">draw</span><span class="br0">&#40;</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
bubbles.<span class="me1">add</span><span class="br0">&#40;</span><span class="kw12">new</span> Bubble<span class="br0">&#40;</span> <span class="br0">&#40;</span><span class="kw3">int</span><span class="br0">&#41;</span><span class="kw2">random</span><span class="br0">&#40;</span> 0, <span class="kw1">width</span> &#8211; <span class="nu0">40</span><span class="br0">&#41;</span>, -bubblePNG.<span class="kw1">height</span>, bubblePNG.<span class="kw1">width</span>, bubblePNG.<span class="kw1">height</span><span class="br0">&#41;</span><span class="br0">&#41;</span>; &nbsp; <span class="co1">// &nbsp;Adds a new bubble to the array with a random x position</span></p>
<p>opencv.<span class="me1">read</span><span class="br0">&#40;</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Captures a frame from the camera</span><br />
opencv.<span class="me1">flip</span><span class="br0">&#40;</span>OpenCV.<span class="me1">FLIP_HORIZONTAL</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Flips the image horizontally</span><br />
<span class="kw2">image</span><span class="br0">&#40;</span> opencv.<span class="kw2">image</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, 0, 0 <span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Draws the camera image to the screen</span><br />
opencv.<span class="me1">absDiff</span><span class="br0">&#40;</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;Creates a difference image</span></p>
<p>opencv.<span class="me1">convert</span><span class="br0">&#40;</span>OpenCV.<span class="kw14">GRAY</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Converts to greyscale</span><br />
opencv.<span class="me1">blur</span><span class="br0">&#40;</span>OpenCV.<span class="kw14">BLUR</span>, <span class="nu0">3</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Blur to remove camera noise</span><br />
opencv.<span class="me1">threshold</span><span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;Thresholds to convert to black and white</span><br />
movementImg = opencv.<span class="kw2">image</span><span class="br0">&#40;</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;Puts the OpenCV buffer into an image object</span></p>
<p><span class="kw9">for</span> <span class="br0">&#40;</span> <span class="kw3">int</span> i = 0; i <span class="sy0">&lt;</span> bubbles.<span class="kw2">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span>; i++ <span class="br0">&#41;</span><span class="br0">&#123;</span> &nbsp; &nbsp;<span class="co1">// &nbsp;For every bubble in the bubbles array</span><br />
Bubble _bubble = <span class="br0">&#40;</span>Bubble<span class="br0">&#41;</span> bubbles.<span class="kw2">get</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>; &nbsp; &nbsp;<span class="co1">// &nbsp;Copies the current bubble into a temporary object</span></p>
<p><span class="kw7">if</span><span class="br0">&#40;</span>_bubble.<span class="me1">update</span><span class="br0">&#40;</span><span class="br0">&#41;</span> == <span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;If the bubble&#39;s update function returns &#39;1&#39;</span><br />
bubbles.<span class="me1">remove</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;then remove the bubble from the array</span><br />
_bubble = <span class="kw5">null</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;and make the temporary bubble object null</span><br />
i&#8211;; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;since we&#39;ve removed a bubble from the array, we need to subtract 1 from i, or we&#39;ll skip the next bubble</span></p>
<p><span class="br0">&#125;</span><span class="kw7">else</span><span class="br0">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;If the bubble&#39;s update function doesn&#39;t return &#39;1&#39;</span><br />
bubbles.<span class="kw2">set</span><span class="br0">&#40;</span>i, _bubble<span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Copys the updated temporary bubble object back into the array</span><br />
_bubble = <span class="kw5">null</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;Makes the temporary bubble object null.</span><br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
<p>opencv.<span class="me1">remember</span><span class="br0">&#40;</span>OpenCV.<span class="me1">SOURCE</span>, OpenCV.<span class="me1">FLIP_HORIZONTAL</span><span class="br0">&#41;</span>; &nbsp; &nbsp;<span class="co1">// &nbsp;Remembers the camera image so we can generate a difference image next frame. Since we&#39;ve</span><br />
<span class="co1">// &nbsp;flipped the image earlier, we need to flip it here too.</span><br />
<span class="kw2">text</span><span class="br0">&#40;</span><span class="st0">&quot;Bubbles popped: &quot;</span> + poppedBubbles, <span class="nu0">20</span>, <span class="nu0">40</span><span class="br0">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Displays some text showing how many bubbles have been popped</span><br />
<span class="br0">&#125;</span></div>
<p>I think that my code comments should explain it all well enough, but I&#8217;ll quickly run through how it works.</p>
<ul>
<li>A new Bubble object with a random X coordinate is added to the &#8216;bubbles&#8217; ArrayList</li>
<li>A frame is grabbed from the camera and is flipped horizontally. It is then drawn to the screen.</li>
<li>The image is then converted to greyscale, an absolute difference image is made and it is then thresholded to get a black and white difference image.</li>
<li>A for loop then cycles through each bubble in the &#8216;bubbles&#8217; ArrayList and runs the bubble&#8217;s update function. If the function returns a 1, the bubble is destroyed- if it returns a 0, then the bubble is put back into the array.</li>
<li>The opencv remember function is called. Since we flipped the image earlier, we need to tell the remember function to flip this image.</li>
<li>Some text is drawn onscreen displaying the amount of bubbles popped.</li>
</ul>
<p>So that is the draw routine. All that is left now is the update routine for the Bubble class. I&#8217;ll go ahead and paste it below.</p>
<div class="processing geshi no processing" style="font-family:monospace;">
<span class="kw3">int</span> update<span class="br0">&#40;</span><span class="br0">&#41;</span> &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp; The Bubble update function</span><br />
<span class="br0">&#123;</span><br />
<span class="kw3">int</span> movementAmount; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Create and set a variable to hold the amount of white pixels detected in the area where the bubble is</span><br />
movementAmount = 0;</p>
<p><span class="kw9">for</span><span class="br0">&#40;</span> <span class="kw3">int</span> y = bubbleY; y <span class="sy0">&lt;</span> <span class="br0">&#40;</span>bubbleY + <span class="br0">&#40;</span>bubbleHeight-<span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span>; y++ <span class="br0">&#41;</span><span class="br0">&#123;</span> &nbsp; &nbsp;<span class="co1">// &nbsp;For loop that cycles through all of the pixels in the area the bubble occupies</span><br />
<span class="kw9">for</span><span class="br0">&#40;</span> <span class="kw3">int</span> x = bubbleX; x <span class="sy0">&lt;</span> <span class="br0">&#40;</span>bubbleX + <span class="br0">&#40;</span>bubbleWidth-<span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span>; x++ <span class="br0">&#41;</span><span class="br0">&#123;</span></p>
<p><span class="kw7">if</span> <span class="br0">&#40;</span> x<span class="sy0">&lt;</span> <span class="kw1">width</span> <span class="sy0">&amp;&amp;</span> x <span class="sy0">&gt;</span> 0 <span class="sy0">&amp;&amp;</span> y <span class="sy0">&lt;</span> <span class="kw1">height</span> <span class="sy0">&amp;&amp;</span> y <span class="sy0">&gt;</span> 0 <span class="br0">&#41;</span><span class="br0">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;If the current pixel is within the screen bondaries</span><br />
<span class="kw7">if</span> <span class="br0">&#40;</span><span class="kw2">brightness</span><span class="br0">&#40;</span>movementImg.<span class="kw1">pixels</span><span class="br0">&#91;</span>x + <span class="br0">&#40;</span>y <span class="sy0">*</span> <span class="kw1">width</span><span class="br0">&#41;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">&gt;</span> <span class="nu0">127</span><span class="br0">&#41;</span> &nbsp;<span class="co1">// &nbsp;and if the brightness is above 127 (in this case, if it is white)</span><br />
<span class="br0">&#123;</span><br />
movementAmount++; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;Add 1 to the movementAmount variable.</span><br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="kw7">if</span> <span class="br0">&#40;</span>movementAmount <span class="sy0">&gt;</span> <span class="nu0">5</span><span class="br0">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;If more than 5 pixels of movement are detected in the bubble area</span><br />
<span class="br0">&#123;</span><br />
poppedBubbles++; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Add 1 to the variable that holds the number of popped bubbles</span><br />
<span class="kw8">return</span> <span class="nu0">1</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;Return 1 so that the bubble object is destroyed</span></p>
<p><span class="br0">&#125;</span><span class="kw7">else</span><span class="br0">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;If less than 5 pixels of movement are detected,</span><br />
bubbleY += <span class="nu0">10</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;increase the y position of the bubble so that it falls down</span></p>
<p><span class="kw7">if</span> <span class="br0">&#40;</span>bubbleY <span class="sy0">&gt;</span> <span class="kw1">height</span><span class="br0">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// &nbsp;If the bubble has dropped off of the bottom of the screen</span><br />
<span class="br0">&#123;</span> &nbsp;<span class="kw8">return</span> <span class="nu0">1</span>; <span class="br0">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Return &#39;1&#39; so that the bubble object is destroyed</span></p>
<p><span class="kw2">image</span><span class="br0">&#40;</span>bubblePNG, bubbleX, bubbleY<span class="br0">&#41;</span>; &nbsp; &nbsp;<span class="co1">// &nbsp;Draws the bubble to the screen</span><br />
<span class="kw8">return</span> 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// &nbsp;Returns &#39;0&#39; so that the bubble isn&#39;t destroyed</span><br />
<span class="br0">&#125;</span></p>
<p><span class="br0">&#125;</span></div>
<p>The update function accesses the <a href="http://www.processing.org/reference/pixels.html">pixel</a> array of the difference image directly, and looks at the <a href="http://www.processing.org/reference/brightness_.html">brightness</a> of each pixel in the space that the bubble occupies. If there are more than 5 white pixels, the function returns a 1 so that the bubble is removed from the &#8216;bubbles&#8217; ArrayList. The poppedBubbles variable is also increased by 1. If the bubble falls off of the bottom of the screen, it is also removed, but the poppedBubble variable is not increased in this instance. If neither of the previous two things have occured, than The bubble is drawn to the screen and the function returns 0.</p>
<p>I tried to avoid the need to talk too much about the workings of the code by commenting each line. If you have trouble with anything, don&#8217;t hesistate to leave a comment on this post and I will try to answer your question. I hope that you have found this useful.</p>
<p><a href="http://www.andybest.net/wp-content/uploads/2008/12/bubble_game.zip">Here is a zipped copy</a> of the sketch folder for this project. It contains the bubble picture and the font that I used.</p>
<p>If you end up making anything cool with it, please leave a comment here with a link to it- I&#8217;d love to see it :)</p>
<p>Once you pop, you just can&#8217;t stop! Or something&#8230; ;)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Andybestnet?a=empI1UQAHFY:iUu2ieMAYLk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Andybestnet?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=empI1UQAHFY:iUu2ieMAYLk:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=empI1UQAHFY:iUu2ieMAYLk:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=empI1UQAHFY:iUu2ieMAYLk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=empI1UQAHFY:iUu2ieMAYLk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=empI1UQAHFY:iUu2ieMAYLk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=empI1UQAHFY:iUu2ieMAYLk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=empI1UQAHFY:iUu2ieMAYLk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=empI1UQAHFY:iUu2ieMAYLk:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://andybest.net/2009/02/processing-opencv-tutorial-2-bubbles/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Processing OpenCV Tutorial #1</title>
		<link>http://andybest.net/2009/02/processing-opencv-tutorial-1/</link>
		<comments>http://andybest.net/2009/02/processing-opencv-tutorial-1/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 18:44:42 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.andybest.net/?p=77</guid>
		<description><![CDATA[Hi there! I have written a tutorial for the brilliant OpenCV library for Processing which Peter Kirn has kindly published on Create Digital Motion. You can find it here. Also, don&#8217;t miss the next tutorial, which I shall post up on this site :) Here is a video of what the tutorial will show you [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there! I have written a tutorial for the brilliant OpenCV library for Processing which Peter Kirn has kindly published on Create Digital Motion. <a href="http://createdigitalmotion.com/2009/02/06/processing-tutorials-getting-started-with-video-processing-via-opencv/">You can find it here</a>. Also, don&#8217;t miss the next tutorial, which I shall post up on this site :)</p>
<p><span id="more-77"></span></p>
<p>Here is a video of what the tutorial will show you how to make:</p>
<p><object type="application/x-shockwave-flash" width="460" height="360" data="http://www.vimeo.com/moogaloop.swf?clip_id=2455174&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2455174&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Andybestnet?a=yOF8zgpnKJU:7aSFVhbs97A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Andybestnet?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=yOF8zgpnKJU:7aSFVhbs97A:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=yOF8zgpnKJU:7aSFVhbs97A:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=yOF8zgpnKJU:7aSFVhbs97A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=yOF8zgpnKJU:7aSFVhbs97A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=yOF8zgpnKJU:7aSFVhbs97A:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=yOF8zgpnKJU:7aSFVhbs97A:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=yOF8zgpnKJU:7aSFVhbs97A:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=yOF8zgpnKJU:7aSFVhbs97A:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://andybest.net/2009/02/processing-opencv-tutorial-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Psychedelic Sphere</title>
		<link>http://andybest.net/2009/01/psychedelic-sphere/</link>
		<comments>http://andybest.net/2009/01/psychedelic-sphere/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 00:58:34 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://www.andybest.net/?p=116</guid>
		<description><![CDATA[While messing around in Processing with Sphere drawing code, I came up with this&#8230; I&#8217;m pretty pleased with the result. I used the OpenCV library for the blur. Processing is so great for producing little things like this in next to no time :)]]></description>
			<content:encoded><![CDATA[<p>While messing around in Processing with Sphere drawing code, I came up with this&#8230;</p>
<p><object type="application/x-shockwave-flash" width="460" height="360" data="http://www.vimeo.com/moogaloop.swf?clip_id=2976123&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2976123&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object></p>
<p>I&#8217;m pretty pleased with the result. I used the OpenCV library for the blur. Processing is so great for producing little things like this in next to no time :)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Andybestnet?a=WjB-lMpssFo:ZMo4BiTAuWY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Andybestnet?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=WjB-lMpssFo:ZMo4BiTAuWY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=WjB-lMpssFo:ZMo4BiTAuWY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=WjB-lMpssFo:ZMo4BiTAuWY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=WjB-lMpssFo:ZMo4BiTAuWY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=WjB-lMpssFo:ZMo4BiTAuWY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=WjB-lMpssFo:ZMo4BiTAuWY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=WjB-lMpssFo:ZMo4BiTAuWY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=WjB-lMpssFo:ZMo4BiTAuWY:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://andybest.net/2009/01/psychedelic-sphere/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Disco Mesh</title>
		<link>http://andybest.net/2009/01/disco-mesh/</link>
		<comments>http://andybest.net/2009/01/disco-mesh/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 02:27:52 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://www.andybest.net/?p=114</guid>
		<description><![CDATA[I&#8217;ve worked a bit more on the sketch that I was working on earlier, and I have rendered it as a mesh: I need to look into smooth shading in OpenGL, but I&#8217;m not quite sure where to look yet. A push in the right direction would be appreciated ;)]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve worked a bit more on the <a href="http://www.andybest.net/2009/01/disco-lines/">sketch</a> that I was working on earlier, and I have rendered it as a mesh:</p>
<p><object type="application/x-shockwave-flash" width="460" height="360" data="http://www.vimeo.com/moogaloop.swf?clip_id=2711988&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2711988&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object></p>
<p>I need to look into smooth shading in OpenGL, but I&#8217;m not quite sure where to look yet. A push in the right direction would be appreciated ;)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Andybestnet?a=ZNuWdKU9F4E:qemQPwPaPEQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Andybestnet?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=ZNuWdKU9F4E:qemQPwPaPEQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=ZNuWdKU9F4E:qemQPwPaPEQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=ZNuWdKU9F4E:qemQPwPaPEQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=ZNuWdKU9F4E:qemQPwPaPEQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=ZNuWdKU9F4E:qemQPwPaPEQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=ZNuWdKU9F4E:qemQPwPaPEQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=ZNuWdKU9F4E:qemQPwPaPEQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=ZNuWdKU9F4E:qemQPwPaPEQ:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://andybest.net/2009/01/disco-mesh/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Disco Lines</title>
		<link>http://andybest.net/2009/01/disco-lines/</link>
		<comments>http://andybest.net/2009/01/disco-lines/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 18:01:43 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://www.andybest.net/?p=108</guid>
		<description><![CDATA[I&#8217;m not quite sure what my fascination with rendering lines in 3d space is, but I&#8217;ve done it again! This time I came across a Flickr Picture by Stefan Goodchild. In the description for the Flickr picture, he left the following function: for &#40;int x = -2000; x &#38;lt; 2000; x+= 9&#41; &#123; for &#40;int [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not quite sure what my fascination with rendering lines in 3d space is, but I&#8217;ve done it again! This time I came across a <a title="Disco Maths" href="http://tinyurl.com/discomaths">Flickr Picture</a> by <a title="Stefan Goodchild" href="http://stefangoodchild.com/">Stefan Goodchild</a>. In the description for the Flickr picture, he left the following function:</p>
<div class="processing geshi no processing" style="font-family:monospace;">
<span class="kw9">for</span> <span class="br0">&#40;</span><span class="kw3">int</span> x = -<span class="nu0">2000</span>; x <span class="sy0">&amp;</span>lt; <span class="nu0">2000</span>; x+= <span class="nu0">9</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="kw9">for</span> <span class="br0">&#40;</span><span class="kw3">int</span> y = -<span class="nu0">2000</span>; y <span class="sy0">&amp;</span>lt; <span class="nu0">2000</span>; y+= <span class="nu0">9</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
z = <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="kw2">cos</span><span class="br0">&#40;</span><span class="kw2">radians</span><span class="br0">&#40;</span>y/<span class="nu0">3</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">*</span><span class="kw2">sin</span><span class="br0">&#40;</span><span class="kw2">radians</span><span class="br0">&#40;</span>x/<span class="nu0">6</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">*</span><span class="nu0">200</span><span class="br0">&#41;</span><span class="sy0">*</span><span class="kw2">sin</span><span class="br0">&#40;</span><span class="kw2">radians</span><span class="br0">&#40;</span>x/<span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
aStar = <span class="kw12">new</span> Star<span class="br0">&#40;</span>x,y,z<span class="br0">&#41;</span>;<br />
s.<span class="me1">add</span><span class="br0">&#40;</span>aStar<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
<p>I found it pretty irresistable, so I decided to make something of my own using the function. I ended up with this:</p>
<p><object type="application/x-shockwave-flash" width="460" height="360" data="http://www.vimeo.com/moogaloop.swf?clip_id=2707163&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color="><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2707163&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=" /></object></p>
<p>I ended up modifing the function somewhat to achieve the animation, and I have another function to calculate the colours. I&#8217;ll continue to play around with this- it needs some optimisation since I&#8217;m rendering it all with lines- I think I might be better off just rendering it as a mesh. So watch this space!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Andybestnet?a=TCZ_1tn3Rc8:RQkffFqTA2A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Andybestnet?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=TCZ_1tn3Rc8:RQkffFqTA2A:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=TCZ_1tn3Rc8:RQkffFqTA2A:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=TCZ_1tn3Rc8:RQkffFqTA2A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=TCZ_1tn3Rc8:RQkffFqTA2A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=TCZ_1tn3Rc8:RQkffFqTA2A:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=TCZ_1tn3Rc8:RQkffFqTA2A:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Andybestnet?a=TCZ_1tn3Rc8:RQkffFqTA2A:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Andybestnet?i=TCZ_1tn3Rc8:RQkffFqTA2A:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://andybest.net/2009/01/disco-lines/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

