<?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>CODEISPOETRY &#187; math</title>
	<atom:link href="http://www.alexmil.de/category/math/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alexmil.de</link>
	<description></description>
	<lastBuildDate>Fri, 10 Jun 2011 13:10:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Face / Mimik tracking in AS3</title>
		<link>http://www.alexmil.de/face-mimic-tracking-in-as3/</link>
		<comments>http://www.alexmil.de/face-mimic-tracking-in-as3/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 09:03:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ar]]></category>
		<category><![CDATA[computervision]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[hot]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[nerdlab]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=513</guid>
		<description><![CDATA[
http://play.blog2t.net/terminator-salvation-realtime-machine-vision-as3/
Once again Tomek alias Og2t wrote a great flash demo. This time its about machine vision and just awesome. It&#8217;s motion based head / eyetracking with a lot of cool &#8220;hacks&#8221; like blob detection &#8211; histogram analysis &#8211; motion detection and more. Furthermore Tomek wants to provide a full framework.
This is a part of the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://play.blog2t.net/terminator-salvation-realtime-machine-vision-as3/"><img class="alignnone size-full wp-image-514" title="face-mimic-as3" src="http://www.alexmil.de/wp-content/face-mimic-as3.png" alt="face-mimic-as3" width="400" height="217" /></a></p>
<p><a href="http://play.blog2t.net/terminator-salvation-realtime-machine-vision-as3/" target="_blank">http://play.blog2t.net/terminator-salvation-realtime-machine-vision-as3/</a></p>
<p>Once again Tomek alias Og2t wrote a great flash demo. This time its about machine vision and just awesome. It&#8217;s motion based head / eyetracking with a lot of cool &#8220;hacks&#8221; like blob detection &#8211; histogram analysis &#8211; motion detection and more. Furthermore Tomek wants to provide a full framework.</p>
<blockquote><p>This is a part of the whole video filter framework I am developing just now, the inspiration came from <a href="http://blog.joa-ebert.com/imageprocessing-library/">Joa Ebert&#8217;s Image Processing</a> library (as far as I know, he&#8217;s cooking a complete rewrite). <strong>The full source code (including Pixel Bender kernels and examples) will be soon released on Google Code and will feature face/eye tracking/gestures and few other things (surprise!)</strong> A lot of people are very sceptic about the whole eye tracking idea, they don&#8217;t believe it&#8217;s precise enough to make any use of it – I will prove that it is, and it works! (just watch closely how it tracks my eyeballs on the video!)</p></blockquote>
<p>I tried it, but I still prefer the camshift algorithm for face detection. Anyway: GREAT WORK!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/face-mimic-tracking-in-as3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Must see -&gt; Erik Natzke</title>
		<link>http://www.alexmil.de/erik-natzke-work/</link>
		<comments>http://www.alexmil.de/erik-natzke-work/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 15:47:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[art]]></category>
		<category><![CDATA[artlab]]></category>
		<category><![CDATA[creative]]></category>
		<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=481</guid>
		<description><![CDATA[As far as i got it Erik Natzke creates art using tech (Flash for sure, maybe processing too). You can also buy his prints.  Here are some images. :





]]></description>
			<content:encoded><![CDATA[<p>As far as i got it <a href="http://jot.eriknatzke.com/?p=136" target="_blank">Erik Natzke</a> creates art using tech (Flash for sure, maybe processing too). You can also <a href="http://www.flickr.com/photos/natzke/sets/72157603454461983/" target="_blank">buy</a> his prints.  Here are some images. :</p>
<p><img class="alignnone size-full wp-image-486" title="eriknatzke-5" src="http://www.alexmil.de/wp-content/eriknatzke-5.jpg" alt="eriknatzke-5" width="400" height="166" /></p>
<p><img class="alignnone size-full wp-image-485" title="eriknatzke-4" src="http://www.alexmil.de/wp-content/eriknatzke-4.jpg" alt="eriknatzke-4" width="400" height="166" /></p>
<p><img class="alignnone size-full wp-image-484" title="eriknatzke-3" src="http://www.alexmil.de/wp-content/eriknatzke-3.jpg" alt="eriknatzke-3" width="400" height="166" /></p>
<p><img class="alignnone size-full wp-image-483" title="eriknatzke-2" src="http://www.alexmil.de/wp-content/eriknatzke-2.jpg" alt="eriknatzke-2" width="400" height="166" /></p>
<p><img class="alignnone size-full wp-image-482" title="eriknatzke-1" src="http://www.alexmil.de/wp-content/eriknatzke-1.jpg" alt="eriknatzke-1" width="400" height="166" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/erik-natzke-work/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SURF the next big thing</title>
		<link>http://www.alexmil.de/surf-the-next-big-thing/</link>
		<comments>http://www.alexmil.de/surf-the-next-big-thing/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 22:12:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ar]]></category>
		<category><![CDATA[art]]></category>
		<category><![CDATA[computervision]]></category>
		<category><![CDATA[hot]]></category>
		<category><![CDATA[idea]]></category>
		<category><![CDATA[lab]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[nerdlab]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=473</guid>
		<description><![CDATA[SURF is a computer vision technique which helps doing crazy things ;) Here is some footage showing whats possible. NOTE: no flash implementation yet ;) &#8211; I think it wouldn&#8217;t work -> performance

openFrameworks &#038; OpenCV SURF from postspectacular on Vimeo.

Augmenting a Postcard from Julian Oliver on Vimeo.

]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/SURF" target="_blank">SURF</a> is a computer vision technique which helps doing crazy things ;) Here is some footage showing whats possible. NOTE: no flash implementation yet ;) &#8211; I think it wouldn&#8217;t work -> performance</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4990304&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=4990304&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
<p><a href="http://vimeo.com/4990304">openFrameworks &#038; OpenCV SURF</a> from <a href="http://vimeo.com/postspectacular">postspectacular</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3957693&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=3957693&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
<p><a href="http://vimeo.com/3957693">Augmenting a Postcard</a> from <a href="http://vimeo.com/julianoliver">Julian Oliver</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/surf-the-next-big-thing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimized edge detection algorithm.</title>
		<link>http://www.alexmil.de/optimized-edge-detection-algorithm/</link>
		<comments>http://www.alexmil.de/optimized-edge-detection-algorithm/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 13:35:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[computervision]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=436</guid>
		<description><![CDATA[I optimized the edge detection (sobel) algorithm found here a little. Still there is a lot potential for optimizing things. You can find tipps in joa&#8217;s wiki
Here is my code

private function detectEdges&#40;bmd : BitmapData&#41; : void
&#123;
&#160;
 var myGausianFilter : ConvolutionFilter =
 new ConvolutionFilter&#40;5, 5, 
 &#91;2,4,5,4,2,4,9,12,9,4,5,12,15,12,5,4,9,12,9,4,2,4,5,4,2&#93;,
 115&#41;;
&#160;
 // Edge Data
 findEdges&#40;&#41;;
&#160;
 function findEdges&#40;&#41; : void
 [...]]]></description>
			<content:encoded><![CDATA[<p>I optimized the edge detection (sobel) algorithm found <a href="http://lukewalsh.co.uk/blog/2008/06/sobel-edge-detection-in-flash.html" target="_blank">here</a> a little. Still there is a lot potential for optimizing things. You can find tipps in <a href="http://wiki.joa-ebert.de/index.php/Main_Page" target="_blank">joa&#8217;s wiki</a></p>
<p>Here is my code</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> detectEdges<span style="color: #66cc66;">&#40;</span>bmd : BitmapData<span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">var</span> myGausianFilter : ConvolutionFilter =
 <span style="color: #000000; font-weight: bold;">new</span> ConvolutionFilter<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">5</span>, 
 <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">9</span>,<span style="color: #cc66cc;">12</span>,<span style="color: #cc66cc;">9</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">12</span>,<span style="color: #cc66cc;">15</span>,<span style="color: #cc66cc;">12</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">9</span>,<span style="color: #cc66cc;">12</span>,<span style="color: #cc66cc;">9</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>,
 <span style="color: #cc66cc;">115</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
 <span style="color: #808080; font-style: italic;">// Edge Data</span>
 findEdges<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
 <span style="color: #000000; font-weight: bold;">function</span> findEdges<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span>
 <span style="color: #66cc66;">&#123;</span>	
  <span style="color: #808080; font-style: italic;">//Apply Smoothing Filter</span>
  bmd.<span style="color: #006600;">lock</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  bmd.<span style="color: #006600;">applyFilter</span><span style="color: #66cc66;">&#40;</span>bmd, bmd.<span style="color: #006600;">rect</span>, <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>, myGausianFilter<span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #808080; font-style: italic;">//Create New Bitmap to hold edge data</span>
  ourEdgeData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #0066CC;">width</span>, bmd.<span style="color: #0066CC;">height</span>, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #000000; font-weight: bold;">var</span> gx : <span style="color: #0066CC;">int</span>;;
  <span style="color: #000000; font-weight: bold;">var</span> gy : <span style="color: #0066CC;">int</span>;
  <span style="color: #000000; font-weight: bold;">var</span> gray : uint;
&nbsp;
  <span style="color: #808080; font-style: italic;">//Loop through original data and calculate edges</span>
  <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> w : <span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;w <span style="color: #66cc66;">&amp;</span>lt; bmd.<span style="color: #0066CC;">width</span>; w++<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#123;</span>
   <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> h : <span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;h <span style="color: #66cc66;">&amp;</span>lt; bmd.<span style="color: #0066CC;">height</span>; h++<span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#123;</span>
    pV0 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w, h - <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV45 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w + <span style="color: #cc66cc;">1</span>, h - <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV90 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w + <span style="color: #cc66cc;">1</span>, h<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV35 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w + <span style="color: #cc66cc;">1</span>, h + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV80 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w, h + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV225 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w - <span style="color: #cc66cc;">1</span>, h + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV270 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w - <span style="color: #cc66cc;">1</span>, h<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;			
    pV315 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w - <span style="color: #cc66cc;">1</span>, h - <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;	 
&nbsp;
    gx = <span style="color: #66cc66;">&#40;</span>pV45+<span style="color: #66cc66;">&#40;</span>pV90<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>+pV35<span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&#40;</span>pV315+<span style="color: #66cc66;">&#40;</span>pV270<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>+pV225<span style="color: #66cc66;">&#41;</span>;
    gy = <span style="color: #66cc66;">&#40;</span>pV315+<span style="color: #66cc66;">&#40;</span>pV0<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>+pV45<span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&#40;</span>pV225+<span style="color: #66cc66;">&#40;</span>pV80<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>+pV35<span style="color: #66cc66;">&#41;</span>;
    gray = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">abs</span><span style="color: #66cc66;">&#40;</span>gx<span style="color: #66cc66;">&#41;</span> + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">abs</span><span style="color: #66cc66;">&#40;</span>gy<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Check to see if values aren't our of bounds</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>gray <span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>
     gray = <span style="color: #cc66cc;">255</span>;
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>gray <span style="color: #66cc66;">&amp;</span>lt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
	  gray = <span style="color: #cc66cc;">0</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Build New Pixel</span>
    newPixelValue = <span style="color: #66cc66;">&#40;</span>gray <span style="color: #66cc66;">&amp;</span>lt;<span style="color: #66cc66;">&amp;</span>lt; <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #66cc66;">&#40;</span>gray <span style="color: #66cc66;">&amp;</span>lt;<span style="color: #66cc66;">&amp;</span>lt; <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #66cc66;">&#40;</span>gray<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Copy New Pixel Into Edge Data Bitmap</span>
    ourEdgeData.<span style="color: #006600;">setPixel</span><span style="color: #66cc66;">&#40;</span>w, h, newPixelValue<span style="color: #66cc66;">&#41;</span>;	
   <span style="color: #66cc66;">&#125;</span>	
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  bmd.<span style="color: #006600;">unlock</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
 <span style="color: #66cc66;">&#125;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">function</span> getGray<span style="color: #66cc66;">&#40;</span>pixelValue : uint<span style="color: #66cc66;">&#41;</span> : uint
 <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> red : uint = <span style="color: #66cc66;">&#40;</span>pixelValue <span style="color: #66cc66;">&amp;</span>gt;<span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">16</span> <span style="color: #66cc66;">&amp;</span>amp; 0xFF<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.30</span>;
  <span style="color: #000000; font-weight: bold;">var</span> green : uint = <span style="color: #66cc66;">&#40;</span>pixelValue <span style="color: #66cc66;">&amp;</span>gt;<span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">8</span> <span style="color: #66cc66;">&amp;</span>amp; 0xFF<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.59</span>;
  <span style="color: #000000; font-weight: bold;">var</span> blue : uint = <span style="color: #66cc66;">&#40;</span>pixelValue <span style="color: #66cc66;">&amp;</span>amp; 0xFF<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.11</span>;
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span>red + green + blue<span style="color: #66cc66;">&#41;</span>;
 <span style="color: #66cc66;">&#125;</span>
&nbsp;
 _bmp3.<span style="color: #006600;">bitmapData</span> = ourEdgeData;
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/optimized-edge-detection-algorithm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Edge detection in Flash</title>
		<link>http://www.alexmil.de/edge-detection-in-flash/</link>
		<comments>http://www.alexmil.de/edge-detection-in-flash/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 08:41:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ar]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=426</guid>
		<description><![CDATA[here is a good post about edge detection with the sobel-operator

sobel-edge-detection-in-flash
Works really well, but does not fit my needs.
]]></description>
			<content:encoded><![CDATA[<p>here is a good post about edge detection with the <a href="http://de.wikipedia.org/wiki/Sobel-Operator" target="_blank">sobel-operator</a></p>
<p><img class="alignnone size-full wp-image-427" title="edge-detection" src="http://www.alexmil.de/wp-content/edge-detection.png" alt="" width="400" height="233" /></p>
<p><a href="http://lukewalsh.co.uk/blog/2008/06/sobel-edge-detection-in-flash.html" target="_blank">sobel-edge-detection-in-flash</a></p>
<p>Works really well, but does not fit my needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/edge-detection-in-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Face tracking!</title>
		<link>http://www.alexmil.de/face-tracking/</link>
		<comments>http://www.alexmil.de/face-tracking/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 14:27:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[hot]]></category>
		<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=414</guid>
		<description><![CDATA[I found http://www.mukimuki.fr/flashblog/2009/05/28/camshift-smile-you-are-tracking/
The Camshift algorithm is propably the best tracking algorithm for the flash platform. It&#8217;s stable, fast and good coded. Love it!

]]></description>
			<content:encoded><![CDATA[<p>I found <a href="http://www.mukimuki.fr/flashblog/2009/05/28/camshift-smile-you-are-tracking/">http://www.mukimuki.fr/flashblog/2009/05/28/camshift-smile-you-are-tracking/</a></p>
<p>The Camshift algorithm is propably the best tracking algorithm for the flash platform. It&#8217;s stable, fast and good coded. Love it!</p>
<p><img class="alignnone size-full wp-image-415" title="me-camshift" src="http://www.alexmil.de/wp-content/me-camshift.png" alt="" width="400" height="224" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/face-tracking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flashtip : Zoom in a clip to a specific point</title>
		<link>http://www.alexmil.de/flashtip-zoom-in-a-clip-to-a-specific-point/</link>
		<comments>http://www.alexmil.de/flashtip-zoom-in-a-clip-to-a-specific-point/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 13:31:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=308</guid>
		<description><![CDATA[Imagine you have to zoom in a mc on a specific point.
This math snippet works fine for me (I used TweenLite in my Code):

var tmpEndX : Number = &#40;&#40;spr.width&#41;-&#40;width*scaleFact&#41;&#41;/2;
var tmpEndY : Number = &#40;&#40;spr.height&#41;-&#40;spr.height*scaleFact&#41;&#41;/2;
&#160;
var tmpXShift : Number = &#40;mouseX-&#40;width/2&#41;&#41;*scaleFact;
var tmpYShift : Number = &#40;mouseY-&#40;spr.height/2&#41;&#41;*scaleFact;
&#160;
TweenMax.to&#40;this, 0.5,&#123;scaleX : scaleFact&#125;&#41;;
TweenMax.to&#40;this, 0.5,&#123;scaleY : scaleFact&#125;&#41;;
TweenMax.to&#40;this, 0.5,&#123;x : tmpEndX - tmpXShift&#125;&#41;;
TweenMax.to&#40;this, [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine you have to zoom in a mc on a specific point.<br />
This math snippet works fine for me (I used TweenLite in my Code):</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> tmpEndX : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>spr.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span><span style="color: #66cc66;">*</span>scaleFact<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>;
<span style="color: #000000; font-weight: bold;">var</span> tmpEndY : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>spr.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&#40;</span>spr.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">*</span>scaleFact<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> tmpXShift : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span>mouseX-<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>scaleFact;
<span style="color: #000000; font-weight: bold;">var</span> tmpYShift : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span>mouseY-<span style="color: #66cc66;">&#40;</span>spr.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>scaleFact;
&nbsp;
TweenMax.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #cc66cc;">0.5</span>,<span style="color: #66cc66;">&#123;</span>scaleX : scaleFact<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
TweenMax.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #cc66cc;">0.5</span>,<span style="color: #66cc66;">&#123;</span>scaleY : scaleFact<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
TweenMax.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #cc66cc;">0.5</span>,<span style="color: #66cc66;">&#123;</span>x : tmpEndX - tmpXShift<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
TweenMax.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #cc66cc;">0.5</span>,<span style="color: #66cc66;">&#123;</span>y : tmpEndY - tmpYShift<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Demo and full Class <a href="http://www.alexmil.de/index.php/zoom-in-a-clip-to-a-specific-point/">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/flashtip-zoom-in-a-clip-to-a-specific-point/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>vertex detection in quad</title>
		<link>http://www.alexmil.de/vertex-detection-in-quad/</link>
		<comments>http://www.alexmil.de/vertex-detection-in-quad/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 16:09:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ar]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=191</guid>
		<description><![CDATA[Problem: 
You have a quad outline as point data, and want to detect the four vertices

I googled that problem a lot but couldn&#8217;t find any solution that fitted my needs. Moreover I didn&#8217;t want to copy paste something I do not really understand, so I solved it my way

In this case I know the points [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem: </strong></p>
<p>You have a quad outline as point data, and want to detect the four vertices</p>
<p><img class="alignnone size-full wp-image-194" title="edge1_1" src="http://www.alexmil.de/wp-content/edge1_1.jpg" alt="" width="400" height="389" /></p>
<p>I googled that problem a lot but couldn&#8217;t find any solution that fitted my needs. Moreover I didn&#8217;t want to copy paste something I do not really understand, so I solved it my way</p>
<p><span id="more-191"></span></p>
<p>In this case I know the points <strong>D</strong> and <strong>B</strong> (detecting theese points is easy, but in some special cases you track D and A but that&#8217;s an other problem). Now I wanted to store the outline in a point array. So I started at <strong>D</strong> doing this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">_currentPt = findStartPoint<span style="color: #66cc66;">&#40;</span>f_bmd, f_rect<span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>findNextBlackPixel<span style="color: #66cc66;">&#40;</span>f_bmd, _currentPt, <span style="color: #cc66cc;">1</span> , <span style="color: #cc66cc;">0</span> , <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>findNextBlackPixel<span style="color: #66cc66;">&#40;</span>f_bmd, _currentPt, <span style="color: #cc66cc;">0</span> , <span style="color: #cc66cc;">1</span>, -<span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>findNextBlackPixel<span style="color: #66cc66;">&#40;</span>f_bmd, _currentPt, -<span style="color: #cc66cc;">1</span> ,<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, -<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>findNextBlackPixel<span style="color: #66cc66;">&#40;</span>f_bmd, _currentPt, <span style="color: #cc66cc;">0</span> ,-<span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
...
...
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> findNextBlackPixel<span style="color: #66cc66;">&#40;</span>f_bmd : BitmapData,  pt : Point, shiftA : <span style="color: #0066CC;">int</span>, shiftB : <span style="color: #0066CC;">int</span>, shiftC : <span style="color: #0066CC;">int</span>, shiftD : <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">Boolean</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>f_bmd.<span style="color: #006600;">getPixel32</span><span style="color: #66cc66;">&#40;</span>pt.<span style="color: #006600;">x</span> + shiftA, pt.<span style="color: #006600;">y</span> + shiftB<span style="color: #66cc66;">&#41;</span> == 0xff000000<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		_currentPt.<span style="color: #006600;">x</span> = pt.<span style="color: #006600;">x</span> + shiftA;
		_currentPt.<span style="color: #006600;">y</span> = pt.<span style="color: #006600;">y</span> + shiftB;
		_ptsAr.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>_currentPt.<span style="color: #006600;">x</span>, _currentPt.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>f_bmd.<span style="color: #006600;">getPixel32</span><span style="color: #66cc66;">&#40;</span>pt.<span style="color: #006600;">x</span> + shiftC, pt.<span style="color: #006600;">y</span> + shiftD<span style="color: #66cc66;">&#41;</span> == 0xff000000<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		_currentPt.<span style="color: #006600;">x</span> = pt.<span style="color: #006600;">x</span> + shiftC;
		_currentPt.<span style="color: #006600;">y</span> = pt.<span style="color: #006600;">y</span> + shiftD;
		_ptsAr.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>_currentPt.<span style="color: #006600;">x</span>, _currentPt.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;
	<span style="color: #66cc66;">&#125;</span>
	_ptsAr.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span>_currentPt.<span style="color: #006600;">x</span>, _currentPt.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>This is how I get the outline Array (Blue Line)</p>
<p>Now here&#8217;s the problem:</p>
<p><img class="alignnone size-full wp-image-195" title="edge1_2" src="http://www.alexmil.de/wp-content/edge1_2.jpg" alt="" width="400" height="563" /></p>
<p>Between <strong>D</strong> and <strong>B</strong> has to be a point with <strong>MaxHeight</strong>. So how can I calculate that height value.</p>
<p>My solution:</p>
<p>Looping over triangles with differenc C values. Then you have a triangle with known Points DBC DBC&#8217; DBC&#8221; and so on.</p>
<p>Fancy math:</p>
<p>Calculating the length from DB BC DC via sinus (easy). Now we have a trianlge DBC without any right angle. BUT we know the length of each side. After some researching I remembered this <a href="http://de.wikipedia.org/wiki/Kosinussatz" target="_blank">cosine math</a>.</p>
<p>So we know the angle BDC now. With simple sinus we can calulate the MaxHeight. Comparing the heights -&gt; you&#8217;re done :D</p>
<p>Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/vertex-detection-in-quad/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

