<?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>GrgrDvrt</title>
	<atom:link href="http://grgrdvrt.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://grgrdvrt.com/blog</link>
	<description>Un blog utilisant WordPress</description>
	<lastBuildDate>Tue, 10 Jan 2012 09:04:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Tuberoots</title>
		<link>http://grgrdvrt.com/blog/584/tuberoots/</link>
		<comments>http://grgrdvrt.com/blog/584/tuberoots/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 13:33:52 +0000</pubDate>
		<dc:creator>Grgrdvrt</dc:creator>
				<category><![CDATA[Miam]]></category>

		<guid isPermaLink="false">http://grgrdvrt.com/blog/?p=584</guid>
		<description><![CDATA[Recycling old experiments is a good opportunity to improve old approaches and try new ones. This work is about compositions based on symmetry and generated color schemes Click on the images to run it.]]></description>
			<content:encoded><![CDATA[<p>Recycling old experiments is a good opportunity to improve old approaches and try new ones.<br/>
This work is about compositions based on symmetry and generated color schemes<br/>
Click on the images to run it.</p>
<p><a href="http://www.grgrdvrt.com/miam/tuberoots" target="_blank"><img src="/storage/584/tuberoots1.jpg"/></a></p>
<p><a href="http://www.grgrdvrt.com/miam/tuberoots" target="_blank"><img src="/storage/584/tuberoots2.jpg"/></a></p>
<p><a href="http://www.grgrdvrt.com/miam/tuberoots" target="_blank"><img src="/storage/584/tuberoots3.jpg"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://grgrdvrt.com/blog/584/tuberoots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rorschach</title>
		<link>http://grgrdvrt.com/blog/579/rorschach/</link>
		<comments>http://grgrdvrt.com/blog/579/rorschach/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 13:17:56 +0000</pubDate>
		<dc:creator>Grgrdvrt</dc:creator>
				<category><![CDATA[Miam]]></category>
		<category><![CDATA[rorschach]]></category>

		<guid isPermaLink="false">http://grgrdvrt.com/blog/?p=579</guid>
		<description><![CDATA[In 1921 Hermann Rorschach in 1921 developped a psychological test to determine a subject&#8217;s personality through his interpretation of a set of abstract images. This experiment is an attempt to reproduce the typical aspect of these images. Despite of the random process used to generate these images, we often perceive, faces, animals or other figurative [...]]]></description>
			<content:encoded><![CDATA[<p>In 1921 Hermann Rorschach in 1921 developped <a href="http://en.wikipedia.org/wiki/Rorschach_test">a psychological test</a> to determine a subject&#8217;s personality through his interpretation of a set of abstract images.<br/><br/>

This experiment is an attempt to reproduce the typical aspect of these images.
Despite of the random process used to generate these images, we often perceive, faces, animals or other figurative shapes, mainly due to symmetry.</p>
<a href="http://www.grgrdvrt.com/miam/rorschach.swf" target="_blank"><img src="/storage/579/rorschach3.jpg"/></a></p>
<p><img src="/storage/579/rorschachA.jpg"><img style="margin-right:0px;" src="/storage/579/rorschachB.jpg"><img src="/storage/579/rorschachC.jpg"><img style="margin-right:0px;" src="/storage/579/rorschachD.jpg"></p>
<p><a href="http://www.grgrdvrt.com/miam/rorschach.swf" target="_blank"><img src="/storage/579/rorschach2.jpg"/></a></p>
<p>In the movie Watchmen, a character named &#8220;Rorschach&#8221; wears a mask with animated patterns evoking the images from the test. Here is my version of this animation :</p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_0" width="785" height="625">
      <param name="movie" value="/storage/experiment_player.swf" />
      <param name="flashvars" value="file=/storage/579/rorschach" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/storage/experiment_player.swf" width="785" height="625" flashvars="file=/storage/579/rorschach">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
]]></content:encoded>
			<wfw:commentRss>http://grgrdvrt.com/blog/579/rorschach/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delaunoids</title>
		<link>http://grgrdvrt.com/blog/572/delaunoids/</link>
		<comments>http://grgrdvrt.com/blog/572/delaunoids/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 13:33:09 +0000</pubDate>
		<dc:creator>Grgrdvrt</dc:creator>
				<category><![CDATA[Non classé]]></category>

		<guid isPermaLink="false">http://grgrdvrt.com/blog/?p=572</guid>
		<description><![CDATA[Some concepts come up frequently in generative images and animations. This is the case for boids, developed by Craig Reynolds or mathematical tools such as Voronoi diagrams and or Delaunay diagrams. For my first steps with javascript &#038; canvas I tried to put these concepts together in a single experiment]]></description>
			<content:encoded><![CDATA[<p>Some concepts come up frequently in generative images and animations. This is the case for boids, developed by Craig Reynolds or mathematical tools such as Voronoi diagrams and or Delaunay diagrams.<br/><br/>

For my first steps with javascript &#038; canvas I tried to put these concepts together in a single experiment</p>
<p><a href="http://www.grgrdvrt.com/miam/boids" target="_blank"><img src="/storage/572/boids.jpg"/></a></p>
<p><a href="http://www.grgrdvrt.com/miam/boids/delaunoids.html" target="_blank"><img src="/storage/572/delaunoids0.jpg"></a><a href="http://www.grgrdvrt.com/miam/boids/voronoids.html" target="_blank"><img style="margin-right:0px;" src="/storage/572/voronoids.jpg"></a></p>
<p><a href="http://www.grgrdvrt.com/miam/boids/delaunoids2.html" target="_blank"><img src="/storage/572/delaunoids.jpg"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://grgrdvrt.com/blog/572/delaunoids/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sketches</title>
		<link>http://grgrdvrt.com/blog/467/sketches/</link>
		<comments>http://grgrdvrt.com/blog/467/sketches/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 03:00:14 +0000</pubDate>
		<dc:creator>Grgrdvrt</dc:creator>
				<category><![CDATA[Miam]]></category>
		<category><![CDATA[lignes]]></category>
		<category><![CDATA[physique]]></category>
		<category><![CDATA[processing]]></category>

		<guid isPermaLink="false">http://grgrdvrt.com/blog/?p=467</guid>
		<description><![CDATA[Here is a couple of Processing sketches I made during the Processing Paris workshops that took place in April at La Fonderie de l&#8217;Image in Paris. The first sketch was inspired by the wikipedia article on Bézier curves, especially this animation. The others are based on simulations of particles linked with springs. Click on images [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a couple of <a href="http://www.processing.org">Processing</a> sketches I made during the <a href="http://www.processingparis.org/">Processing Paris workshops</a> that took place in April at <a href="http://www.campusfonderiedelimage.org"/>La Fonderie de l&#8217;Image</a> in Paris.</p>
<p>The first sketch was inspired by the wikipedia article on <a href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve">Bézier curves</a>, especially <a href="http://en.wikipedia.org/wiki/File:Bezier_4_big.gif">this animation</a>. The others are based on simulations of particles linked with springs.<br/>
Click on images to view the applets</p>
<a href="/storage/467/bezier" target="_blank"><img src="/storage/467/bezier.jpg"/></a>
<a href="/storage/467/springs" target="_blank"><img src="/storage/467/springs.jpg"/></a>
<a href="/storage/467/springsDrawing" target="_blank"><img src="/storage/467/springsDrawing.jpg"/></a>
<a href="/storage/467/springText" target="_blank"><img src="/storage/467/springsText.jpg"/></a>

<p>Two compilations of the experiments made during the workshop are available on vimeo : <a href="http://vimeo.com/23727314">http://vimeo.com/23727314</a> and <a href="http://vimeo.com/23753834">http://vimeo.com/23753834</a> enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://grgrdvrt.com/blog/467/sketches/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Pixels + blur + paletteMap + colors</title>
		<link>http://grgrdvrt.com/blog/446/pixels-blur-palettemap-colors/</link>
		<comments>http://grgrdvrt.com/blog/446/pixels-blur-palettemap-colors/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 18:24:06 +0000</pubDate>
		<dc:creator>Grgrdvrt</dc:creator>
				<category><![CDATA[Miam]]></category>
		<category><![CDATA[bitmapData]]></category>
		<category><![CDATA[couleur]]></category>
		<category><![CDATA[filtre]]></category>
		<category><![CDATA[paletteMap]]></category>
		<category><![CDATA[particules]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://grgrdvrt.com/blog/?p=446</guid>
		<description><![CDATA[start with something simple, change the code, get something unexpected, change the code, get something unexpected, change the code, get something unexpected...]]></description>
			<content:encoded><![CDATA[<p>Pixels:</p>


    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_1" width="785" height="625">
      <param name="movie" value="/storage/experiment_player.swf" />
      <param name="flashvars" value="file=/storage/446/pixels" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/storage/experiment_player.swf" width="785" height="625" flashvars="file=/storage/446/pixels">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
<br/>

<p>Pixels + blur :</p>


    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_2" width="785" height="625">
      <param name="movie" value="/storage/experiment_player.swf" />
      <param name="flashvars" value="file=/storage/446/blur" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/storage/experiment_player.swf" width="785" height="625" flashvars="file=/storage/446/blur">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
<br/>

<p>Pixels + blur + paletteMap :</p>


    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_3" width="785" height="625">
      <param name="movie" value="/storage/experiment_player.swf" />
      <param name="flashvars" value="file=/storage/446/palette" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/storage/experiment_player.swf" width="785" height="625" flashvars="file=/storage/446/palette">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
<br/>
<p><img src="/storage/446/palette2.jpg"><img style="margin-right:0px;" src="/storage/446/palette3.jpg"></p>

<p>Pixels + blur + paletteMap + colors :</p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_4" width="785" height="625">
      <param name="movie" value="/storage/experiment_player.swf" />
      <param name="flashvars" value="file=/storage/446/colors" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/storage/experiment_player.swf" width="785" height="625" flashvars="file=/storage/446/colors">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
<br/>
<p><img src="/storage/446/colors2.jpg"><img style="margin-right:0px;" src="/storage/446/colors3.jpg"></p>
<p><a href="/storage/446/Colors.as">sources</a></p><br/>
<p>Each step adds its own parameters which influence the final result, especially the blur radius and the paletteMap.<br/><br/>

 I haven&#8217;t used tools like <a href="http://blog.soulwire.co.uk/code/actionscript-3/simple-flash-prototype-gui-tool">Soulwire&#8217;s simple flash GUI tool</a> and it&#8217;s a mistake, I spent too much time to changing the code and compiling the swf just to set new parameters values.<br/><br/>

In the last experiment the color schemes are generated. I will probably write a post about that because it&#8217;s a subject I like a lot.<br/>
There are other experiments using paletteMap that I will show in another post because it&#8217;s really an interesting function.</p>]]></content:encoded>
			<wfw:commentRss>http://grgrdvrt.com/blog/446/pixels-blur-palettemap-colors/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Des lignes</title>
		<link>http://grgrdvrt.com/blog/439/des-lignes/</link>
		<comments>http://grgrdvrt.com/blog/439/des-lignes/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 20:56:19 +0000</pubDate>
		<dc:creator>Grgrdvrt</dc:creator>
				<category><![CDATA[Miam]]></category>
		<category><![CDATA[bitmapData]]></category>
		<category><![CDATA[couleur]]></category>
		<category><![CDATA[lignes]]></category>
		<category><![CDATA[mouvement]]></category>
		<category><![CDATA[particules]]></category>
		<category><![CDATA[perlin noise]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://grgrdvrt.com/blog/?p=439</guid>
		<description><![CDATA[Des fois le midi je mange vite alors il me reste un peu de temps pour faire des trucs avec des particules.]]></description>
			<content:encoded><![CDATA[
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_5" width="789" height="625">
      <param name="movie" value="/storage/439/curly.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/storage/439/curly.swf" width="789" height="625">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

<a href="/storage/439/sources.zip">sources</a>]]></content:encoded>
			<wfw:commentRss>http://grgrdvrt.com/blog/439/des-lignes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Perlinoisation</title>
		<link>http://grgrdvrt.com/blog/422/perlinoisation/</link>
		<comments>http://grgrdvrt.com/blog/422/perlinoisation/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 23:42:01 +0000</pubDate>
		<dc:creator>Grgrdvrt</dc:creator>
				<category><![CDATA[Miam]]></category>
		<category><![CDATA[bitmapData]]></category>
		<category><![CDATA[couleur]]></category>
		<category><![CDATA[particules]]></category>
		<category><![CDATA[perlin noise]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://grgrdvrt.com/blog/?p=422</guid>
		<description><![CDATA[Le perlin noise c'est génial, ça marche à tous les coups.]]></description>
			<content:encoded><![CDATA[<p>Il y a un peu plus d&#8217;un an <a href="http://www.neuroproductions.be/">Neuroprod</a> faisait <a href="http://www.neuroproductions.be/experiments/image-vectors-convolutionfilter-fun/">des trucs avec des images</a>. Et ça m&#8217;a donné envie de jouer.<br/>
Sauf que les histoires de direction de l&#8217;image je m&#8217;en foutait un peu alors j&#8217;ai utilisé un bitmapData plein de perlin noise comme map pour orienter mes lignes.<p/>
<p>En lançant l&#8217;exemple ci-dessous, tu pourras admirer le résultat de tout ça et découvrir au passage qui sont nos invités mystères!!</p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_6" width="789" height="625">
      <param name="movie" value="/storage/422/perlinoisation/perlinoisation.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/storage/422/perlinoisation/perlinoisation.swf" width="789" height="625">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
<br/>

<p>Si tu as juste lancé l&#8217;animation tu as dû d&#8217;abord paniquer à la vue de nos amis et ensuite tu as vu un effet sympa.<br/>
Si tu la stoppe et que tu la relance tu vas activer un second mode bien plus intéressant dans lequel l&#8217;image se dégrade au cours du temps.<br/>
L&#8217;idée c&#8217;est que dans le premier mode ce sont les couleurs la photo originale qui sont utilisées tandis que dans le second mode c&#8217;est l&#8217;image transformée (telle qu&#8217;on la voit) qui sert de source.<p><br/>

<p>Voici une séquence obtenue avec une image un peu plus verte.<br/>
Au début les deux modes donnent à peu près la même chose : </p>
<img src="/storage/422/1a.jpg"><br/>
<p>Après une dizaine de minutes c&#8217;est de la bouillie : </p>
<img src="/storage/422/1b.jpg"><br/>
<p>À la fin l&#8217;image se divise en aplats relativement stables : </p>
<img src="/storage/422/1c.jpg"><br/><br/>
<p>Et sinon en noir et blanc ça fait des choses amusantes aussi : </p>
<p><img src="/storage/422/2a.jpg"><img style="margin-right:0px;" src="/storage/422/2c.jpg"></p>
<img src="/storage/422/2b.jpg"><br/>
<p>Si tu veux les sources, <a href="/storage/422/perlinoisation.rar">les voilà</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://grgrdvrt.com/blog/422/perlinoisation/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Flame</title>
		<link>http://grgrdvrt.com/blog/384/flame/</link>
		<comments>http://grgrdvrt.com/blog/384/flame/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 23:27:19 +0000</pubDate>
		<dc:creator>Grgrdvrt</dc:creator>
				<category><![CDATA[Miam]]></category>
		<category><![CDATA[flame]]></category>
		<category><![CDATA[fractales]]></category>
		<category><![CDATA[sierpinski]]></category>
		<category><![CDATA[système de fonctions itérées]]></category>

		<guid isPermaLink="false">http://grgrdvrt.com/blog/?p=384</guid>
		<description><![CDATA[Appliquées à certains domaines les fractales peuvent être utiles.<br/>Ici ce n'est pas le cas.]]></description>
			<content:encoded><![CDATA[<p>Un jour, juste pour me faire perdre du temps, nicoptère m&#8217;a passé <a href="http://flam3.com/flame.pdf">ce document</a> qui décrit les fractales Flame, un type de fractales construites à partir de Systèmes de Fonctions Itérées et de bricolage.</p><br/>

<p>Utiliser un système de fonctions itérées ça consiste à appliquer de façon répétitive des transformations linéaires à un point. À chaque étape on choisit une fonction plus ou moins au hasard parmi quelques transformations choisies et ça fait des motifs.
<a href="http://en.wikipedia.org/wiki/Iterated_function_system">wikipedia en dit plus long</a>.</p><br/><br/>

<p>Le dessin ci-dessous n&#8217;est pas une triforce surpuissante, c&#8217;est un triangle de sierpinski avec 8 itération, exécuté avec force, courage et détermination.</p><br/><br/>

<img src="/storage/384/sierpinski1.jpg"><br/>
<p>Et bien avec un système de 3 fonctions itérées j&#8217;aurai pu faire le même sans me briser le poignet et en pas tout tordu.</p><br/>

<p>Après ça, le document parle de &#8220;Variations&#8221; des fonctions non linéaires qui déforment le motif obtenu jusque là. Les annexes comportent une cinquantaine de ces fonctions rigolotes.<br/>
Il est ensuite question de la gestion des couleurs et de la luminosité en fonction de la densité et de la position des points. C&#8217;est une partie assez instructive en matière de traitement d&#8217;image.<br/>
Pour finir, le document propose des processus pour améliorer l&#8217;aspect de l&#8217;image (supersampling, motion blur&#8230;). <br/>
Là ça devient compliqué à mettre en place et surtout très lourd pour flash. Donc j&#8217;ai laissé tomber.</p><br/><br/>

<p>Finalement voilà trois rendus que j&#8217;ai obtenus. Il n&#8217;y en a pas plus parce que c&#8217;est assez long à sortir (10 minutes environ pour le moindre test) et de toute façon <a href="http://www.apophysis.org/">apophysis</a> le fait mieux (plusieurs heures de rendu pour des images autrement complexes).</p><br/>
<img src="/storage/384/flame0.jpg"><br/>
<img src="/storage/384/flame1.jpg"><br/>
<img src="/storage/384/flame2.jpg"><br/>
<p><a href="/storage/384/flame.rar">sources</a></p>]]></content:encoded>
			<wfw:commentRss>http://grgrdvrt.com/blog/384/flame/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Trames</title>
		<link>http://grgrdvrt.com/blog/311/trames/</link>
		<comments>http://grgrdvrt.com/blog/311/trames/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 00:48:02 +0000</pubDate>
		<dc:creator>Grgrdvrt</dc:creator>
				<category><![CDATA[Miam]]></category>
		<category><![CDATA[bitmapData]]></category>
		<category><![CDATA[filtre]]></category>
		<category><![CDATA[gif]]></category>
		<category><![CDATA[motif]]></category>
		<category><![CDATA[trame]]></category>

		<guid isPermaLink="false">http://grgrdvrt.com/blog/?p=311</guid>
		<description><![CDATA[Quand on était de jeunes et fous étudiants à Gobelins, on aimait bien les trames.
Alors voilà des souvenirs de cette époque
]]></description>
			<content:encoded><![CDATA[<p><span class="left">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_7" width="385" height="305">
      <param name="movie" value="/storage/311/trame1.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/storage/311/trame1.swf" width="385" height="305">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
</span>Ici la trame est générée à partir de pixels dont l&#8217;espacement varie selon la luminosité de l&#8217;image. Ces espaces sont basés sur des puissances de deux pour avoir des lignes continues d&#8217;une zone à l&#8217;autre.<br/><br/>
Si tu as une webcam tu verras ta tête, sinon ce sera un poney. Note le subtil changement de densité selon la position de la souris.<br/>En bonus, <a href = "http://www.grgrdvrt.com/storage/311/sources_trame1.rar">les sources</a></p>

<p><span class="left">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_8" width="385" height="305">
      <param name="movie" value="/storage/311/trame2.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="/storage/311/trame2.swf" width="385" height="305">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
</span>Là il s&#8217;agit du tramage utilisé pour la compression des gifs , dit &#8220;ordered dithering&#8221;.<br/><br/>
Cette fois si tu n&#8217;as pas de webcam tu pourras juste continuer à admirer la licorne que tu vois déjà.<br/>En super bonus, <a href = "http://www.grgrdvrt.com/storage/311/sources_trame2.rar">les sources</a></p>


<p>Pour les deux j&#8217;ai utilisé Pixel Bender et c&#8217;est pas fantastique. C&#8217;est lent, on a pas le même rendu entre le toolkit et flash et surtout il y a une tonne de limitations, regarde le .pbk du deuxième exemple, tu verras comme c&#8217;est nul.</p><br/>

<p>Pour finir, si tu as aimé ça, tu voudras lire ces documents : <a href="http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT">un très complet</a> et <a href="http://www.visgraf.impa.br/Courses/ip00/proj/Dithering1/ordered_dithering.html">un très succin</a> et aussi <a href="http://caca.zoy.org/study/part2.html">plein de trucs rigolos</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://grgrdvrt.com/blog/311/trames/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Median Cut</title>
		<link>http://grgrdvrt.com/blog/332/median-cut/</link>
		<comments>http://grgrdvrt.com/blog/332/median-cut/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 16:45:31 +0000</pubDate>
		<dc:creator>Grgrdvrt</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[bitmapData]]></category>
		<category><![CDATA[couleur]]></category>
		<category><![CDATA[filtre]]></category>
		<category><![CDATA[optimisation]]></category>

		<guid isPermaLink="false">http://grgrdvrt.com/blog/?p=332</guid>
		<description><![CDATA[Le median cut filter est un filtre qui me paraissait super intéressant. Et puis en fait non. Enfin si, mais pas comme je l'aurai imaginé au début.]]></description>
			<content:encoded><![CDATA[<p>Au début de l&#8217;histoire, le truc qui m&#8217;a fait rêver c&#8217;est l&#8217;outil <a href="http://www.inthemod.com/inthemod.html">in the mod</a> de <a href="http://blog.drwoohoo.com/">Dr Woohoo</a> qui permet de récupérer une palette de couleurs à partir d&#8217;une image.<br/>
Alors moi tout naïf je me dis &#8220;ouai c&#8217;est facile, c&#8217;est tout comme réduire le nombre de couleurs de l&#8217;image&#8221; et je repense à nicoptère qui a fait <a href="http://en.nicoptere.net/?p=8">un truc qui y ressemble.</a><br/>
Sauf qu&#8217;en fait ce que je veux (va savoir pourquoi) c&#8217;est récupérer un nombre précis de couleurs. Alors j&#8217;en parle avec Nicoptère et là il me dit &#8220;ah mais ça a rien à voir (pov&#8217; nul), toi c&#8217;est une posterisation que tu veux faire! &#8220;. Ce à quoi google me répond &#8220;la posterisation <a href="http://www.adobe.com/designcenter/photoshop/articles/phs8posteriz.html">c&#8217;est ça</a>&#8220;. Ah bein oui, c&#8217;est un beau chien, mais là c&#8217;est le contraire de ce que je veux.<br/>
C&#8217;est quand même un bon début parcequ&#8217;en fouinant dans cette direction je découvre le <a href="http://web.cs.wpi.edu/~matt/courses/cs563/talks/color_quant/CQmediancut.html">median cut filter</a> et même comment <a href="http://www.leptonica.com/papers/mediancut.pdf">améliorer l&#8217;algorithme</a>. Bien sûr tout celà n&#8217;est pas à confondre avec avec l&#8217;autrement plus compliqué <a href="http://en.nicoptere.net/?p=444">mean shift filter</a>.<br/>
Bon, trop bien! Cette fois c&#8217;est le bon.</p><br/><br/>

<p>Là je fais une pause dans l&#8217;histoire, juste pour dire que si tu veux obtenir des belles couleurs d&#8217;une belle image, tu peux tout de suite aller chez soulwire voir ces articles:
<a href="http://blog.soulwire.co.uk/flash/actionscript-3/extract-average-colours-from-bitmapdata">couleurs moyennes</a> et <a href="http://blog.soulwire.co.uk/flash/actionscript-3/colourutils-bitmapdata-extract-colour-palette">extraire une palette de couleurs</a>, c&#8217;est plus simple et ça marche mieux.<br/>
Par contre tu vas rater la partie intéressante de l&#8217;histoire.</p><br/><br/>

<p>Pour en revenir au median cut filter, si tu te disais &#8220;Chouette, un filtre! on va sortir PixelBender&#8221; tu te trompes, ça marchera pas. C&#8217;est pas comme le BlurFilter ou ColorMatrixFilter, qui traitent chaque pixel pour les redéfinir en fonction de leurs voisins ou de paramètres quelconques. Là c&#8217;est l&#8217;espace colorimétrique de l&#8217;image qu&#8217;on va tripoter.</p><br/><br/>
<p><img src="/storage/332/color_space.jpg"/>L&#8217;espace colorimétrique c&#8217;est ce que tu vois juste à côté, un cube dans lequel chaque point est une couleur déterminée par sa position sur les axes R, G, B.</p><br/>
<p><img src="/storage/332/vlaminck.jpg"/>Maurice de Vlaminck a peint Les arbres rouges en 1906. C&#8217;est une huile sur toile de 65 x 81 cm et tu peux le voir au 5ème étage du Centre Pompidou.<br/>
Là (hérésie!) je l&#8217;ai recadré pour qu&#8217;il rentre dans la grille de l&#8217;article.</p>
<p><img src="/storage/332/vlaminck_color_space.jpg"/>Ici c&#8217;est toujours le Vlaminck mais représenté dans l&#8217;espace colorimétrique. Cette fois il n&#8217;est pas recadré. Si tu veux, <a href="/storage/332/color_space.rar">voilà les sources</a> pour que tu puisse faire la même chose avec tes images. Les résultats sont très différents selon les images, c&#8217;est assez intréssant</p>

<p><img src="/storage/332/one_box.jpg"/>On commence par mettre le tableau dans une boite. En vrai une boite ce sera juste une liste de pixels.</p>
<p><img src="/storage/332/two_boxes.jpg"/>Ensuite on regarde quel est le côté le plus long. Pour ça il suffit de prendre les valeurs extrèmes de rouge, vert et bleu dans la liste de pixels. On va alors trier la liste selon leur valeur de rouge si par exemple c&#8217;est dans le vert qu&#8217;on a le plus d&#8217;amplitude. Il n&#8217;y a plus qu&#8217;à diviser notre liste en deux parts égales de façon à obtenir deux boites contenant le même nombre de pixels.</p>
<p>On recommence la dernière étape avec la boite qui a le plus long côté jusqu&#8217;à avoir autant de boites qu&#8217;on veut de couleurs. On obtient la palette en récupérant la couleur moyenne de chaque boite. Après pour reconstituer l&#8217;image il faudrait faire une posterisation. Moi je me contente d&#8217;attribuer aux pixels la couleur de la boite où ils sont, ça revient presque au même.</p><br/><br/>

<p>Voilà <a href="/storage/332/median_cut_filter.rar">les sources du truc</a>.<br/>
Et voilà des images reconstituées avec 2, 4, 8 et 32 couleurs et les palettes correspondantes</p>
<p><img src="/storage/332/vlaminck_2.jpg"><img style="margin-right:0px;" src="/storage/332/vlaminck_4.jpg"><img src="/storage/332/vlaminck_8.jpg"><img style="margin-right:0px;" src="/storage/332/vlaminck_32.jpg"></p>
<p>Le fauvisme prend un sérieux coup.<br/>
À moins de 20 couleurs les palettes sont loin de ce qu&#8217;on pourrait attendre.</p>

<p>Tu es déçu et je te comprends. En lot de consolation, voilà un bonus cool sur le tri des tableaux</p>
<p>On a vu que l&#8217;algorithme nécessite que les pixels d&#8217;une boite soient triés lors de la division de celle-ci.<br/>
Trier un Vector c&#8217;est simple avec la methode sort(). Ça prend en paramètre une fonction de notre choix c qui est top pour trier des éléments comme on veux. L&#8217;inconvénient c&#8217;est que c&#8217;est lent. Trop lent pour trier tous les pixels d&#8217;une image.</p><br/><br/>

Voilà le test de base avec un Vector.<int>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">//nombre de valeurs à trier</span>
<span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">20000</span>;
<span style="color: #808080; font-style: italic;">//Vector contenant les valeurs à trier</span>
<span style="color: #000000; font-weight: bold;">var</span> values:Vector.<span style="color: #66cc66;">&lt;</span>int<span style="color: #66cc66;">&gt;</span> = <span style="color: #000000; font-weight: bold;">new</span> Vector.<span style="color: #66cc66;">&lt;</span>int<span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#40;</span>n, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">//valeur maximale contenue dans le Vector (minimum 0)</span>
<span style="color: #000000; font-weight: bold;">var</span> valMax:<span style="color: #0066CC;">int</span> = 0xFF;
<span style="color: #808080; font-style: italic;">//remplissage du Vector avec des valeurs aléatoires</span>
<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i<span style="color: #66cc66;">&lt;</span> n; i++<span style="color: #66cc66;">&#41;</span>values<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> valMax;
<span style="color: #000000; font-weight: bold;">var</span> t:<span style="color: #0066CC;">int</span> = <span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">//tri</span>
values.<span style="color: #0066CC;">sort</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>v1:<span style="color: #0066CC;">int</span>, v2:<span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #b1b100;">return</span> v1 - v2;<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> - t<span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>



<p>chez moi j&#8217;ai :<br/> 
72 ms pour 10 000 éléments<br/>
3 900 ms pour 100 000 éléments<br/>
14 500 ms pour 200 000 éléments<br/>
après on dépasse les 15 secondes et ça plante.<br/>
Dommage, une image de 500&#215;500 ça fait déjà 250 000 pixels.</p><br/><br/>

<p>Heureusement les algorithmes de tri sont très nombreux et le <a href="http://en.wikipedia.org/wiki/Counting_sort">counting sort</a> m&#8217;a paru sympa.<br/>
Si on reprend le test de tout à l&#8217;heure</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> countingSort<span style="color: #66cc66;">&#40;</span>a:Vector.<span style="color: #66cc66;">&lt;</span>int<span style="color: #66cc66;">&gt;</span>, k:<span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#41;</span>:Vector.<span style="color: #66cc66;">&lt;</span>int<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">int</span> = a.<span style="color: #0066CC;">length</span>;
	<span style="color: #000000; font-weight: bold;">var</span> b:Vector.<span style="color: #66cc66;">&lt;</span>int<span style="color: #66cc66;">&gt;</span> = <span style="color: #000000; font-weight: bold;">new</span> Vector.<span style="color: #66cc66;">&lt;</span>int<span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#40;</span>n, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> c:Vector.<span style="color: #66cc66;">&lt;</span>int<span style="color: #66cc66;">&gt;</span> = <span style="color: #000000; font-weight: bold;">new</span> Vector.<span style="color: #66cc66;">&lt;</span>int<span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#40;</span>k, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i<span style="color: #66cc66;">&lt;</span> n; i++<span style="color: #66cc66;">&#41;</span>c<span style="color: #66cc66;">&#91;</span>a<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> = c<span style="color: #66cc66;">&#91;</span>a<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> + <span style="color: #cc66cc;">1</span>;
	<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">1</span>; i <span style="color: #66cc66;">&lt;</span> k; i++<span style="color: #66cc66;">&#41;</span>c<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = c<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> + c<span style="color: #66cc66;">&#91;</span>i - <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>;
	<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span>i = n - <span style="color: #cc66cc;">1</span>; i <span style="color: #66cc66;">&gt;</span>= <span style="color: #cc66cc;">0</span>; i--<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		b<span style="color: #66cc66;">&#91;</span>c<span style="color: #66cc66;">&#91;</span>a<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>-<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> = a<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
		c<span style="color: #66cc66;">&#91;</span>a<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> = c<span style="color: #66cc66;">&#91;</span>a<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> - <span style="color: #cc66cc;">1</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">return</span> b;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">100000</span>;
<span style="color: #000000; font-weight: bold;">var</span> values:Vector.<span style="color: #66cc66;">&lt;</span>int<span style="color: #66cc66;">&gt;</span> = <span style="color: #000000; font-weight: bold;">new</span> Vector.<span style="color: #66cc66;">&lt;</span>int<span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#40;</span>n, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> valMax:<span style="color: #0066CC;">int</span> = 0xFF;
<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i<span style="color: #66cc66;">&lt;</span> n; i++<span style="color: #66cc66;">&#41;</span> values<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> valMax;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> t:<span style="color: #0066CC;">int</span> = <span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
values = countingSort<span style="color: #66cc66;">&#40;</span>values, valMax + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> - t<span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>



<p>2ms pour 10 000 éléments<br/>
17ms pour 100 000 éléments<br/>
1600ms pour 10 000 000 éléments<br/>
Bon, en gros pour 50 fois plus d&#8217;éléments ça met à peu près 10 fois moins de temps. Pas mal non?</p><br/><br/>

<p>Bien sûr comme tu ne crois pas à la magie, tu sais qu&#8217;il y a des inconvénients.<br/>
En fait là ça marche bien parceque les valeurs à trier sont des entiers compris entre 0 et 255<br/>
Avec des nombre décimaux ça ne marcherai pas. Et avec des nombres négatifs il faudrait adapter un peu.<br/>
Avec des valeurs issues d&#8217;un large interval c&#8217;est la mémoire qui prendrait un coup.<br/>
Et puis il faut réécrire la fonction pour chaque type de Vector<br/>
<a href="http://en.wikipedia.org/wiki/Quicksort">Le quickSort</a> est plus pratique pour ces cas là, mais peut-être un peu moins rapide dans le cas des canaux rgb.
</p><br/><br/>
<p>La leçon c&#8217;est que le median cut filter ça sert peut-être à rien mais au moins maintenant je sais mieux trier mes objets</p>]]></content:encoded>
			<wfw:commentRss>http://grgrdvrt.com/blog/332/median-cut/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

