<?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/"
	>

<channel>
	<title>Daniel's Blog</title>
	<atom:link href="http://blog.danielesser.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.danielesser.de</link>
	<description>This Blog deals with Applied-Informatics, Science, Business-Intelligence and Game-Development.</description>
	<pubDate>Wed, 06 Aug 2008 14:14:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Active Contour (Snake) with OpenCV</title>
		<link>http://blog.danielesser.de/2008/08/06/showcase-active-contour-snake-with-opencv/</link>
		<comments>http://blog.danielesser.de/2008/08/06/showcase-active-contour-snake-with-opencv/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 14:12:27 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
		
		<category><![CDATA[Academy Showcase]]></category>

		<category><![CDATA[active contour]]></category>

		<category><![CDATA[astar]]></category>

		<category><![CDATA[contour]]></category>

		<category><![CDATA[opencv]]></category>

		<category><![CDATA[snake]]></category>

		<guid isPermaLink="false">http://blog.danielesser.de/?p=51</guid>
		<description><![CDATA[A couple of weeks ago we had to develop a small computer vision program. The main task was to introduce ourself to OpenCV. The second goal was to implent the A* search algorithm which should search for an inital contour. In the last step the snake algorithm should track the objects contour while the object [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">A couple of weeks ago we had to develop a small computer vision program. The main task was to introduce ourself to <a href="http://opencvlibrary.sourceforge.net/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://opencvlibrary.sourceforge.net/');" target="_blank">OpenCV</a>. The second goal was to implent the A* search algorithm which should search for an inital contour. In the last step the snake algorithm should track the objects contour while the object moves around.</p>
<p style="text-align: left;"><span id="more-51"></span></p>
<p style="text-align: left;">First I calculate the gradient (see <a href="http://en.wikipedia.org/wiki/Sobel_operator" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://en.wikipedia.org/wiki/Sobel_operator');" target="_blank">Sobel operator</a>) of an input image. Below you can see the gray scaled gradient image of an golf ball. Darker areas mean there is a smooth color transition in the input image. Bright areas mean there is a hard color transion. For example from black to white.</p>
<p style="text-align: center;"><a href="http://blog.danielesser.de/wp-content/uploads/2008/08/first_frame_derivative.png" ><img class="size-medium wp-image-72 aligncenter" title="Gray scaled gradient image" src="http://blog.danielesser.de/wp-content/uploads/2008/08/first_frame_derivative-300x281.png" alt="" width="300" height="281" /></a></p>
<p style="text-align: left;">Then the user manually sets 3 or more points that marks a basic contour. At next the <a href="http://en.wikipedia.org/wiki/A*_search_algorithm" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://en.wikipedia.org/wiki/A*_search_algorithm');" target="_blank">A* search algorithm</a> trys to find the contour of the object. In my implementation I have used the <a href="http://en.wikipedia.org/wiki/Euclidean_distance" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://en.wikipedia.org/wiki/Euclidean_distance');" target="_blank">euclidien distance</a> as &#8220;heuristic estimate&#8221; of the distance to the goal and the gradient information for the path-costs.</p>
<p style="text-align: left;">Here a small video capture of the complete workflow:</p>
<ol>
<li>manually set 4 markers</li>
<li>wait a little bit &#8230; and then you can see 18 new markers. This is the initial contour found by the A* search algorithm.</li>
<li>the ball moves around the the snake algorithm activly moves the markers of the contour</li>
</ol>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="518" height="486" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blog.danielesser.de/wp-content/uploads/2008/08/Active Contour Demo.swf" /><embed type="application/x-shockwave-flash" width="518" height="486" src="http://blog.danielesser.de/wp-content/uploads/2008/08/Active Contour Demo.swf"></embed></object></p>
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://blog.danielesser.de/2008/08/06/showcase-active-contour-snake-with-opencv/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Doing your own Google Chart API in Python</title>
		<link>http://blog.danielesser.de/2008/07/31/doing-your-own-google-chart-api-in-python/</link>
		<comments>http://blog.danielesser.de/2008/07/31/doing-your-own-google-chart-api-in-python/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 18:06:07 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
		
		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[cgi]]></category>

		<category><![CDATA[charting]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[line chart]]></category>

		<category><![CDATA[pie chart]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.danielesser.de/2008/07/31/doing-your-own-google-chart-api-in-python/</guid>
		<description><![CDATA[Last week I saw a typical software as a service charting solution by a small company &#8230; yes they already have a good search engine, too.  The charts aren&#8217;t much impressing to me, but the combination of charting and SaaS was really intresting. So I get catched from the thought to make my own [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I saw a typical software as a service charting solution by a small company &#8230; yes they already have a good search engine, too. <img src='http://blog.danielesser.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> The charts aren&#8217;t much impressing to me, but the combination of charting and SaaS was really intresting. So I get catched from the thought to make my own charting SaaS solution. <span id="more-20"></span> I must admit that the idea is not new and there are many good solutions already available, but spending 500 USD isn&#8217;t affordable for me. Additionaly, I don&#8217;t need tons of charts. But if you plan to do a site like New York Stock Exchange you might consider to buy such a hole in one solution.</p>
<p>Another nice charting solution is from BonaVista called mircocharts. As far as I know they made a TrueType-Font to &#8216;render&#8217; the charts. Here you can see some <a href="http://www.bonavistasystems.com/ChartGallery%20Line%20Charts.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.bonavistasystems.com/ChartGallery%20Line%20Charts.html');">examples</a>.</p>
<p>First of all I would need something to render lines, text, rectangles and all the stuff to build a chart. I just rememberd the days I wrote on my diploma. Sombody gaves me a hint to use <a href="http://matplotlib.sourceforge.net/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://matplotlib.sourceforge.net/');">matplotlib</a> to render my scientific charts. So I decided to do a quick and dirty prototype with a pie chart because it is really simple to do with matplotlib.</p>
<p style="text-align:center;"><img src="http://blog.danielesser.de/wp-content/uploads/2008/07/pie.png" alt="Simple Pie Chart" /></p>
<p>The main task to render a pie with some labels is completly handled via the <em>pie</em> function. Here is the code to render the pie chart:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">pie<span style="color: black;">&#40;</span>fracs, colors=colors, explode=<span style="color: #008000;">None</span>, labels=labels, \
        autopct=<span style="color: #483d8b;">'%1.0f%%'</span>, shadow=<span style="color: #008000;">False</span><span style="color: black;">&#41;</span></pre></div></div>

<p>You can see six parameters right now. <em>fracs</em> is a list of labels. <em>autopct</em> is for the percent number in the slices. <em>explode</em> could be used to shift one or more slices out of the middle. With <em>shadow</em> set to <em>True</em> matplolib would render a shadow around the pie. But I will keep it simple right now&#8230;</p>
<p>The next thing to do is to wire this script to a web server. I have done it via cgi on my local IIS Server. Here is the core of the script:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">data = <span style="color: #dc143c;">cStringIO</span>.<span style="color: #dc143c;">StringIO</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
savefig<span style="color: black;">&#40;</span>data, format=<span style="color: #483d8b;">'png'</span>, dpi=req_getDPI<span style="color: black;">&#40;</span>fields<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Content-Type: image/png<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> + \
        <span style="color: #483d8b;">&quot;Content-Length: %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>data.<span style="color: black;">getvalue</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> data.<span style="color: black;">getvalue</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
data.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>As you can see interface a python script via cgi isn&#8217;t a complex thing. The <em>StringIO</em> class is just a container for the image data. <em>savefig</em> render the charts to png format and streams it to the <em>StringIO</em> container. After that the script prints out an simple http header consisting of <em>Content-Type: image/png</em> which marks our post back as png image and <em>Content-Length: %d\n&#8221; % len(data.getvalue())</em> which gives just the size of the image.</p>
<p>Additionally, some query parsing is required. For futher information have look at the <em>FieldStorage</em> class in the <em>cgi</em> module. To keep it simple I have adopted the syntax from the <a href="http://code.google.com/apis/chart/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://code.google.com/apis/chart/');">Google Chart API</a>. And this is the http request I have entered to get the pie chart above:</p>
<p><code>http://localhost/chart/chart.py?cht=pie&amp;chtt=Pie+Chart+Example&amp;<br />
chl=May|Jun|Jul|Aug&amp;chd=t:10.0,25.0,20.0,45.0&amp;<br />
chco=90b8c0,988ca0,ff9999,99ff99&amp;dpi=25<br />
</code></p>
<p>Doing a good looking micro line chart is a little bit tricky, but lets have a look at the result. For demonstration purposes there is a build in watermark to identify that this chart is filled with random data.</p>
<p style="text-align:center;"><img src="http://blog.danielesser.de/wp-content/uploads/2008/07/lc.png" alt="Simple Line Chart" /></p>
<p><code>http://localhost/chart/chart.py?cht=lc&amp;dpi=25</code></p>
<p>All used software is open source (except the IIS). <img src='http://blog.danielesser.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.danielesser.de/2008/07/31/doing-your-own-google-chart-api-in-python/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simple notification plugin for XChat</title>
		<link>http://blog.danielesser.de/2007/03/19/simple-notification-plugin-for-xchat/</link>
		<comments>http://blog.danielesser.de/2007/03/19/simple-notification-plugin-for-xchat/#comments</comments>
		<pubDate>Mon, 19 Mar 2007 13:31:24 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
		
		<category><![CDATA[Usefull]]></category>

		<guid isPermaLink="false">http://blog.danielesser.de/?p=7</guid>
		<description><![CDATA[Uses libnotify and its command line tool notify-send.


__module_name__ = "Notify Connector"
__module_version__ = "0.1"
__module_description__ = "Smart notifications using libnotify" 

import xchat
from subprocess import Popen,PIPE

notify_icon = "/usr/share/pixmaps/xchat.png"

def notify( topic, message, sender, urgency = "low" ):
	p = Popen(["notify-send","-i", notify_icon,"-u", urgency, topic, message])
	p.wait()

def print_CTCP_generic_cb(word, word_eol, userdata):
	notify("CTCP von " + word[1] +" empfangen", word[0], "low")
	return xchat.EAT_NONE # Let xchat do [...]]]></description>
			<content:encoded><![CDATA[<p>Uses libnotify and its command line tool <em>notify-send</em>.</p>
<p><img src="http://blog.danielesser.de/wp-content/uploads/2007/03/notify-plugin1.thumbnail.png" alt="The plugin in action!" /></p>
<p><span id="more-7"></span></p>
<pre id="python" class="prettyprint">__module_name__ = "Notify Connector"
__module_version__ = "0.1"
__module_description__ = "Smart notifications using libnotify" 

import xchat
from subprocess import Popen,PIPE

notify_icon = "/usr/share/pixmaps/xchat.png"

def notify( topic, message, sender, urgency = "low" ):
	p = Popen(["notify-send","-i", notify_icon,"-u", urgency, topic, message])
	p.wait()

def print_CTCP_generic_cb(word, word_eol, userdata):
	notify("CTCP von " + word[1] +" empfangen", word[0], "low")
	return xchat.EAT_NONE # Let xchat do its normal printing 

def print_notice_cb(word, word_eol, userdata):
	notify("Notiz von " + word[0] +" empfangen", word[1], "low")
	return xchat.EAT_NONE # Let xchat do its normal printing 

def print_channel_msg_hilight_cb(word, word_eol, userdata):
	notify(word[0] + " sagt", word[1], "critical")
	return xchat.EAT_NONE # Let xchat do its normal printing 

xchat.hook_print("CTCP Generic", print_CTCP_generic_cb)
xchat.hook_print("Notice", print_notice_cb)
xchat.hook_print("Channel Msg Hilight", print_channel_msg_hilight_cb)</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.danielesser.de/2007/03/19/simple-notification-plugin-for-xchat/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Spieleentwicklung mit Java?</title>
		<link>http://blog.danielesser.de/2007/02/23/spieleentwickling-mit-java/</link>
		<comments>http://blog.danielesser.de/2007/02/23/spieleentwickling-mit-java/#comments</comments>
		<pubDate>Fri, 23 Feb 2007 18:02:25 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
		
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://blog.danielesser.de/?p=5</guid>
		<description><![CDATA[
Ich war erstaunt als ich beim Surfen im Netz Ã¼ber JOGL und LWGL gestolpert bin. Im ersten Moment konnte ich nicht glauben, dass das Java ist was dort schnell umher flirrend Partikel Ã¼ber meinen Bildschirm scheuchte. Aber es ist in der Tat ein Java Webstart Game mit einem OpenGL-Backend.
]]></description>
			<content:encoded><![CDATA[<p><img src="https://jogl-demos.dev.java.net/particles_sm.jpg" border="1" alt="Particle Engine Demo" hspace="10" width="160" height="129" align="left" /></p>
<p>Ich war erstaunt als ich beim Surfen im Netz Ã¼ber <a title="JOGL OpenGL Bindings" href="https://jogl.dev.java.net/" onclick="javascript:pageTracker._trackPageview('/outbound/article/https://jogl.dev.java.net/');">JOGL</a> und <a title="Lightweight Java Game Library" href="http://www.lwjgl.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.lwjgl.org');">LWGL</a> gestolpert bin. Im ersten Moment konnte ich nicht glauben, dass das Java ist was dort schnell umher flirrend <a title="JOGL Particle Engine Demo" href="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/ParticleEngine.jnlp" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/ParticleEngine.jnlp');">Partikel</a> Ã¼ber meinen Bildschirm scheuchte. Aber es ist in der Tat ein Java Webstart Game mit einem OpenGL-Backend.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.danielesser.de/2007/02/23/spieleentwickling-mit-java/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

