<?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>Visual-Experiments.com &#187; html</title>
	<atom:link href="http://www.visual-experiments.com/category/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.visual-experiments.com</link>
	<description>ASTRE Henri experiments with Ogre3D and web stuff</description>
	<lastBuildDate>Mon, 16 Jan 2017 18:59:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Ransac.js</title>
		<link>http://www.visual-experiments.com/2012/04/22/ransac-js/</link>
		<comments>http://www.visual-experiments.com/2012/04/22/ransac-js/#comments</comments>
		<pubDate>Sun, 22 Apr 2012 17:46:28 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[ransac]]></category>
		<category><![CDATA[ransac.js]]></category>
		<category><![CDATA[recon]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=2282</guid>
		<description><![CDATA[Recently I&#8217;ve been reading a very interesting paper about a threshold-free Ransac solution called Recon (stand for REsidual CONsensus). The video presentation is very interesting and makes me realize that Ransac is a very visual algorithm! Thus I&#8217;ve decided to create a javascript implementation which draw each iterations on a Html5 canvas. I&#8217;ll try to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been reading a very interesting paper about a threshold-free <a href="http://en.wikipedia.org/wiki/RANSAC">Ransac</a> solution called <a href="http://www.cs.unc.edu/~rraguram/research.html#recon">Recon</a> (stand for REsidual CONsensus). The video presentation is very interesting and makes me realize that Ransac is a very visual algorithm! Thus I&#8217;ve decided to create a javascript implementation which draw each iterations on a Html5 canvas. I&#8217;ll try to implement Recon as well.</p>
<table>
<tr>
<td colspan="2">Illustrations from <a href="http://en.wikipedia.org/wiki/RANSAC">Wikipedia</a></td>
</tr>
<tr>
<td><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/04/points.png" alt="" title="points" width="255" height="255" class="alignleft size-full wp-image-2286" /></td>
<td><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/04/model.png" alt="" title="model" width="255" height="255" class="alignleft size-full wp-image-2285" /></td>
</tr>
<tr>
<td>Input points</td>
<td>Estimated fitting line</td>
</tr>
</table>
<h3 style="text-align: center">
<a href="http://www.visual-experiments.com/demo/ransac.js/">->Launch live demo<-</a><br />
</h3>
<p><br/></p>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/04/ransac_line_fitting1.gif" alt="" title="ransac line fitting" width="500" height="500" class="aligncenter size-full wp-image-2316" /></p>
<p style="text-align: center;">Animated GIF of the iterations</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2012%2F04%2F22%2Fransac-js%2F&amp;title=Ransac.js"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2012/04/22/ransac-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebGL Photosynth extension updated</title>
		<link>http://www.visual-experiments.com/2012/03/25/webgl-photosynth-extension-updated/</link>
		<comments>http://www.visual-experiments.com/2012/03/25/webgl-photosynth-extension-updated/#comments</comments>
		<pubDate>Sun, 25 Mar 2012 21:08:12 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[google chrome]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[photosynth]]></category>
		<category><![CDATA[three.js]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=2231</guid>
		<description><![CDATA[I&#8217;ve updated my PhotoSynth extension for Google Chrome. I&#8217;ve included all optimization described in my previous post: point cloud loading is 4x faster and ply file generation could be 17x faster in some cases . As you can see in the screenshot below, I&#8217;ve also added a new checkbox to let you choose if you [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated my <a href="https://chrome.google.com/webstore/detail/jnnhdiolpfgjbgagkbmdfidfofancmee">PhotoSynth extension for Google Chrome</a>. I&#8217;ve included all optimization described in <a href="http://www.visual-experiments.com/2012/03/19/improving-photosynth-extension-performance/">my previous post</a>: <strong>point cloud loading is 4x faster</strong> and ply file generation could be 17x faster in some cases <img src='http://www.visual-experiments.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . As you can see in the screenshot below, I&#8217;ve also added a new checkbox to let you choose if you want to load thumbnails or not in the WebGL context (which could take a while for synth with more than 200 pictures).<br />
<img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/03/extension.jpg" alt="" title="webgl photosynth extension updated" width="600" height="362" class="alignleft size-full wp-image-2232" /></p>
<div style="margin-top: 20px;">&nbsp;</div>
<p>There is still room for improvements: I&#8217;ve discovered lot of interesting stuff that I&#8217;ve to try in <a href="http://www.youtube.com/watch?v=XAqIpGU8ZZk">Lilli Thompson speech at the GDC</a>. In particular I&#8217;d like to improve:</p>
<ul>
<li>memory usage: track V8 garbage collection</li>
<li>thumbnails loading: could be speed-up by using a web workers too</li>
<li>Three.js rendering: I still need to switch to r48 and use BufferGeometry</li>
<li>bundle.out generation: still very slow for big synth</li>
</ul>
<p>To accelerate bundle.out file generation I&#8217;ve found a solution working pretty well for very large ascii file (80mo+). I&#8217;m generating the ascii file by writing directly in binary in a Uint8Array (by chunk of 1mo). The resulting code is more complex but is as fast as regular string concatenation and in comparison as a memory footprint very limited. It&#8217;s not integrated in the extension yet as my test case is working well (ascii ply generation) but bundle.out is slow (I need to track V8 bailout/deopt to understand why it&#8217;s slow).</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2012%2F03%2F25%2Fwebgl-photosynth-extension-updated%2F&amp;title=WebGL%20Photosynth%20extension%20updated"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2012/03/25/webgl-photosynth-extension-updated/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Improving PhotoSynth extension performance</title>
		<link>http://www.visual-experiments.com/2012/03/19/improving-photosynth-extension-performance/</link>
		<comments>http://www.visual-experiments.com/2012/03/19/improving-photosynth-extension-performance/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 22:38:31 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[google chrome]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[photosynth]]></category>
		<category><![CDATA[three.js]]></category>
		<category><![CDATA[webgl]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=2150</guid>
		<description><![CDATA[I&#8217;ve recently discover the new transferable object feature in Google chrome. BTW transferable objects are really great! Furthermore you really should use them as I&#8217;ve found that structure cloning is leaking (you can try this leaking demo with chrome 17). Thus I&#8217;ve started to update my extension and done a benchmark of various solution with [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently discover the new <a href="http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast">transferable object</a> feature in Google chrome. BTW transferable objects are really great! Furthermore you really should use them as I&#8217;ve found that structure cloning is leaking (<a href="http://visual-experiments.com/demo/transfert/">you can try this leaking demo</a> with chrome 17). Thus I&#8217;ve started to update my extension and done a benchmark of various solution with a big synth of 20mo (1200k vertices and 1000 pictures). </p>
<p>I&#8217;ve also improved a lot my binary parsing by using only native binary parsing (<a href="https://developer.mozilla.org/en/JavaScript_typed_arrays/DataView">DataView</a>). One thing about DataView: <strong>did they realize that if you forgot the endianness parameter it will use BigEndian</strong>? <em>(littleEndian = x86, bigEndian = Motora 68k).</em></p>
<p>Thanks to both optimization <strong>the new version is 4x faster!</strong> (loading time: 24s > 6s)</p>
<h3>solution 1</h3>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/03/flow-11.jpg" alt="" title="flow-1" width="400" height="126" class="alignleft size-full wp-image-2186" /><br />
<br style="clear: both"/></p>
<ul>
<li>cross-orign was forbidden in contentscript (fixed now since chrome 13)</li>
<li>lack of TypedArray copy/transfert -> JS array replacement</li>
<li><strong>Loading time: 13600ms</strong> (24400ms with the previous version without optimized binary parsing)</li>
</ul>
<h3>solution 2</h3>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/03/flow-2.jpg" alt="" title="flow-2" width="300" height="82" class="alignleft size-full wp-image-2152" /><br />
<br style="clear: both"/></p>
<ul>
<li><strong>Issue:</strong> the UI is frozen during parsing (lack of threading)</li>
<li><strong>Loading time: 6500ms</strong></li>
</ul>
<h3>solution 3</h3>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/03/flow-3.jpg" alt="" title="flow-3" width="400" height="139" class="alignleft size-full wp-image-2153" /><br />
<br style="clear: both"/></p>
<ul>
<li>I&#8217;m using transferable objects to both send the xhr.response (ArrayBuffer) and receive the parsed Float32Array (vertex positions) and Uint8Array (vertex colors).</li>
<li><strong>Issue:</strong> I didn&#8217;t manage to spawn a worker from my extension directly (SECURITY_ERR: DOM Exception 18): I&#8217;ve been forced to <a href="http://blogs.microsoft.co.il/blogs/gilf/archive/2012/01/29/working-with-inline-web-workers.aspx">inline the worker</a> as a workaround.</li>
<li><strong>Loading time:  6000ms</strong></li>
</ul>
<h3>solution 4</h3>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/03/flow-4.jpg" alt="" title="flow-4" width="400" height="139" class="alignleft size-full wp-image-2154" /><br />
<br style="clear: both"/></p>
<ul>
<li><strong>Issue:</strong> because of <a href="http://code.google.com/p/chromium/issues/detail?id=45382">this bug</a> workers can not do cross-orign xhr.</li>
<li><strong>Loading time: N/A</strong></li>
</ul>
<p>I&#8217;ve also optimized the PLY file generation by generating binary file on the client side instead of ascii. </p>
<ul>
<li>Ascii: 74mo in 9000ms</li>
<li>Binary: 17mo in 530ms <strong>(~17x faster!)</strong></li>
</ul>
<p>Sadly I didn&#8217;t manage to find a way to accelerate <em>&#8220;bundle.out&#8221;</em> ascii file generation yet (involving lot of string concatenation and numbers formatting).</p>
<p><strong>I didn&#8217;t have updated the extension on the chrome web store yet</strong> as I&#8217;m working on using the new BufferGeometry of Three.js that should be more efficient. Building BufferGeometry directly from  Float32Array (vertex positions array) and Uint8Array (vertex colors array) seems a really better solution IMO.</p>
<h3>Mesh compression</h3>
<p>I&#8217;ve also discover the <a href="http://code.google.com/p/webgl-loader/">webgl-loader</a> mesh compression solution recently. I&#8217;ve compiled my own version of <a href="http://code.google.com/p/webgl-loader/source/browse/trunk/src/objcompress.cc">objcompress.cc</a> and fixed the JSON export. Then I&#8217;ve created my own format allowing to pack in one file all the utf8 files (thus reducing the number of http request needed). I will post about it soon: stay tuned!</p>
<h3>Firefox extension?</h3>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/02/screenshot2.jpg" alt="" title="Firefox extension" width="600" height="424" class="aligncenter size-full wp-image-2141" /><br />
On a side note I&#8217;ve also been playing with the new <a href="https://builder.addons.mozilla.org/">mozilla add-on builder SDK</a>&#8230; well IMO Firefox isn&#8217;t the best browser for extension anymore. I&#8217;ve been very disappointed by the restriction applied to code running in the contentscript (for example <a href="http://prototypejs.org/">prototype.js</a> is not working: I had to use a clone that I&#8217;ve built long time ago). And I&#8217;m also very concerned about their security strategy: they don&#8217;t have a cross-orign xhr permissions field in the manifest. Thus extensions can do cross-orign request to all domains by default! Nevertheless I&#8217;ve managed to port the binary parsing of the point cloud but Three.js is not working either <img src='http://www.visual-experiments.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> . </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2012%2F03%2F19%2Fimproving-photosynth-extension-performance%2F&amp;title=Improving%20PhotoSynth%20extension%20performance"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2012/03/19/improving-photosynth-extension-performance/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PhotoSynth bundle.out export!</title>
		<link>http://www.visual-experiments.com/2012/02/01/photosynth-bundle-out-export/</link>
		<comments>http://www.visual-experiments.com/2012/02/01/photosynth-bundle-out-export/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 21:18:28 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[google chrome]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[photosynth]]></category>
		<category><![CDATA[three.js]]></category>
		<category><![CDATA[webgl]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=2114</guid>
		<description><![CDATA[I&#8217;ve updated my Google Chrome extension to export a valid bundle.out from a PhotoSynth. The bundle.out generated need to be used with HD version of the images (not the thumbnails). Moreover I&#8217;ve removed tracks of length 2 from the bundle.out as I guess that PhotoSynth is keeping them only to get a &#8220;denser&#8221; point cloud [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated my <a href="https://chrome.google.com/webstore/detail/jnnhdiolpfgjbgagkbmdfidfofancmee">Google Chrome extension</a> to export a valid bundle.out from a PhotoSynth. The <a href="http://phototour.cs.washington.edu/bundler/bundler-v0.4-manual.html">bundle.out</a> generated need to be used with HD version of the images (not the thumbnails). Moreover I&#8217;ve removed tracks of length 2 from the bundle.out as I guess that PhotoSynth is keeping them only to get a &#8220;denser&#8221; point cloud (aesthetic purpose only)? One more thing: you can not use the bundle.out file to run a bundle adjustment as the 2d measurements are unknown (I have computed them by projecting the tracks in corresponding cameras).</p>
<p>I&#8217;m sure that some of you have an idea of what to do with a bundle.out file from a PhotoSynth <img src='http://www.visual-experiments.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .<br />
BTW, this export wouldn&#8217;t have been possible without Peter Sibley help, <strong>thanks Peter</strong>! He has help me by giving me the missing information needed to do the bundle.out PhotoSynth export.</p>
<p><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2012/01/screenshot.jpg" alt="" title="PhotoSynth viewer with Bundle.out support" width="600" height="344" class="aligncenter size-full wp-image-2120" /></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2012%2F02%2F01%2Fphotosynth-bundle-out-export%2F&amp;title=PhotoSynth%20bundle.out%20export%21"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2012/02/01/photosynth-bundle-out-export/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>PhotoSynth viewer with HTML5 FileSaver</title>
		<link>http://www.visual-experiments.com/2012/01/15/photosynth-webgl-viewer-with-html5-fileaver/</link>
		<comments>http://www.visual-experiments.com/2012/01/15/photosynth-webgl-viewer-with-html5-fileaver/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 21:51:13 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[google chrome]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[photosynth]]></category>
		<category><![CDATA[three.js]]></category>
		<category><![CDATA[webgl]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=2088</guid>
		<description><![CDATA[Happy New Year Everyone! This is my small gift for 2012: I&#8217;ve updated my PhotoSynth Google chrome extension! New features: Point cloud downloading is working now! Previous downloadify solution wasn&#8217;t working due to a Chrome bug and was removed New version is using Html5 BlobBuilder + FileSaver instead But you need a Chrome version >15 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Happy New Year Everyone! </strong><br />
This is my small gift for 2012: I&#8217;ve updated my <a href="https://chrome.google.com/webstore/detail/jnnhdiolpfgjbgagkbmdfidfofancmee">PhotoSynth Google chrome extension</a>!</p>
<p><strong>New features:</strong></p>
<ul style="margin-left: 20px;">
<li>Point cloud downloading is working now!
<ul>
<li>Previous <a href="https://github.com/dcneiner/Downloadify">downloadify</a> solution wasn&#8217;t working due to a <a href="http://code.google.com/p/chromium/issues/detail?id=58907">Chrome bug</a> and was removed</li>
<li>New version is using Html5 <a href="https://github.com/eligrey/BlobBuilder.js">BlobBuilder</a> + <a href="https://github.com/eligrey/FileSaver.js">FileSaver</a> instead</li>
<li>But you need a Chrome version >15</li>
</ul>
</li>
<li>Picture thumbnails are displayed thanks to my <a href="http://www.visual-experiments.com/2011/12/05/how-to-bypass-webgl-sop-restriction-v2/">sop bypass trick</a></li>
<li><a href="http://blogs.msdn.com/b/photosynth/archive/2011/10/18/photosynth-moving-to-windows-azure.aspx">Windows Azure support</a> (corresponding permission was added to the manifest)</li>
</ul>
<p><strong>Other features are coming:</strong></p>
<ul style="margin-left: 20px;">
<li><a href="http://www.visual-experiments.com/2011/11/01/photosynth-webgl-panorama-viewer/">basic panorama support</a> (using atlas.jpg only: no progressive download yet)</li>
<li>download <a href="http://jszip.stuartk.co.uk/">zip file</a> of whole synth?</li>
<li>bug fixes (the current version is still very buggy, especially the menu)</li>
<li>other cool stuff are coming! <img src='http://www.visual-experiments.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
<p>If you don&#8217;t have Chrome you can take a look at my <a href="http://www.youtube.com/watch?v=o4I8WWm61gs&#038;feature=player_embedded">previous video</a> showing most of the new feature (except point cloud downloading). The previous version wasn&#8217;t available as it was using <a href="http://www.visual-experiments.com/2011/10/03/how-to-bypass-webgl-sop-restriction/">my previous trick to bypass sop restriction</a> (too slow to be widely used).</p>
<p>The new version is available on the <a href="https://chrome.google.com/webstore/detail/jnnhdiolpfgjbgagkbmdfidfofancmee">Google Web Store</a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2012%2F01%2F15%2Fphotosynth-webgl-viewer-with-html5-fileaver%2F&amp;title=PhotoSynth%20viewer%20with%20HTML5%20FileSaver"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2012/01/15/photosynth-webgl-viewer-with-html5-fileaver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to bypass WebGL Sop restriction v2</title>
		<link>http://www.visual-experiments.com/2011/12/05/how-to-bypass-webgl-sop-restriction-v2/</link>
		<comments>http://www.visual-experiments.com/2011/12/05/how-to-bypass-webgl-sop-restriction-v2/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 22:17:29 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[restriction]]></category>
		<category><![CDATA[same-origin-policy]]></category>
		<category><![CDATA[sop]]></category>
		<category><![CDATA[webgl]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=2060</guid>
		<description><![CDATA[I&#8217;ve previously posted a trick to bypass the WebGL same origin policy restriction in a particular context. But my solution had a major drawback: it was slow due to jpeg decoding in javascript. Hopefully I&#8217;ve implemented a new solution which is way much faster thanks to John Bauman suggestion and it works like a charm! [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve previously posted a trick to <a href="http://www.visual-experiments.com/2011/10/03/how-to-bypass-webgl-sop-restriction/">bypass the WebGL same origin policy</a> restriction in a particular context. But my solution had a major drawback: it was slow due to jpeg decoding in javascript. Hopefully I&#8217;ve implemented a new solution which is way much faster thanks to <a href="http://www.visual-experiments.com/2011/10/03/how-to-bypass-webgl-sop-restriction/comment-page-1/#comment-8711">John Bauman suggestion</a> and it works like a charm! </p>
<pre class="brush: jscript; highlight: [10]; title: ;">
var xhr = new XMLHttpRequest();
xhr.open(&quot;GET&quot;, JPEG_URL, true);
xhr.responseType = &quot;arraybuffer&quot;;
xhr.onload = function() {
	var img = new Image();
	img.onload = function() {
		var tex = new THREE.Texture(this);
		//do something with this texture...
	};
	img.src = arrayBufferDataUri(xhr.response);
};
xhr.send(null);
</pre>
<p>The function &#8220;<strong>arrayBufferDataUri</strong>&#8221; at the line 10 allow to speed-up the conversion from ArrayBuffer to base64 ascii string by avoiding an extra copy needed to use <strong>window.btoa</strong>. I&#8217;ve found this function here: <a href="http://jsperf.com/encoding-xhr-image-data/5">http://jsperf.com/encoding-xhr-image-data/5</a>.</p>
<pre class="brush: jscript; title: ;">
//From: http://jsperf.com/encoding-xhr-image-data/5
function arrayBufferDataUri(raw) {
	var base64 = '';
	var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
	var bytes = new Uint8Array(raw);
	var byteLength = bytes.byteLength;
	var byteRemainder = byteLength % 3;
	var mainLength = byteLength - byteRemainder;
	var a, b, c, d;
	var chunk;
	// Main loop deals with bytes in chunks of 3
	for (var i = 0; i &lt; mainLength; i = i + 3) {
		// Combine the three bytes into a single integer
		chunk = (bytes[i] &lt;&lt; 16) | (bytes[i + 1] &lt;&lt; 8 ) | bytes[i + 2];
		// Use bitmasks to extract 6-bit segments from the triplet
		a = (chunk &amp; 16515072) &gt;&gt; 18; // 16515072 = (2^6 - 1) &lt;&lt; 18
		b = (chunk &amp; 258048) &gt;&gt; 12;   // 258048   = (2^6 - 1) &lt;&lt; 12
		c = (chunk &amp; 4032) &gt;&gt; 6;      // 4032     = (2^6 - 1) &lt;&lt; 6
		d = chunk &amp; 63;               // 63       = 2^6 - 1
		// Convert the raw binary segments to the appropriate ASCII encoding
		base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d]
	}
	// Deal with the remaining bytes and padding
	if (byteRemainder == 1) {
		chunk = bytes[mainLength];
		a = (chunk &amp; 252) &gt;&gt; 2; // 252 = (2^6 - 1) &lt;&lt; 2
		// Set the 4 least significant bits to zero
		b = (chunk &amp; 3) &lt;&lt; 4;   // 3   = 2^2 - 1
		base64 += encodings[a] + encodings[b] + '==';
	}
	else if (byteRemainder == 2) {
		chunk = (bytes[mainLength] &lt;&lt; 8 ) | bytes[mainLength + 1];
		a = (chunk &amp; 16128) &gt;&gt; 8; // 16128 = (2^6 - 1) &lt;&lt; 8
		b = (chunk &amp; 1008) &gt;&gt; 4;  // 1008  = (2^6 - 1) &lt;&lt; 4
		// Set the 2 least significant bits to zero
		c = (chunk &amp; 15) &lt;&lt; 2;    // 15    = 2^4 - 1
		base64 += encodings[a] + encodings[b] + encodings[c] + '=';
	}
	return &quot;data:image/jpeg;base64,&quot; + base64;
}
</pre>
<p>I&#8217;ve only used this code for my <a href="http://www.visual-experiments.com/2011/10/03/three-js-photosynth-viewer-with-pictures-and-new-ui/">Google Chrome PhotoSynth WebGL extension</a>. This is why I don&#8217;t have added extra check for other browser (line 10: <em>xhr.mozResponseArrayBuffer || xhr.response</em>).</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2011%2F12%2F05%2Fhow-to-bypass-webgl-sop-restriction-v2%2F&amp;title=How%20to%20bypass%20WebGL%20Sop%20restriction%20v2"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2011/12/05/how-to-bypass-webgl-sop-restriction-v2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PhotoSynth WebGL panorama viewer</title>
		<link>http://www.visual-experiments.com/2011/11/01/photosynth-webgl-panorama-viewer/</link>
		<comments>http://www.visual-experiments.com/2011/11/01/photosynth-webgl-panorama-viewer/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 21:48:00 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[photosynth]]></category>
		<category><![CDATA[panorama]]></category>
		<category><![CDATA[three.js]]></category>
		<category><![CDATA[webgl]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=2018</guid>
		<description><![CDATA[I&#8217;ve updated my PhotoSynth Downloader/Parser to be able to process Synth and Panorama as well. The network part of my PhotoSynth downloader was really ugly: I&#8217;ve rewrote it from scratch using libcurl. This version is really much faster and doesn&#8217;t crash anymore. But I&#8217;m a bit concerned about releasing the binary/source code. Allowing the download [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated my PhotoSynth Downloader/Parser to be able to process Synth and <strong>Panorama as well</strong>. The network part of my PhotoSynth downloader was really ugly: I&#8217;ve rewrote it from scratch using <a href="http://curl.haxx.se/libcurl/">libcurl</a>. This version is really much faster and doesn&#8217;t crash anymore. But I&#8217;m a bit concerned about releasing the binary/source code. Allowing the download of a panorama created with an iPhone doesn&#8217;t bother me but it&#8217;s really different with gigapixel panorama (and my downloader can download both).</p>
<p><a href="http://www.visual-experiments.com/demo/photosynth-pano-viewer-v1/"><img src="http://www.visual-experiments.com/blog/wp-content/uploads/2011/11/viewer.jpg" alt="" title="PhotoSynth WebGL panorama viewer" width="578" height="409" class="aligncenter size-full wp-image-2033" /></a></p>
<p style="text-align: center; font-size: 20px; font-weight: bold;"><a href="http://www.visual-experiments.com/demo/photosynth-pano-viewer-v1/">Live Demo (require WebGL enabled browser)</a></p>
<p>My implementation is very strait-forward: my PhotoSynthHDDownloader creates 6 jpg from a panorama url. The 6 faces of the cube are downloaded at full resolution. This solution is suitable for panorama created with an iPhone (low res) but not acceptable for gigapixel panorama (you need progressive download/display). I&#8217;m using <a href="https://github.com/mrdoob/three.js/">Three.js</a> as WebGL engine and I&#8217;d like to implement a <strong>megatexture</strong> solution to display very large panorama (I&#8217;ve found a very impressive <a href="http://www.noxa.org/blog/2009/11/29/megatextures-in-webgl-2/">working implementation</a> and played with it: it is working with Google Chrome / Firefox 10).</p>
<p>To be able to handle panorama as well, <a href="https://chrome.google.com/webstore/detail/jnnhdiolpfgjbgagkbmdfidfofancmee">my Google Chrome extension</a> needs to use megatexture and it would be really more efficient if Microsoft could add the missing cors header to allow WebGL cross-origin (even only for photosynth.net). And as they&#8217;ve <a href="http://blogs.msdn.com/b/photosynth/archive/2011/10/18/photosynth-moving-to-windows-azure.aspx">just moved their data to Windows Azure</a>, I guess that it may be easier to add this header <img src='http://www.visual-experiments.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . Otherwise I&#8217;ll have to use my special trick <a href="http://www.visual-experiments.com/2011/10/03/how-to-bypass-webgl-sop-restriction/">to bypass webgl same-origin-policy restriction</a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2011%2F11%2F01%2Fphotosynth-webgl-panorama-viewer%2F&amp;title=PhotoSynth%20WebGL%20panorama%20viewer"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2011/11/01/photosynth-webgl-panorama-viewer/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Three.js PhotoSynth Viewer with pictures and new UI</title>
		<link>http://www.visual-experiments.com/2011/10/03/three-js-photosynth-viewer-with-pictures-and-new-ui/</link>
		<comments>http://www.visual-experiments.com/2011/10/03/three-js-photosynth-viewer-with-pictures-and-new-ui/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 17:05:44 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[google chrome]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[photosynth]]></category>
		<category><![CDATA[three.js]]></category>
		<category><![CDATA[webgl]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=1993</guid>
		<description><![CDATA[I really like JS development and my Google Chrome PhotoSynth extension is a really good opportunity to experiment new thing with WebGL. So I’ve added new features to my previous version: Navigation system (like the Microsoft Silverlight one) Thumbnails display in the WebGL content [beta] Adding the pictures wasn&#8217;t easy: it is not possible to [...]]]></description>
			<content:encoded><![CDATA[<p>I really like JS development and my <a href="https://chrome.google.com/webstore/detail/jnnhdiolpfgjbgagkbmdfidfofancmee">Google Chrome PhotoSynth extension</a> is a really good opportunity to experiment new thing with WebGL. So I’ve added new features to my <a href="http://www.visual-experiments.com/2011/07/21/google-chrome-photosynth-viewer-using-three-js/">previous version</a>:</p>
<ul style="margin-left: 20px">
<li>Navigation system (like the Microsoft Silverlight one)</li>
<li>Thumbnails display in the WebGL content [beta]</li>
</ul>
<p><iframe width="560" height="315" src="http://www.youtube.com/embed/o4I8WWm61gs" frameborder="0" allowfullscreen></iframe></p>
<p>Adding the pictures wasn&#8217;t easy: it is not possible to draw a texture coming from another domain on a WebGL context for <a href="http://www.contextis.com/resources/blog/webgl/">security reason</a>. I have found a workaround for this issue (AFAIK unknown:  see <a href="http://www.visual-experiments.com/2011/10/03/how-to-bypass-webgl-sop-restriction/">my post about it</a>). I&#8217;ve also managed to &#8220;clone&#8221; the UI of the Silverlight viewer and to find out how to parse some navigation information from the JSON file provided with each Synth. But I wish that the PhotoSynth team gives me some information about the meaning of some other undocumented parameters&#8230;</p>
<p>I won&#8217;t release this new version as it is CPU hungry (because of the WebGL restriction workaround), but if the PhotoSynth team adds the missing CORS header this could solve the current WebGL restriction in a cleaner way <img src='http://www.visual-experiments.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
<p>A new feature is coming too (related to my new work at <a href="http://www.acute3d.com/">Acute3D</a>).</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2011%2F10%2F03%2Fthree-js-photosynth-viewer-with-pictures-and-new-ui%2F&amp;title=Three.js%20PhotoSynth%20Viewer%20with%20pictures%20and%20new%20UI"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2011/10/03/three-js-photosynth-viewer-with-pictures-and-new-ui/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to bypass WebGL Sop restriction</title>
		<link>http://www.visual-experiments.com/2011/10/03/how-to-bypass-webgl-sop-restriction/</link>
		<comments>http://www.visual-experiments.com/2011/10/03/how-to-bypass-webgl-sop-restriction/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 16:54:59 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[restriction]]></category>
		<category><![CDATA[same-origin-policy]]></category>
		<category><![CDATA[sop]]></category>
		<category><![CDATA[webgl]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=1969</guid>
		<description><![CDATA[Google Chrome and Firefox are blocking cross-domain image in WebGL (because of a security issue). This is really annoying when you want to display image from other domain in WebGL. To bypass this same-origin-policy restriction you have several options: Ask the other domain to add a CORS http header Use a proxy Use my trick [...]]]></description>
			<content:encoded><![CDATA[<p>Google Chrome and Firefox are blocking cross-domain image in WebGL (because of a <a href="http://www.contextis.com/resources/blog/webgl/">security issue</a>). This is really annoying when you want to display image from other domain in WebGL. To bypass this same-origin-policy restriction you have several options:</p>
<ul style="margin-left: 20px;">
<li>Ask the other domain to add a <a href="http://enable-cors.org/">CORS http header</a></li>
<li>Use a proxy</li>
<li>Use my trick <img src='http://www.visual-experiments.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </li>
</ul>
<p>Ok, to be honest<strong> my &#8220;trick&#8221; only work for browser extensions</strong> (tested with Google Chrome extension only). How is it working?</p>
<ul style="margin-left: 20px;">
<li>Add the domain in the list of allowed cross-domain ajax call in the manifest of the extension.</li>
<li>Do a binary ajax request on the jpeg</li>
<li>Parse the jpeg in javascript using <a href="https://github.com/notmasteryet/jpgjs">jpgjs</a></li>
<li>Fill the WebGL texture with the jpeg decoded in JS</li>
</ul>
<p>The drawbacks are that it can only be used by browser extensions and that JS jpeg decoding is slow compared to native decoding.</p>
<p><strong>I&#8217;ve used this workaround to add the pictures in my WebGL PhotoSynth Viewer extension.</strong></p>
<p style="font-size: 20px;color: red">I&#8217;ve posted a <a href="http://www.visual-experiments.com/2011/12/05/how-to-bypass-webgl-sop-restriction-v2/">new version</a> which is really much faster.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2011%2F10%2F03%2Fhow-to-bypass-webgl-sop-restriction%2F&amp;title=How%20to%20bypass%20WebGL%20Sop%20restriction"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2011/10/03/how-to-bypass-webgl-sop-restriction/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PhotoSynth viewer with pose estimator WebService</title>
		<link>http://www.visual-experiments.com/2011/08/08/photosynth-viewer-with-pose-estimator-webservice/</link>
		<comments>http://www.visual-experiments.com/2011/08/08/photosynth-viewer-with-pose-estimator-webservice/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 13:02:10 +0000</pubDate>
		<dc:creator>Henri</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[photogrammetry]]></category>
		<category><![CDATA[photosynth]]></category>
		<category><![CDATA[pose estimation]]></category>
		<category><![CDATA[Read/Write World]]></category>
		<category><![CDATA[three.js]]></category>
		<category><![CDATA[webgl]]></category>
		<guid isPermaLink="false">http://www.visual-experiments.com/?p=1887</guid>
		<description><![CDATA[I&#8217;ve spent 2 days implementing a WebService in C++. I&#8217;ve lost 1 day trying to use WebSocket (this wasn&#8217;t a good idea as Firefox and Google Chrome were not implementing the same version). I&#8217;ve also lost a lot of time with the beautiful drag and drop API&#8230; who is responsible for this mess? Anyway I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent 2 days implementing a WebService in C++. I&#8217;ve lost 1 day trying to use WebSocket (this wasn&#8217;t a good idea as Firefox and Google Chrome were not implementing the same version). I&#8217;ve also lost a lot of time with the beautiful drag and drop API&#8230; who is responsible for <a href="http://www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html">this mess</a>? Anyway I&#8217;ve managed to create this cool demo:</p>
<p><iframe width="560" height="349" src="http://www.youtube.com/embed/vFVwmLucyb4" frameborder="0" allowfullscreen></iframe></p>
<p>The principle is very simple: the user drag and drop an unknown picture on the webpage. The picture is resized on the client side using canvas and then sent to the webservice using a classic POST Ajax call with the picture sent in jpeg base64. Then the pose estimator web service try to compute the pose and send an xml response. Then the pose is applied to the <a href="https://github.com/mrdoob/three.js/">Three.js</a> camera used in my <a href="http://www.visual-experiments.com/2011/07/21/google-chrome-photosynth-viewer-using-three-js/">PhotoSynth viewer</a>.</p>
<p>I have cheated a little as I&#8217;ve used shots of a video with known intrinsic parameters. But I&#8217;ve two options to handle really unknown pictures:</p>
<ul style="margin-left: 20px;">
<li>If the jpeg as Exif I can use it to find the focal (using a CCD database and a <a href="http://blog.nihilogic.dk/2008/05/reading-exif-data-with-javascript.html">JS Exif parser</a>)</li>
<li>Otherwise I am planning to implement <a href="http://cmp.felk.cvut.cz/minimal/p4pfr.php">this</a> in C++</li>
</ul>
<p>I hope you enjoy this demo as much as I do and that Google and Microsoft are working in that direction too (especially Microsoft with <a href="http://readwriteworld.cloudapp.net/">Read/Write World</a>&#8230;)</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.visual-experiments.com%2F2011%2F08%2F08%2Fphotosynth-viewer-with-pose-estimator-webservice%2F&amp;title=PhotoSynth%20viewer%20with%20pose%20estimator%20WebService"><img src="http://www.visual-experiments.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.visual-experiments.com/2011/08/08/photosynth-viewer-with-pose-estimator-webservice/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
