
<?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>The Visioneers</title>
	<atom:link href="http://www.oliveragustin.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.oliveragustin.com</link>
	<description>Tech, IT, Security, Research, Trends and  Tips</description>
	<lastBuildDate>Thu, 29 Oct 2009 16:56:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AFMA Best R&amp;D Paper for Technology/Information Generation</title>
		<link>http://www.oliveragustin.com/afma-best-rd-paper-for-technologyinformation-generation/</link>
		<comments>http://www.oliveragustin.com/afma-best-rd-paper-for-technologyinformation-generation/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 16:56:01 +0000</pubDate>
		<dc:creator>whaldsz</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[research]]></category>

		<guid isPermaLink="false">http://www.oliveragustin.com/?p=85</guid>
		<description><![CDATA[Our study, &#8220;Development of a Computer Vision System for Milled Rice Quality Analysis&#8221; won the AFMA Best R&#038;D Paper for Technology/Information Generation &#8211; Agriculture category.
The event was held during the 21st National Research Symposium last October 9, 2009 at the Fernando Lopez Hall of the Bureau of Soils and Water Management (BSWM) Bldg., Visayas Avenue, [...]]]></description>
			<content:encoded><![CDATA[<p>Our study, &#8220;Development of a Computer Vision System for Milled Rice Quality Analysis&#8221; won the AFMA Best R&#038;D Paper for Technology/Information Generation &#8211; Agriculture category.</p>
<p>The event was held during the 21st National Research Symposium last October 9, 2009 at the Fernando Lopez Hall of the Bureau of Soils and Water Management (BSWM) Bldg., Visayas Avenue, Diliman, Quezon City.</p>
<p>Check the full article @ <a href="http://www.bar.gov.ph/news/21stnrswinners.asp">http://www.bar.gov.ph/news/21stnrswinners.asp</a></p>
<p style="white-space:nowrap"><img style="border:0px" src="http://tarpipe.com/img/tarpipe.png" />&nbsp;<a target="_blank" href="http://tarpipe.com/share/?t=AFMA+Best+R%26D+Paper+for+Technology%2FInformation+Generation&u=http%3A%2F%2Fwww.oliveragustin.com%2Fafma-best-rd-paper-for-technologyinformation-generation%2F&b=Reading %22AFMA+Best+R%26D+Paper+for+Technology%2FInformation+Generation%22">Share now!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.oliveragustin.com/afma-best-rd-paper-for-technologyinformation-generation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Background Subtraction in C#</title>
		<link>http://www.oliveragustin.com/background-subtraction-in-c/</link>
		<comments>http://www.oliveragustin.com/background-subtraction-in-c/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 17:16:27 +0000</pubDate>
		<dc:creator>whaldsz</dc:creator>
				<category><![CDATA[emgu]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[background subtraction]]></category>
		<category><![CDATA[emgu.cv]]></category>
		<category><![CDATA[opencv]]></category>

		<guid isPermaLink="false">http://www.oliveragustin.com/background-subtraction-in-c</guid>
		<description><![CDATA[I have been trying to learn OpenCV for a while now and I came across Emgu.CV, a C# wrapper.  Although the Emgu.CV is still under development, it has a many features that will make your work a lot easier if you&#8217;re doing a project in computer vision and image processing areas.  Some of its capabilities [...]]]></description>
			<content:encoded><![CDATA[<p>I have been trying to learn <a rel="nofollow" href="http://sourceforge.net/projects/opencvlibrary/">OpenCV</a> for a while now and I came across <a rel="nofollow" href="http://www.emgu.com">Emgu.CV</a>, a C# wrapper.  Although the Emgu.CV is still under development, it has a many features that will make your work a lot easier if you&#8217;re doing a project in computer vision and image processing areas.  Some of its capabilities enable you to develop  web applications that can do processing of video and images via TCP/IP.</p>
<p>My goal in this article is to demonstrate simple background segmentation techniques using Emgu.CV.  Background segmentation is important if you are trying to extract features from an image and you want to remove or filter out unwanted objects.  You may also find this technique important when the recovery of color information from foreground objects is important.</p>
<p>Our objective is to remove the background from the rice image below. We want to get the color information from the rice kernels and be able to extract features for for each kernel, maybe for shape analysis or classification purposes.</p>
<p>Source code is available at the <a rel="tag" href="http://www.oliveragustin.com/forum/viewtopic.php?f=26&#038;t=25">Visioneer Forum</a> site.</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/11/image.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/11/image-thumb.png" border="0" alt="Original image" width="244" height="204" /></a></p>
<p>I am sure there are other ways to perform background subtraction but this article will cover three methods that .</p>
<ol>
<li>Color filtering in Cielab color space</li>
<li>Image masking (as i call it)</li>
<li>Cielab + image masking</li>
</ol>
<p>The three methods will be explained shortly and the link to the source code is available at the visioneer forum.</p>
<p><strong>Color Filtering in Cielab Color Space</strong></p>
<p>In this method, a copy of RGB image in Cielab space is obtained, and then process this image (in Cielab space) pixel by pixel.  Each pixel is checked if its color value is within specified range, otherwise, the pixel in the corresponding RGB image is set to black color.  An implementation is visible below:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #008000">// background subtraction in cielab color space</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> CielabColorFilteringBGSubtraction(<span style="color: #0000ff">string</span> filename, <span style="color: #0000ff">bool</span> displayResult)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     <span style="color: #008000">// create new image from file</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>     Image&lt;Bgr, Byte&gt; rgbimage = <span style="color: #0000ff">new</span> Image&lt;Bgr, <span style="color: #0000ff">byte</span>&gt;(filename);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span>     <span style="color: #008000">// make a copy of the image in lab color space</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>     Image&lt;Lab, Byte&gt; labimage = rgbimage.Convert&lt;Lab, Byte&gt;();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span>     <span style="color: #008000">// get the width and size</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span>     <span style="color: #0000ff">int</span> width = labimage.Width;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>     <span style="color: #0000ff">int</span> height = labimage.Height;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>     <span style="color: #008000">// get the filter range for each channel in lab color space</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  15:</span>     IntRange l = <span style="color: #0000ff">new</span> IntRange(Byte.Parse(min1TextBox.Text), Byte.Parse(max1TextBox.Text));</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span>     IntRange a = <span style="color: #0000ff">new</span> IntRange(Byte.Parse(min2TextBox.Text), Byte.Parse(max2TextBox.Text));</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  17:</span>     IntRange b = <span style="color: #0000ff">new</span> IntRange(Byte.Parse(min3TextBox.Text), Byte.Parse(max3TextBox.Text));</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  19:</span>     <span style="color: #008000">// process each row in the image</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span>     <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; width; i++)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  21:</span>     {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  22:</span>         <span style="color: #008000">// process each pixel</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  23:</span>         <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> j = 0; j &lt; height; j++)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  24:</span>         {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  25:</span>             <span style="color: #0000ff">if</span> (</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  26:</span>                 (labimage[j, i].X &gt;=l.Max ) || (labimage[j, i].X &lt;= l.Min) ||</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  27:</span>                  (labimage[j, i].Y &gt;= a.Max) || (labimage[j, i].Y &lt;= a.Min) ||</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  28:</span>                  (labimage[j, i].Z &gt;= b.Max) || (labimage[j, i].Z &lt;= b.Min)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  29:</span>                 )</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  30:</span>             {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  31:</span>                 <span style="color: #008000">// if outside the filter range, set the pixel to black color</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  32:</span>                 rgbimage[j, i] = <span style="color: #0000ff">new</span> Bgr(0, 0, 0);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  33:</span>             }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  34:</span>         }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  35:</span>     }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  36:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  37:</span>     <span style="color: #008000">// display</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  38:</span>     <span style="color: #0000ff">if</span> (displayResult) <span style="color: #0000ff">this</span>.NewImage(<span style="color: #006080">"Cielab-based background segmented image"</span>, rgbimage);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  39:</span> }</pre>
<p> </p>
</div>
</div>
<p>The resulting image looks like this.  In my PC, it took about 3.20 sec to perform background segmentation.</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/11/output.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/11/output-thumb.png" border="0" alt="output" width="244" height="204" /></a></p>
<p><strong>Image Masking</strong></p>
<p>In this method, what we do is convert an RGB image into binary via binary thresholding.  (The choice of threshold value depends on the image, so you have to experiment on this.)  This binary image will serve as the mask image to copy pixels from the original image to the destination image, if the corresponding pixel in the mask image is nonzero. This is given by the following representation:</p>
<p>DestinatioImage(x,y) = SourceImage(x,y) if MaskImage(x,y) &lt;&gt; 0</p>
<p>where x and y is the pixel coordinates of the image. Source, destination and mask image have the same size.</p>
<p>Code implementation is as follows:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #008000">// background subtraction by converting the RGB image to binary to create the mask</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #008000">// then use this mask to copy foreground objects in the image</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span> <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> RGBImageMaskBGSubtraction(<span style="color: #0000ff">string</span> filename, <span style="color: #0000ff">bool</span> displayResult)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>     <span style="color: #008000">// load the threshold value for grayscale image</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>     <span style="color: #0000ff">double</span> threshold = <span style="color: #0000ff">double</span>.Parse(max2TextBox.Text);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>     <span style="color: #008000">// create new image</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span>     Image&lt;Bgr, Byte&gt; img = <span style="color: #0000ff">new</span> Image&lt;Bgr, <span style="color: #0000ff">byte</span>&gt;(filename);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span>     <span style="color: #008000">//convert to grayscale</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>     Image&lt;Gray, Byte&gt; gray = img.Convert&lt;Gray, Byte&gt;();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>     <span style="color: #008000">//convert to binary image using the threshold</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  15:</span>     gray = gray.ThresholdBinary(<span style="color: #0000ff">new</span> Gray(threshold), <span style="color: #0000ff">new</span> Gray(255));</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  17:</span>     <span style="color: #008000">// copy pixels from the original image where pixels in </span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span>     <span style="color: #008000">// mask image is nonzero</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  19:</span>     Image&lt;Bgr, Byte&gt; newimg = img.Copy(gray);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  21:</span>     <span style="color: #008000">// display result</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  22:</span>     <span style="color: #0000ff">if</span> (displayResult) <span style="color: #0000ff">this</span>.NewImage(<span style="color: #006080">"Background segmented"</span>, newimg);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  23:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  24:</span> }</pre>
<p> </p>
</div>
</div>
<p>One thing we should be aware of is that, all channels in RGB image is used to convert the image in grayscale image, then eventually binary image.  The output image is shown below:</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/11/output1.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/11/output-thumb1.png" border="0" alt="output" width="244" height="204" /></a></p>
<p>Obviously, this is far worst then the first method.  But the advantage of segmentation using this technique is the speed.  The image was segmented for only 0.25 sec with more than 12X improvement, but we have to live with the quality. According to my tests, the performance improvement increases as the image size increased.  If we are very much concerned with the pixels in foreground objects, then the Image Masking method will not satisfy our requirements. </p>
<p>However, there is another method to achieve the segmentation quality of cielab color filtering method, and the speed of the image masking method. </p>
<p><strong>Cielab + Image masking</strong></p>
<p>In this method, we combine the first two techniques to get the cream of both ice creams. <img src='http://www.oliveragustin.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   What we do is to perform the processing as in image masking method, but instead of using 3 channels (in RGB format) to convert the image to grayscale, we convert the image into Cielab space, select the a*-channel of the image, and use this channel to derive the mask image.</p>
<p>Code implementation here:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #008000">// background subtraction by extracting one channel in cielab image to </span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span>  <span style="color: #008000">// create binary mask, and use this mask to copy foreground objects in </span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span>  <span style="color: #008000">// the original image</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>  <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> CielabChannelMaskBGSubtraction(<span style="color: #0000ff">string</span> filename, <span style="color: #0000ff">bool</span> displayResult)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span>  {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>      <span style="color: #0000ff">double</span> threshold = <span style="color: #0000ff">double</span>.Parse(max2TextBox.Text);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>      Image&lt;Bgr, <span style="color: #0000ff">byte</span>&gt; rgb = <span style="color: #0000ff">new</span> Image&lt;Bgr, <span style="color: #0000ff">byte</span>&gt;(filename);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span>      Image&lt;Lab, Byte&gt; img = rgb.Convert&lt;Lab, Byte&gt;();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span>      <span style="color: #008000">//get the a* channel </span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>      Image&lt;Gray, Byte&gt; gray = img[channel];</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  13:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>      <span style="color: #008000">//threshold and invert</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  15:</span>      gray = gray.ThresholdBinary(<span style="color: #0000ff">new</span> Gray(threshold), <span style="color: #0000ff">new</span> Gray(255)).Not();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span> </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  17:</span>     <span style="color: #008000">// display the result</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span>      <span style="color: #0000ff">if</span> (displayResult) <span style="color: #0000ff">this</span>.NewImage(<span style="color: #006080">"Background segmented"</span>, image);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  19:</span>  }</pre>
<p> </p>
</div>
</div>
<p>Resulting output image here, note that it has almost the same quality as in the first method but with little performance penalty (processing takes around 0.03 sec longer than the second method).</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/11/output2.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/11/output-thumb2.png" border="0" alt="output" width="244" height="204" /></a></p>
<p>Please note that you need to tweak the filter range(threshold value) for this to work in your problem area. Also,</p>
<ol>
<li>In Method 1, all three channels are used as filter ranges.</li>
<li>Method 2, uses channel 1(maximum) for grayscale threshold value</li>
<li>In method 3, you can select among the radio buttons (on the right) which channels to choose as the source for the mask image.  Then modify the filter range for that selected channel mask. You can also modify the source code to select one or more channels if it gives better performance.</li>
<li>I have included two images located in the source code folder for testing purposes.</li>
</ol>
<p>Screenshot is given below:</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/11/image1.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/11/image-thumb1.png" border="0" alt="image" width="244" height="202" /></a></p>
<p style="white-space:nowrap"><img style="border:0px" src="http://tarpipe.com/img/tarpipe.png" />&nbsp;<a target="_blank" href="http://tarpipe.com/share/?t=Background+Subtraction+in+C%23&u=http%3A%2F%2Fwww.oliveragustin.com%2Fbackground-subtraction-in-c%2F&b=Reading %22Background+Subtraction+in+C%23%22">Share now!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.oliveragustin.com/background-subtraction-in-c/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>How to Center MathType Equation in Microsoft Word</title>
		<link>http://www.oliveragustin.com/how-to-center-mathtype-equation-in-microsoft-word/</link>
		<comments>http://www.oliveragustin.com/how-to-center-mathtype-equation-in-microsoft-word/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 13:56:28 +0000</pubDate>
		<dc:creator>whaldsz</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[mathtype]]></category>
		<category><![CDATA[microsoft word]]></category>

		<guid isPermaLink="false">http://www.oliveragustin.com/how-to-center-mathtype-equation-in-microsoft-word</guid>
		<description><![CDATA[Writing technical reports and papers for conference or journal publication can be a challenging task specially when it involves a lot of equations. This is also true for those who are doing their thesis and dissertation.  And sometimes centering an equation can be so frustrating. I myself, for one, have gone through this difficulty.
I&#8217;m using [...]]]></description>
			<content:encoded><![CDATA[<p>Writing technical reports and papers for conference or journal publication can be a challenging task specially when it involves a lot of equations. This is also true for those who are doing their thesis and dissertation.  And sometimes centering an equation can be so frustrating. I myself, for one, have gone through this difficulty.</p>
<p>I&#8217;m using Microsoft Word 2003 with MathType 6.0.  What we want to achieve is to center the equation within the margin of our document and align the equation numbers[ e.g., (1), (2), and (3)] to the right edge of the margin as shown below:</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/09/image2.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/09/image-thumb2.png" border="0" alt="image" width="473" height="285" /></a></p>
<p><span id="fullpost"> </span></p>
<p>Now, here&#8217;s how we do it:</p>
<p>1.  Make sure the <span style="text-decoration: underline;">STYLES AND FORMATTING</span> is clicked so the pane at the right is visible (see the arrows).</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/09/image3.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/09/image-thumb3.png" border="0" alt="image" width="494" height="276" /></a></p>
<p>2.  Once visible, the STYLES AND FORMATTING can be edited by clicking the MODIFY menu item in the drop-down menu:</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/09/image4.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/09/image-thumb4.png" border="0" alt="image" width="419" height="274" /></a></p>
<p>3. A dialog box appears, click Format -&gt; Tabs, make sure that you are editing the <strong>MTDisplayEquation </strong>style. See the example below.</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/09/image5.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/09/image-thumb5.png" border="0" alt="image" width="294" height="442" /></a></p>
<p>4. Clicking the TABS menu item pops up another dialog box.  Assuming you are using A4-size paper with a left and right margin of 1.25&#8243;, you should edit the TAB STOP POSITION as shown, 0&#8243; (left alignment),  3&#8243; (center alignment) and 6 (right alignment).</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/09/image6.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/09/image-thumb6.png" border="0" alt="image" width="278" height="330" /></a></p>
<p>5. Close the dialog boxes and try to insert an equation.  You should have the result as shown. Tab stops being pointed by arrows are now visible at the ruler area:</p>
<p><a href="http://www.oliveragustin.com/wp-content/uploads/2008/09/image7.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.oliveragustin.com/wp-content/uploads/2008/09/image-thumb7.png" border="0" alt="image" width="480" height="188" /></a></p>
<p> </p>
<p style="white-space:nowrap"><img style="border:0px" src="http://tarpipe.com/img/tarpipe.png" />&nbsp;<a target="_blank" href="http://tarpipe.com/share/?t=How+to+Center+MathType+Equation+in+Microsoft+Word&u=http%3A%2F%2Fwww.oliveragustin.com%2Fhow-to-center-mathtype-equation-in-microsoft-word%2F&b=Reading %22How+to+Center+MathType+Equation+in+Microsoft+Word%22">Share now!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.oliveragustin.com/how-to-center-mathtype-equation-in-microsoft-word/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Harnessing defocus blur to recover high-resolution information in shape-from-focus technique</title>
		<link>http://www.oliveragustin.com/harnessing-defocus-blur-to-recover-high-resolution-information-in-shape-from-focus-technique/</link>
		<comments>http://www.oliveragustin.com/harnessing-defocus-blur-to-recover-high-resolution-information-in-shape-from-focus-technique/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 15:09:27 +0000</pubDate>
		<dc:creator>whaldsz</dc:creator>
				<category><![CDATA[research]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Traditional shape-from-focus (SFF) uses focus as the singular cue to derive the shape profile of a 3D object from a sequence of images. However, the stack of low-resolution (LR) observations is space-variantly blurred because of the finite depth of field of the camera. The authors propose to exploit the defocus information in the stack of [...]]]></description>
			<content:encoded><![CDATA[<p>Traditional shape-from-focus (SFF) uses focus as the singular cue to derive the shape profile of a 3D object from a sequence of images. However, the stack of low-resolution (LR) observations is space-variantly blurred because of the finite depth of field of the camera. The authors propose to exploit the defocus information in the stack of LR images to obtain a super-resolved image as well as a high-resolution (HR) depth map of the underlying 3D object. Appropriate observation models are used to describe the image formation process in SFF. Local spatial dependencies of the intensities of pixels and their depth values are accounted for by modelling the HR image and the HR structure as independent Markov random fields. Taking as input the LR images from the stack and the LR depth map, the authors first obtain the super-resolved image of the 3D specimen and use it subsequently to reconstruct a HR depth profile of the object.</p>
<p><b>More:</b> <a target='_blank' href='http://ieeexplore.ieee.org/xpls/abs_all.jsp?isnumber=4543863&#038;arnumber=4543866'> continued here </a></p>
<p style="white-space:nowrap"><img style="border:0px" src="http://tarpipe.com/img/tarpipe.png" />&nbsp;<a target="_blank" href="http://tarpipe.com/share/?t=Harnessing+defocus+blur+to+recover+high-resolution+information+in+shape-from-focus+technique&u=http%3A%2F%2Fwww.oliveragustin.com%2Fharnessing-defocus-blur-to-recover-high-resolution-information-in-shape-from-focus-technique%2F&b=Reading %22Harnessing+defocus+blur+to+recover+high-resolution+information+in+shape-from-focus+technique%22">Share now!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.oliveragustin.com/harnessing-defocus-blur-to-recover-high-resolution-information-in-shape-from-focus-technique/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inferring Segmented Dense Motion Layers Using 5D Tensor Voting</title>
		<link>http://www.oliveragustin.com/inferring-segmented-dense-motion-layers-using-5d-tensor-voting/</link>
		<comments>http://www.oliveragustin.com/inferring-segmented-dense-motion-layers-using-5d-tensor-voting/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 17:09:35 +0000</pubDate>
		<dc:creator>whaldsz</dc:creator>
				<category><![CDATA[research]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[We present a novel local spatiotemporal approach to produce motion segmentation and dense temporal trajectories from an image sequence. A common representation of image sequences is a 3D spatiotemporal volume, (x,y,t), and its corresponding mathematical formalism is the fiber bundle. However, directly enforcing the spatiotemporal smoothness constraint is difficult in the fiber bundle representation. Thus, [...]]]></description>
			<content:encoded><![CDATA[<p>We present a novel local spatiotemporal approach to produce motion segmentation and dense temporal trajectories from an image sequence. A common representation of image sequences is a 3D spatiotemporal volume, (x,y,t), and its corresponding mathematical formalism is the fiber bundle. However, directly enforcing the spatiotemporal smoothness constraint is difficult in the fiber bundle representation. Thus, we convert the representation into a new 5D space (x,y,t,vx,vy) with an additional velocity domain, where each moving object produces a separate 3D smooth layer. The smoothness constraint is now enforced by extracting 3D layers using the tensor voting framework in a single step that solves both correspondence and segmentation simultaneously. Motion segmentation is achieved by identifying those layers, and the dense temporal trajectories are obtained by converting the layers back into the fiber bundle representation. We proceed to address three applications (tracking, mosaic, and 3D reconstruction) that are hard to solve from the video stream directly because of the segmentation and dense matching steps, but become straightforward with our framework. The approach does not make restrictive assumptions about the observed scene or camera motion and is therefore generally applicable. We present results on a number of data sets.</p>
<p><b>More:</b> <a target='_blank' href='http://ieeexplore.ieee.org/xpls/abs_all.jsp?isnumber=4567786&#038;arnumber=4378389'> continued here </a></p>
<p style="white-space:nowrap"><img style="border:0px" src="http://tarpipe.com/img/tarpipe.png" />&nbsp;<a target="_blank" href="http://tarpipe.com/share/?t=Inferring+Segmented+Dense+Motion+Layers+Using+5D+Tensor+Voting&u=http%3A%2F%2Fwww.oliveragustin.com%2Finferring-segmented-dense-motion-layers-using-5d-tensor-voting%2F&b=Reading %22Inferring+Segmented+Dense+Motion+Layers+Using+5D+Tensor+Voting%22">Share now!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.oliveragustin.com/inferring-segmented-dense-motion-layers-using-5d-tensor-voting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
