<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Flash 10: new method BitmapData.histogram();</title>
	<atom:link href="http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/feed/" rel="self" type="application/rss+xml" />
	<link>http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/</link>
	<description>Just another Flash/actionscript/whatever weblog</description>
	<lastBuildDate>Sat, 14 Nov 2009 14:34:11 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Miguel Barata</title>
		<link>http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/#comment-309</link>
		<dc:creator>Miguel Barata</dc:creator>
		<pubDate>Fri, 05 Jun 2009 23:33:01 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=22#comment-309</guid>
		<description>I was looking for a way to include a flash histogram for my photos on my website and this is just the way I would want, and by the way, its great. Is there a more detailed tutorial to do this? like for begginers in AS</description>
		<content:encoded><![CDATA[<p>I was looking for a way to include a flash histogram for my photos on my website and this is just the way I would want, and by the way, its great. Is there a more detailed tutorial to do this? like for begginers in AS</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LukasT.mediablog.sk &#187; Interesting blogposts about Flash 10</title>
		<link>http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/#comment-140</link>
		<dc:creator>LukasT.mediablog.sk &#187; Interesting blogposts about Flash 10</dc:creator>
		<pubDate>Mon, 27 Oct 2008 21:32:55 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=22#comment-140</guid>
		<description>[...] discovered nice blogposts about Flash 10. Some could be inspiration for Krita. I like this version of histogram and I like articles about various blurring effects and there is nice one about linear [...]</description>
		<content:encoded><![CDATA[<p>[...] discovered nice blogposts about Flash 10. Some could be inspiration for Krita. I like this version of histogram and I like articles about various blurring effects and there is nice one about linear [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flash Player 10 New Features &#124; experimo</title>
		<link>http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/#comment-127</link>
		<dc:creator>Flash Player 10 New Features &#124; experimo</dc:creator>
		<pubDate>Tue, 07 Oct 2008 07:58:19 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=22#comment-127</guid>
		<description>[...] pixelero - The new BitmapData histogram method [...]</description>
		<content:encoded><![CDATA[<p>[...] pixelero &#8211; The new BitmapData histogram method [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Billigflug</title>
		<link>http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/#comment-124</link>
		<dc:creator>Billigflug</dc:creator>
		<pubDate>Fri, 26 Sep 2008 14:51:42 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=22#comment-124</guid>
		<description>this looks awesome. take a look on another flash creation: http://www.onemotion.com/flash/spider/</description>
		<content:encoded><![CDATA[<p>this looks awesome. take a look on another flash creation: <a href="http://www.onemotion.com/flash/spider/" rel="nofollow">http://www.onemotion.com/flash/spider/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pixelero</title>
		<link>http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/#comment-112</link>
		<dc:creator>pixelero</dc:creator>
		<pubDate>Sun, 21 Sep 2008 17:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=22#comment-112</guid>
		<description>@Josh Chernoff:
I wouldn&#039;t worry about that, I did some testing on a 375x500 pixels bitmapdata
and running .histogram() for &lt;strong&gt;one hundred&lt;/strong&gt; times took ~200 ms, 
while a getPixel(i,j)-loop reading the rgb-channels took &lt;strong&gt;~120 ms running once&lt;/strong&gt;:

for (j=0; j!=bmpData.height; j++) {
	for (i=0; i!=bmpData.width; i++) {
		blueArray[(pxl = bmpData.getPixel32(i,j) ) &amp; 0xFF]++;
		greenArray[(pxl &gt;&gt;=8 ) &amp; 0xFF]++;
		redArray[(pxl &gt;&gt;=8 ) &amp; 0xFF]++;
	}
}

</description>
		<content:encoded><![CDATA[<p>@Josh Chernoff:<br />
I wouldn&#8217;t worry about that, I did some testing on a 375&#215;500 pixels bitmapdata<br />
and running .histogram() for <strong>one hundred</strong> times took ~200 ms,<br />
while a getPixel(i,j)-loop reading the rgb-channels took <strong>~120 ms running once</strong>:</p>
<p>for (j=0; j!=bmpData.height; j++) {<br />
	for (i=0; i!=bmpData.width; i++) {<br />
		blueArray[(pxl = bmpData.getPixel32(i,j) ) &amp; 0xFF]++;<br />
		greenArray[(pxl &gt;&gt;=8 ) &amp; 0xFF]++;<br />
		redArray[(pxl &gt;&gt;=8 ) &amp; 0xFF]++;<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Chernoff</title>
		<link>http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/#comment-109</link>
		<dc:creator>Josh Chernoff</dc:creator>
		<pubDate>Sat, 20 Sep 2008 23:39:20 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=22#comment-109</guid>
		<description>was it just me or is BitmapData.histogram a lot slower then two for loops with BitmapData.getPixelat(i,j);

I know there is still a lot of work left in flash player 10 so I hope this is just something that is gonna be fixed down the road.</description>
		<content:encoded><![CDATA[<p>was it just me or is BitmapData.histogram a lot slower then two for loops with BitmapData.getPixelat(i,j);</p>
<p>I know there is still a lot of work left in flash player 10 so I hope this is just something that is gonna be fixed down the road.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flash tuorials &#124; Tutorials on Flash Player 10 Roundup part 2 &#124; Lemlinh.com</title>
		<link>http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/#comment-80</link>
		<dc:creator>Flash tuorials &#124; Tutorials on Flash Player 10 Roundup part 2 &#124; Lemlinh.com</dc:creator>
		<pubDate>Fri, 22 Aug 2008 05:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=22#comment-80</guid>
		<description>[...] Read more [...]</description>
		<content:encoded><![CDATA[<p>[...] Read more [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pixelero</title>
		<link>http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/#comment-65</link>
		<dc:creator>pixelero</dc:creator>
		<pubDate>Tue, 08 Jul 2008 21:32:30 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=22#comment-65</guid>
		<description>hi, 

well nicely challenging question, two solutions comes to my mind:

1) How to keep it simple, just scale the image to size of one pixel and read that value. ok, might give wrong result in cases such as black and white line art ... 
as code something like:

var bmp2:BitmapData = new BitmapData(1,1,false,0x00);

bmp2.draw(bmpData,new Matrix(1/bmp.width,0,0,1/bmp.height) );

return bmp2.getPixel(0,0);

2) take some samples from the bitmap, and count, with something like bucketsort, the values with most occurances, simplified by taking only some tree or four most significant bytes from each channel:

something like:

function sampleColor(bmpData:BitmapData):uint {
	var buckets:Object = {};
	var pxl:uint;
	
	for (var y:int =0; y&lt;bmpData.height; y +=2 ) {
		for (var x:int =0; x&lt;bmpData.width; x +=2) {
			pxl = bmpData.getPixel(x,y) &amp; 0xE0E0E0; 
			buckets[pxl]= (buckets[pxl] == null) ? 1 : buckets[pxl]+1 ;
		}
	}
	
	var maxsample:uint =0;
	var maxvalue:uint =0;
	for ( var s in buckets) {
		if (buckets[s]&gt;maxvalue) {
			maxsample=s;
			maxvalue=buckets[s];
		}
	}
	
	return maxsample;
}

Funnily these two approaches return in some cases quite different results ?
... never had done this before so &lt;a href=&quot;http://www.petrileskinen.fi/Actionscript/HistogramTest/PixelSampleTest.swf&quot; rel=&quot;nofollow&quot;&gt;I did do some experimenting&lt;/a&gt;. Above 1x1 pixel sample, below sorted sample.

Hope this will help ...</description>
		<content:encoded><![CDATA[<p>hi, </p>
<p>well nicely challenging question, two solutions comes to my mind:</p>
<p>1) How to keep it simple, just scale the image to size of one pixel and read that value. ok, might give wrong result in cases such as black and white line art &#8230;<br />
as code something like:</p>
<p>var bmp2:BitmapData = new BitmapData(1,1,false,0&#215;00);</p>
<p>bmp2.draw(bmpData,new Matrix(1/bmp.width,0,0,1/bmp.height) );</p>
<p>return bmp2.getPixel(0,0);</p>
<p>2) take some samples from the bitmap, and count, with something like bucketsort, the values with most occurances, simplified by taking only some tree or four most significant bytes from each channel:</p>
<p>something like:</p>
<p>function sampleColor(bmpData:BitmapData):uint {<br />
	var buckets:Object = {};<br />
	var pxl:uint;</p>
<p>	for (var y:int =0; y&lt;bmpData.height; y +=2 ) {<br />
		for (var x:int =0; x&lt;bmpData.width; x +=2) {<br />
			pxl = bmpData.getPixel(x,y) &amp; 0xE0E0E0;<br />
			buckets[pxl]= (buckets[pxl] == null) ? 1 : buckets[pxl]+1 ;<br />
		}<br />
	}</p>
<p>	var maxsample:uint =0;<br />
	var maxvalue:uint =0;<br />
	for ( var s in buckets) {<br />
		if (buckets[s]&gt;maxvalue) {<br />
			maxsample=s;<br />
			maxvalue=buckets[s];<br />
		}<br />
	}</p>
<p>	return maxsample;<br />
}</p>
<p>Funnily these two approaches return in some cases quite different results ?<br />
&#8230; never had done this before so <a href="http://www.petrileskinen.fi/Actionscript/HistogramTest/PixelSampleTest.swf" rel="nofollow">I did do some experimenting</a>. Above 1&#215;1 pixel sample, below sorted sample.</p>
<p>Hope this will help &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vidya</title>
		<link>http://pixelero.wordpress.com/2008/06/19/flash-10-bitmapdatahistogram/#comment-64</link>
		<dc:creator>Vidya</dc:creator>
		<pubDate>Tue, 08 Jul 2008 06:16:44 +0000</pubDate>
		<guid isPermaLink="false">http://pixelero.wordpress.com/?p=22#comment-64</guid>
		<description>hi,

nice tutorial. just a question - how can i get the most dominant color (rgb value) in an image?

thanks.</description>
		<content:encoded><![CDATA[<p>hi,</p>
<p>nice tutorial. just a question &#8211; how can i get the most dominant color (rgb value) in an image?</p>
<p>thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
