<?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>CleVR » Panoramic photography and image stitching blog &#187; math</title>
	<atom:link href="http://www.clevr.com/blog/category/math/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.clevr.com/blog</link>
	<description>Panoramic photography, virtual tours and stitching software</description>
	<lastBuildDate>Wed, 22 Jul 2009 18:24:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Actionscript 3 vector speedups</title>
		<link>http://www.clevr.com/blog/2008/actionscript-3-vector-speedups/</link>
		<comments>http://www.clevr.com/blog/2008/actionscript-3-vector-speedups/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 09:02:34 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[CleVR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[image processing]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[panoramas]]></category>
		<category><![CDATA[Stitcher]]></category>
		<category><![CDATA[Stitching software]]></category>

		<guid isPermaLink="false">http://www.clevr.com/blog/?p=82</guid>
		<description><![CDATA[Mike Chambers has posted a comparison between the performance of AS3 arrays and the new Vectors available in Flash Player 10. The results look good: he managed a 60% speedup. This is very exciting for us at CleVR, because of the potential impact it has on the Stitcher in particular. This uses massive Arrays and [...]]]></description>
			<content:encoded><![CDATA[<p>Mike Chambers has posted <a href="http://www.mikechambers.com/blog/2008/09/24/actioscript-3-vector-array-performance-comparison/">a comparison</a> between the performance of AS3 arrays and the new Vectors available in Flash Player 10. The results look good: he managed a 60% speedup. This is very exciting for us at CleVR, because of the potential impact it has on the Stitcher in particular. This uses massive Arrays and lots of nested loops which seem to be just the kind of thing that would benefit from this. I haven&#8217;t had a chance to do any benchmarking of my own (hard at work on CleVR Pro) but when I do I&#8217;ll post another entry.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.clevr.com/blog/2008/actionscript-3-vector-speedups/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Resizing Actionscript images with bicubic or bilinear interpolation</title>
		<link>http://www.clevr.com/blog/2008/resize-actionscript-bicubic-bilinear-interpolation/</link>
		<comments>http://www.clevr.com/blog/2008/resize-actionscript-bicubic-bilinear-interpolation/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 08:19:03 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[CleVR]]></category>
		<category><![CDATA[clevrlib]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[image processing]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://www.clevr.com/blog/2008/resize-actionscript-bicubic-bilinear-interpolation/</guid>
		<description><![CDATA[I&#8217;ve had a few people contact me to ask about how to use clevrlib to resize images with bicubic or bilinear interpolation in Flash or Flex, so I&#8217;ll give an overview of how to do this. The InterpolatedBitmapData class adds the methods getPixelBicubic and getPixelBilinear to the BitmapData class, which allows you to fetch the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a few people contact me to ask about how to use <a href="http://clevrlib.riaforge.org/">clevrlib</a> to resize images with bicubic or bilinear interpolation in Flash or Flex, so I&#8217;ll give an overview of how to do this. </p>
<p>The InterpolatedBitmapData class adds the methods <code>getPixelBicubic</code> and <code>getPixelBilinear</code> to the BitmapData class, which allows you to fetch the colour of a point that&#8217;s not on a pixel boundary. We use this when reprojecting the source images in the CleVR Stitcher, but it can work just as well for resizing an image. Bear in mind that bicubic is a lot slower than bilinear, and the quality improvement isn&#8217;t usually worthwhile. However, you&#8217;re welcome to switch to getPixelBicubic if you need to. </p>
<p>The basic method I&#8217;m using here for resizing is to loop through the pixels of the output image, getting the equivalent pixels in the source image. As these are found by multiplying by the ratio between the source and output sizes, the coordinates probably won&#8217;t be integers. Using regular getPixel would require rounding, and therefore give a jagged (aliased) output. The getPixelXxx methods let you pass them a Number, which needn&#8217;t be an integer, giving a much smoother result. </p>
<p>The sample code below shows a way of resizing an image using this method. The InterpolatedBitmapData should be created in the same way as a BitmapData, such as by <code>draw()</code>ing a loader onto it. The example I&#8217;ve shown below is an Event.COMPLETE handler for a Loader.  Code below the cut.<br />
<span id="more-65"></span></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">source</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">IBitmapDrawable</span> = event.<span style="color: #004993;">target</span>.<span style="color: #004993;">loader</span>;
&nbsp;
<span style="color: #6699cc; font-weight: bold;">var</span> original<span style="color: #000000; font-weight: bold;">:</span>InterpolatedBitmapData = <span style="color: #0033ff; font-weight: bold;">new</span> InterpolatedBitmapData<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>.<span style="color: #004993;">width</span>, <span style="color: #004993;">source</span>.<span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span>;
original.<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #3f5fbf;">/* The size of the output image */</span>
<span style="color: #6699cc; font-weight: bold;">var</span> newWidth<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">100</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> newHeight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">200</span>;
&nbsp;
<span style="color: #6699cc; font-weight: bold;">var</span> resized<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapData</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">BitmapData</span><span style="color: #000000;">&#40;</span>newWidth, newHeight<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #6699cc; font-weight: bold;">var</span> xFactor<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = original.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> newWidth;
<span style="color: #6699cc; font-weight: bold;">var</span> yFactor<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = original.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> newHeight;
&nbsp;
<span style="color: #3f5fbf;">/* Loop through the pixels of the output image, fetching the equivalent pixel from the input*/</span>
<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>; <span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">&lt;</span> newWidth; <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>; <span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">&lt;</span> newHeight; <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        resized.<span style="color: #004993;">setPixel</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">x</span>, <span style="color: #004993;">y</span>, original.getPixelBilinear<span style="color: #000000;">&#40;</span><span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">*</span> xFactor, <span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">*</span> yFactor<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.clevr.com/blog/2008/resize-actionscript-bicubic-bilinear-interpolation/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>CleVR Actionscript libraries now on RIAForge</title>
		<link>http://www.clevr.com/blog/2007/clevr-actionscript-libraries-now-on-riaforge/</link>
		<comments>http://www.clevr.com/blog/2007/clevr-actionscript-libraries-now-on-riaforge/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 12:27:09 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[CleVR]]></category>
		<category><![CDATA[clevrlib]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[image processing]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[Stitcher]]></category>

		<guid isPermaLink="false">http://www.clevr.com/blog/2007/clevr-actionscript-libraries-now-on-riaforge/</guid>
		<description><![CDATA[I&#8217;ve put up the CleVR AS3 libraries on RIAForge, where you can download them as a zip file, or use the svn repository. The library includes a number of classes that we developed as part of the CleVR Stitcher. They include a set of matrix algebra classes, ported from the Java JAMA library. These let [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve put up the CleVR AS3 libraries on <a href="http://clevrlib.riaforge.org/">RIAForge</a>, where you can download them as a zip file, or use the svn repository.</p>
<p>The library includes a number of classes that we developed as part of <a href="http://www.clevr.com/blog/air-stitcher/">the CleVR Stitcher</a>. They include a set of matrix algebra classes, ported from the Java JAMA library. These let you do standard matrix algebra stuff, and includes support for singular value decomposition and QR decomposition.</p>
<p>There&#8217;s also some graphics classes. One is a subclass of BitmapData that adds bicubic and bilinear interpolation. Another is a class for calculating the histogram of an image, with methods to do histogram stretching. This gives results similar to &#8220;Auto levels&#8221; in Photoshop, or &#8220;Enhance&#8221; in iPhoto.</p>
<p>You will find them <a href="http://clevrlib.riaforge.org/">here</a>. They&#8217;re released under the Creative Commons attribution licence, which basically lets you do anything with them, so long as you give credit somewhere. A link to clevr.com would usually suffice. Let me know if you have any comments, patches, or if you&#8217;re using it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.clevr.com/blog/2007/clevr-actionscript-libraries-now-on-riaforge/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Image enhancement with histogram stretching in Actionscript</title>
		<link>http://www.clevr.com/blog/2007/image-enhancement-with-histogram-stretching-in-actionscript/</link>
		<comments>http://www.clevr.com/blog/2007/image-enhancement-with-histogram-stretching-in-actionscript/#comments</comments>
		<pubDate>Fri, 27 Jul 2007 14:28:59 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Apollo]]></category>
		<category><![CDATA[CleVR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[image processing]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[panoramas]]></category>
		<category><![CDATA[Stitcher]]></category>
		<category><![CDATA[Stitching software]]></category>

		<guid isPermaLink="false">http://www.clevr.com/blog/2007/image-enhancement-with-histogram-stretching-in-actionscript/</guid>
		<description><![CDATA[Yesterday&#8217;s update to the CleVR Stitcher has a number of new features. One of these is image enhancement for the finished panorama. This corrects under- or over-exposed images, and works in a similar way to &#8220;Auto levels&#8221; in Photoshop, or Enhance in iPhoto. See below for more details and a demo. This is called histogram [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday&#8217;s update to the CleVR Stitcher has a number of new features. One of these is image enhancement for the finished panorama. This corrects under- or over-exposed images, and works in a similar way to &#8220;Auto levels&#8221; in Photoshop, or Enhance in iPhoto. See below for more details and a demo.<br />
<span id="more-33"></span></p>
<div style='float: right; width: 300px; margin: 10px; padding: 5px; text-align: center'>
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="300" height="450" id="Stitcher" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="blog/wp-content/uploads/2007/07/histotest.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="blog/wp-content/uploads/2007/07/histotest.swf" quality="high" bgcolor="#ffffff" width="300" height="450" name="Stitcher" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br />
	</object></div>
<p>This is called histogram stretching, and works by finding the lightest and darkest parts of the image and then &#8220;stretching&#8221; all of the colours so that the lightest part is white, the darkest is black, and all the others are distributed evenly between those. I&#8217;ve added a slider that allows you to set the threshold for this, which basically sets a minimum number of pixels that are required for it to count as the lightest or darkest area. You can adjust the slider to get the best results. There&#8217;s a little demo version below. Install the Stitcher below if you want to try the whole thing.</p>
<p><iframe style='border: 0' width='250' height='200' src='/stitch/badge.html' scrolling='no'></iframe><br />
I&#8217;ve added the Histogram class to the other code that we&#8217;ve released, and bundled it all up as a library. You can get it from here: <a id="p36" href="http://clevrlib.riaforge.org/" title="CleVR Actionscript Library">CleVR Actionscript Library</a>. The class calculates a histogram for a bitmap image, and generates ColorMatrixFilters and ColorTransforms that can be used to correct the images.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.clevr.com/blog/2007/image-enhancement-with-histogram-stretching-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bicubic and bilinear interpolation in Actionscript 3</title>
		<link>http://www.clevr.com/blog/2007/bicubic-bilinear-interpolation-actionscript/</link>
		<comments>http://www.clevr.com/blog/2007/bicubic-bilinear-interpolation-actionscript/#comments</comments>
		<pubDate>Mon, 02 Jul 2007 09:53:55 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Apollo]]></category>
		<category><![CDATA[CleVR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[panoramas]]></category>
		<category><![CDATA[Stitcher]]></category>
		<category><![CDATA[Stitching software]]></category>

		<guid isPermaLink="false">http://www.clevr.com/blog/2007/bicubic-bilinear-interpolation-actionscript/</guid>
		<description><![CDATA[For the second release of utility code from CleVR Stitcher, the Adobe AIR panoramic photo stitcher, I&#8217;m offering our InterpolatedBitmapData class. The class adds support for bicubic and bilinear interpolation to the Actionscript BitmapData class. It adds two public methods &#8211; getPixelBilinear and getPixelBicubic. You can call these with sub-pixel coordinates and it will interpolate [...]]]></description>
			<content:encoded><![CDATA[<p>For the second release of utility code from <a href="http://www.clevr.com/blog/2007/adobe-air-panoramic-photo-stitcher/">CleVR Stitcher</a>, the Adobe AIR panoramic photo stitcher, I&#8217;m offering our InterpolatedBitmapData class.<br />
The class adds support for bicubic and bilinear interpolation to the Actionscript BitmapData class. It adds two public methods &#8211; getPixelBilinear and getPixelBicubic. You can call these with sub-pixel coordinates and it will interpolate the RGB value for that point.  This should be useful for anyone doing more complex transformations than those offered by the Matrix class. I hope it will be useful to someone. Do let me know if you&#8217;re using it. As ever, a link back to clevr.com is appreciated but not required.</p>
<p>Download it as part of the <a href="http://clevrlib.riaforge.org/">CleVR Actionscript Library</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.clevr.com/blog/2007/bicubic-bilinear-interpolation-actionscript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Linear algebra and matrix manipulation library for Actionscript 3</title>
		<link>http://www.clevr.com/blog/2007/linear-algebra-matrix-actionscript-3/</link>
		<comments>http://www.clevr.com/blog/2007/linear-algebra-matrix-actionscript-3/#comments</comments>
		<pubDate>Sat, 30 Jun 2007 11:56:05 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Apollo]]></category>
		<category><![CDATA[CleVR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[Stitcher]]></category>

		<guid isPermaLink="false">http://www.clevr.com/blog/2007/linear-algebra-matrix-actionscript-3/</guid>
		<description><![CDATA[While developing the CleVR Stitcher, I needed to do quite a bit of linear algebra. I was disappointed to find that there was no Actionscript library out there for doing this, so I had to write my own. Rather than doing it from scratch, I decided to start with NIST&#8217;s Java Matrix library: JAMA, which [...]]]></description>
			<content:encoded><![CDATA[<p>While developing the <a href="http://www.clevr.com/blog/2007/adobe-air-panoramic-photo-stitcher/">CleVR Stitcher</a>, I needed to do quite a bit of linear algebra. I was disappointed to find that there was no Actionscript library out there for doing this, so I had to write my own. Rather than doing it from scratch, I decided to start with NIST&#8217;s Java Matrix library: <a href="http://math.nist.gov/javanumerics/jama/">JAMA</a>, which is in the public domain.</p>
<p>For the benefit of anyone else needing to do stuff like this, I&#8217;m releasing the library. It&#8217;s not a full port, as I only implemented the stuff that I need. It does however support most regular operations for manipulating real matrices. As well as the normal algebra stuff, it includes classes for singular value decomposition and QR decomposition. I hope others find it useful. Let me know if you&#8217;re using it. A link back to clevr.com from your site would be appreciated but is not required.</p>
<p>Download it as part of the <a href="http://clevrlib.riaforge.org/">CleVR Actionscript Library</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.clevr.com/blog/2007/linear-algebra-matrix-actionscript-3/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

