<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Computer Vision Software</title><link>http://www.computer-vision-software.com/blog</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ComputerVisionSoftware" /><description>Rhonda Ltd., computer vision software blog</description><language>en</language><lastBuildDate>Wed, 03 Mar 2010 02:33:38 PST</lastBuildDate><generator>http://wordpress.org/?v=2.9.2</generator><sy:updatePeriod xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">hourly</sy:updatePeriod><sy:updateFrequency xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">1</sy:updateFrequency><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ComputerVisionSoftware" /><feedburner:info uri="computervisionsoftware" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>ComputerVisionSoftware</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><title>People counting with top-mounted camera</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/KxLK6CWZ8OU/</link><category>Uncategorized</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex</dc:creator><pubDate>Wed, 03 Mar 2010 02:33:38 PST</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=114</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/e19olH5goNY&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/e19olH5goNY&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=KxLK6CWZ8OU:a2kvBkatRaE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=KxLK6CWZ8OU:a2kvBkatRaE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=KxLK6CWZ8OU:a2kvBkatRaE:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description></description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2010/03/people-counting-with-top-mounted-camera/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2010/03/people-counting-with-top-mounted-camera/</feedburner:origLink></item><item><title>Object recognition (“instruments recognition”)</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/W3cInn-KeNI/</link><category>Demo</category><category>Demo video</category><category>Demo videos</category><category>YouTube</category><category>instrument recognition</category><category>instruments</category><category>Object Recognition</category><category>Object Tracking</category><category>OpenCV</category><category>video</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex</dc:creator><pubDate>Mon, 01 Feb 2010 03:27:01 PST</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=112</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/xPd6REexvyc&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/xPd6REexvyc&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></p>
<p><a href="http://www.computer-vision-software.com/files/videos/tools.avi">tools.avi</a></p>
<p>This object recognition algorithm is based on own pattern-matching algorithm. The algorithm is able to recognize pre-trained objects which are defined with special set of templates. <span id="more-112"></span>Theoretically, the algorithm works with any &#8220;3D&#8221; objects which have good projection on 2D coordinates. However, natural 3D objects are covered by few templates for set of 2D projections. For limited number of object templates, the algorithm works in real-time on PC (Intel P4 3.0 GHz) .</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=W3cInn-KeNI:7Up7KAA-CXU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=W3cInn-KeNI:7Up7KAA-CXU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=W3cInn-KeNI:7Up7KAA-CXU:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>tools.avi
This object recognition algorithm is based on own pattern-matching algorithm. The algorithm is able to recognize pre-trained objects which are defined with special set of templates. Theoretically, the algorithm works with any &amp;#8220;3D&amp;#8221; objects which have good projection on 2D coordinates. However, natural 3D objects are covered by few templates for set of 2D projections. [...]</description><enclosure url="http://www.computer-vision-software.com/files/videos/tools.avi" length="20149844" type="video/x-msvideo" /><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2010/02/object-recognition-instruments/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2010/02/object-recognition-instruments/</feedburner:origLink></item><item><title>USD banknotes recognition</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/wr8XmXrJg88/</link><category>Demo</category><category>Demo video</category><category>Demo videos</category><category>OpenCV</category><category>YouTube</category><category>Currency recognition</category><category>Object Recognition</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Yuri Vashchenko</dc:creator><pubDate>Tue, 15 Dec 2009 03:11:22 PST</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=110</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/fyr-HuROFpk&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/fyr-HuROFpk&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></p>
<p>The currency recognition demo application works under Windows XP, Intel P4 3GHz. Quality of recognition: 85%. The solution is cross-platform. The application was tested on Linux, ARM11 and on Linux/Windows, Intel Atom.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=wr8XmXrJg88:X4jS-8dCwo8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=wr8XmXrJg88:X4jS-8dCwo8:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=wr8XmXrJg88:X4jS-8dCwo8:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>The currency recognition demo application works under Windows XP, Intel P4 3GHz. Quality of recognition: 85%. The solution is cross-platform. The application was tested on Linux, ARM11 and on Linux/Windows, Intel Atom.</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2009/12/usd-banknotes-recognition/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">2</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2009/12/usd-banknotes-recognition/</feedburner:origLink></item><item><title>Barcode recognition (mobile platform)</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/NSlr8Ljt3vU/</link><category>Demo</category><category>Demo video</category><category>Demo videos</category><category>YouTube</category><category>barcode recognition</category><category>Object Recognition</category><category>Pocket PC</category><category>PXA270</category><category>Smart phone</category><category>video</category><category>WinCE</category><category>Windows CE</category><category>Windows Mobile</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex</dc:creator><pubDate>Tue, 24 Nov 2009 17:55:23 PST</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=108</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/nBex4IRgpqw&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/nBex4IRgpqw&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></p>
<p>Interesting details can be found at: <a href="http://www.computer-vision-software.com/blog/2009/10/barcode">http://www.computer-vision-software.com/blog/2009/10/barcode</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=NSlr8Ljt3vU:soUYBH0mvh0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=NSlr8Ljt3vU:soUYBH0mvh0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=NSlr8Ljt3vU:soUYBH0mvh0:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>Interesting details can be found at: http://www.computer-vision-software.com/blog/2009/10/barcode</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2009/11/barcode-recognition-mobile-platform/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">3</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2009/11/barcode-recognition-mobile-platform/</feedburner:origLink></item><item><title>FAQ: OpenCV Haartraining</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/50C4IVuGr44/</link><category>OpenCV</category><category>face detection</category><category>Haar</category><category>HaarTraining</category><category>Object detection</category><category>OPENMP</category><category>Viola-Jones</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rhondasw</dc:creator><pubDate>Mon, 09 Nov 2009 22:59:44 PST</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=106</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Hi All, before posting your question, <span style="text-decoration: underline;">please look at this FAQ</span><span style="text-decoration: underline;"> carefully!</span> Also you can read <a title="OpenCV Haartraining" href="http://www.computer-vision-software.com/blog/2009/06/opencv-haartraining-detect-objects-using-haar-like-features/" target="_blank">OpenCV haartraining article</a>.  If you are sure, there is no answer to your question, feel free to post comment.  Also please, put comments about improvement of this post.  This post will be updated, if needed.</p>
<h1><span id="more-106"></span></h1>
<h2 style="text-align: left;"><em><span style="color: #ff9900;">Positive images</span></em></h2>
<p><em><span style="color: #ff9900;"><br />
</span></em></p>
<h3><em>Why positive images are named so?</em></h3>
<p>Because a positive image contains the target object which you want machine to detect. Unlike them, a negative image doesn&#8217;t contain such target objects.</p>
<h3><em>What&#8217;s vec file in OpenCV haartraining?</em></h3>
<p>During haartraining positive samples should have the same width and height as you define in command &#8220;-w -h size&#8221;.  So original positive images are resized  and packed as thumbs to vec file. Vec file has header: number of positive samples, width, height and contain positive thumbs in body.</p>
<h3><em><em>Is it possible to merge vec files?</em></em></h3>
<p>Yes, use Google, there are free tools, written by OpenCV&#8217;s community.</p>
<h3><em>I have  positive images, how create vec file of positive samples?</em></h3>
<p>There is tool in C:\Program Files\OpenCV\apps\HaarTraining\src createsamples.cpp.  Usage:</p>
<p>createsamples -info positive_description.txt -vec samples.vec -w 20 -h 20</p>
<h3><em>What&#8217;s positive description file?</em></h3>
<p>The matter is that, on each positive image, there can be several objects. They have bounding rectangles: x,y, width, height.  So you can write such description info of image:</p>
<p>positive_image_name  num_of_objects x y width height x y width height &#8230;</p>
<p>Text file, which contains such info about positive images is called description file. So during vec file generation,  <span style="text-decoration: underline;">really objects are packed</span>, but not whole image. Essentially vec file is needed to speed up machine learning.</p>
<h3><em>Do I always need description file, even if I have only one object on a image?</em></h3>
<p>Yes, with createsamples you need description file.  If you have only one object, it&#8217;s bounding rectangle may be bounding rectangle of whole image. If you want, write your own tool for vec file generation =)</p>
<h3><em>Should lightning conditions and background be various on positive images?</em></h3>
<p><span style="text-decoration: underline;">Yes, it&#8217;s very important</span>. On each positive image, beside object, there is background. Try to fill this background with random noise, avoid constant background.</p>
<h3><em>How much background should be on positive image?</em></h3>
<p>If you have much background pixels on your positive images in comparison with object&#8217;s pixels &#8211; it&#8217;s bad since the haartraining could remember the background as feature of positive image.</p>
<p>If you don&#8217;t have background pixels at all &#8211; it&#8217;s also bad. There should be small background frame on positive image</p>
<h3><em>Should all original positive images have the same size?</em></h3>
<p>No, original images can have any size.  But it&#8217;s important that width, height of this rectangle have the same aspect ratio as -w -h.</p>
<h3><em><em>What&#8217; s  -w and -h should I put in createsamples? Should it be always square? </em></em></h3>
<p>You can put any value to -w and -h depend on aspect ratio of the target object which you want to detect.  <span style="text-decoration: underline;">But objects of smaller size will not be detected</span>! For faces, commonly used values are 24&#215;24, 20&#215;20. But you may use 24&#215;20, 20&#215;24, etc.</p>
<h3><em>Errors during vec file generation: </em>Incorrect size of input array, 0 kb vec file,</h3>
<p>-First check you description file: positive_image_name should be <span style="text-decoration: underline;">absolute path name</span> without spaces like &#8220;C:\content\image.jpg&#8221; not &#8220;C:\con tent\image.jpg&#8221; or <span style="text-decoration: underline;">relative path name</span>.</p>
<p>-Avoid empty lines in description file</p>
<p>-Resolution of original positive image file should be not less, then -w -h parameters you put.</p>
<p>-Check that positive images are available in your file systems and not corrupted.</p>
<p>-There can be unsupported formats. Jpeg, Bmp, PPM are supported!</p>
<h3><em>Example of vec file generation!</em></h3>
<p>Let&#8217;s working directory be C:\haartraining. In it there is createsamples.exe. There is folder</p>
<p>C:\haartraining\positives. So create description file positive_desc.txt.</p>
<p>positives\image1.jpg 1 10 10 20 20</p>
<p>positives\image2.jpg 2 30 30 50 50 60 60 70 70</p>
<p>or</p>
<p>C:\haartraining\positives\image1.jpg 1 10 10 20 20</p>
<p>C:\haartraining\positives\image2.jpg 2 30 30 50 50 60 60 70 70</p>
<p>You should avoid empty lines and empty space in image&#8217;s path</p>
<p><span style="color: #0000ff;">createsamples<span style="color: #000000;"> -info positive_desc.txt -vec samples.vec -w 20 -h 20</span></span></p>
<h2 style="text-align: left;"><span style="color: #ffffff;"><em><strong><br />
</strong></em></span></h2>
<h2 style="text-align: left;"><em><span style="color: #ff9900;"><strong>Negative images</strong></span></em></h2>
<p><em><span style="color: #ff9900;"><strong><br />
</strong></span></em></p>
<h3><em>What negative images should I take?</em></h3>
<p>You can use any image of OpenCV supported formats, which does not contain target objects (which are present on positive images). But they <span style="text-decoration: underline;">should be various</span> &#8211; it&#8217;s important! Good enough database is <a href=" 	  http://tutorial-haartraining.googlecode.com/svn/trunk/data/negatives/">here</a></p>
<h3><em>Should negative images have the same size?</em></h3>
<p>No. But the size should not be less than -w -h, which were put during vec file generation.</p>
<h3><em>What&#8217;s description file for negative image? </em></h3>
<p>It&#8217;s just text file, often called negative.dat, which contains full path to negative images like:</p>
<p>image_name1.jpg</p>
<p>image_name2.jpg</p>
<p>Avoid empty lines in it.</p>
<h3><em>How many negative/positive image should I take?</em></h3>
<p>It depends on your task.  For real cascades there should be about 1000 positive images and 2000 negative images e.g.</p>
<p>Good enough proportion is  positive:negative = 1:2, but it&#8217;s not hard rule! I would recommend first to use small number of samples, generate cascade, test it, then enlarge number of samples.</p>
<h2 style="text-align: left;"><span style="color: #ff9900;"><em><strong>Launch haartraining.exe (OpenCV\apps\HaarTraining\src</strong></em></span><em><strong><em><span style="color: #ff9900;"><strong><span style="color: #ff9900;">)</span></strong></span></em></strong></em></h2>
<p><em><strong><em><span style="color: #ff9900;"><strong><span style="color: #ff9900;"><br />
</span></strong></span></em></strong></em></p>
<h3><em><em>Example of launching</em></em></h3>
<p>Working directory is C:\haartraining with haartraining.exe tool and samples.vec file.</p>
<p>Let&#8217;s negative images are in C:\haartraining\negative, in this case negative.dat should be like this:</p>
<p>negative\neg1.jpg</p>
<p>negative\neg2.jpg</p>
<p>&#8230;</p>
<p>So in C:\haartraining launch this:  <span style="color: #0000ff;">haartraining</span> -data haarcascade -vec samples.vec -bg negatives.dat -nstages 20  -minhitrate 0.999 -maxfalsealarm 0.5 -npos 1000 -nneg 2000 -w 20 -h 20 -nonsym -mem 1024</p>
<ul>
<li><span style="color: #000000;">w  h  is the same, you put during vec file generation</span></li>
<li><span style="color: #000000;">npos nneg  &#8211; number of positive samples and negative samples</span></li>
<li><span style="color: #000000;">mem &#8211; RAM memory, that program may use</span></li>
<li><span style="color: #000000;">maxfalsealarm &#8211; maximum false alarm, that stage may have. If big false alarm &#8211; it could be bad detection system<br />
</span></li>
<li><span style="color: #000000;">minhitrate &#8211; minimal hit rate, that should stage have at least<br />
</span></li>
<li><span style="color: #000000;">nstage &#8211; number of stages in cascade</span></li>
</ul>
<h3><em>What&#8217; s falsealarm and hitrate of stage?</em></h3>
<p>You should read theory of adaboost about strong classifier. Stage is <span style="text-decoration: underline;">strong classifier</span>. In short:</p>
<ul>
<li>For example you have 1000 positive samples. You want your system to detect 900 of them. So desired hitrate = 900/1000 = 0.9. <span style="text-decoration: underline;">Commonly, put minhitrate = 0.999</span></li>
<li>For example you have 1000 negative samples. Because it&#8217;s negative, you don&#8217;t want your system to detect them. But your system, because it has error, will detect some of them. Let error be about 490 samples, so false alarm = 490/1000 = 0.49. <span style="text-decoration: underline;">Commonly,put false alarm  = 0.5</span></li>
</ul>
<h3><em>Are falsealarm and hitrate depend on each other?</em></h3>
<p>Yes, <span style="color: #000000;">there is </span><span style="text-decoration: underline;">dependency</span>. You could not put <span style="color: #000000;">minhitrate = 1.0 and </span><span style="color: #000000;">maxfalsealarm = 0.0. </span>.</p>
<p>Firstly, the system builds classifier with desired hitrate, then it will calculate it&#8217;s falsealarm, if the false alarm is higher than maxfalsealarm, the system will reject such classifier and will build the next one. During haartraining you may see such:</p>
<p style="padding-left: 60px;">N |%SMP|F| ST.THR | HR | FA | EXP. ERR|<br />
+—-+—-+-+———+———+———+———+<br />
| 0 |25%|-|-1423.312590| 1.000000| 1.000000| 0.876272|</p>
<p style="padding-left: 60px;">HR &#8211; hitrate</p>
<p style="padding-left: 60px;">FA &#8211; falsealarm</p>
<h3><em>What&#8217;s falsealarm and hitrate of whole cascade?</em></h3>
<p>Cascade is linked list (or three) of stages. That&#8217;s why:</p>
<ul>
<li>False alarm of cascade = false alarm of  stage 1* false alarm of  stage 2* &#8230;</li>
<li>Hit rate = hitrate of  stage 1 * hitrate of stage 2* &#8230;</li>
</ul>
<h3><em>How many stages should be used?</em></h3>
<ul>
<li>If you set big number of stages, then you will achieve better false alarm, but it will take more time for generating cascade.</li>
<li>If you set big number of stages, then the detection time could be slower</li>
<li>If you set big number of stages, then the worse hitrate will be (0.99*0.99*&#8230; etc). <span style="text-decoration: underline;">Commonly 14-25 stages are enough</span></li>
<li>It&#8217;s useless to set many stage, if you have small number of positive, negative samples</li>
</ul>
<h3><em>What&#8217;s weighttrimming, eqw, bt, nonsym options?</em></h3>
<p>Really all these parameters are related to <a href="http://en.wikipedia.org/wiki/Adaboost">Adaboost</a>, read theory. In short:</p>
<ul>
<li>nonsym &#8211; If you positive samples are not X or Y symmetric, put -nonsym, -sym is default!</li>
<li>eqw &#8211; if you have different number of pos and neg images, it&#8217;s better to put no eqw</li>
<li>weighttrimming &#8211; for calculation optimization. It can reduce calculation time a little, but quality may be worse</li>
<li>bt &#8211; what Adaboost algorithm to use: Real AB, Gentle AB, etc.</li>
</ul>
<h3><em>What&#8217;s  minpos, nsplits, maxtreesplits options?</em></h3>
<p>These parameters are related to clustering. In Adaboost different week classifier may be used: <span style="text-decoration: underline;">stump-based</span> or <span style="text-decoration: underline;">tree-based</span>.  If you choose nsplits &gt; 0, tree-based will be used and you should set up minpos and maxtreesplits.</p>
<ul>
<li>nsplits &#8211; minimun number of nodes in tree</li>
<li>maxtreesplits &#8211; maximum number of nodes in tree. If maxtreesplits &lt; nsplits,  tree will not be built</li>
<li>minpos &#8211; number of positive images, that can be used by one node during training.  All positive images are splitted between nodes. Generally minpos  should be not less than  npos/nsplits.</li>
</ul>
<h3><em>Errors and stranges during haartraining!</em></h3>
<ul>
<li>Error (valid only for Discrete and Real AdaBoost): misclass &#8211; it&#8217;s warning, but no error.  Some options are specific to D and R Adaboost.  So your haartraining is ok.</li>
<li>Screen is filled with such | 1000 |25%|-|-1423.312590| 1.000000| 1.000000| 0.876272| &#8211; your training is cycled, restart it. First column should have value &lt; 100</li>
<li>cvAlloc fails. Our of memory &#8211; you give too much negative images or sample.vec is too big. All these pictures are loaded to RAM.</li>
<li>Pay attention you put the same -w and -h, as during vec file generation</li>
<li>Pay attention, that number of positive samples and negative samples, you put in -npos -nneg are really available</li>
<li>Avoid empty line in negative.dat file</li>
<li>Required leaf false alarm rate achieved. Branch training terminated &#8211; it&#8217;s impossible to build classifier with good false alarm on this negative images. Check your negative images are really negative =),  maxfalsealarm should be in [0.4-0.5]</li>
</ul>
<h2 style="text-align: left;"><span style="color: #ff9900;"><em><strong>OpenCV XML haarcascade</strong></em></span></h2>
<p><span style="color: #ff9900;"><em><strong><br />
</strong></em></span></p>
<h3><em>During haartraining, there are txt file in haarcascade folder, how can we get XML  from them?</em></h3>
<p>There is OpenCV/samples/c/convert_cascade.c. Use like:</p>
<p><span style="color: #0000ff;">convert_cascade</span> &#8211;size=&#8221;20&#215;20&#8243; haarcascade haarcascade.xml</p>
<h3><em>How can I test generated XML cascade?<br />
</em></h3>
<p style="text-align: left;"><span style="color: #ff9900;"><em><strong> </strong></em></span><span style="color: #ff9900;"><span style="color: #000000;">There is </span></span>OpenCv/apps/HaarTraining/src<strong><span style="color: #ff9900;"><strong><span style="color: #000000;"> </span></strong></span></strong>/perfomance.cpp. You need have positive images(not used during training) and positive description file.  Use like:</p>
<p><span style="color: #0000ff;">performance</span> -data haarcascade -w 20 -h 20 -info positive_description.txt -ni</p>
<p><span style="color: #0000ff;">performance </span>-data haarcascade.xml -info positive_description.txt -ni</p>
<h2 style="text-align: left;"><span style="color: #ff9900;"><em><strong><em><strong>Time and Speed of haar cascade generation</strong></em></strong></em></span></h2>
<p><span style="color: #ff9900;"><em><strong><em><strong><br />
</strong></em></strong></em></span></p>
<h3><em>Average time to generate cascade on PC?</em></h3>
<p>It depends on task and your machine.  I generated cascade for face detection, for this used such parameters: -nstages 20 -minhitrate 0.999 -maxfalsealarm 0.5 -npos 4000 -nneg 5000 -w 20 -h 20 -nonsym -mem 1024.  It took <span style="color: #ff0000;">6 days</span> on Pentium 2.7GHZ 2GB RAM.</p>
<h3><em>What is <a href="http://en.wikipedia.org/wiki/OpenMP">OpenMP</a>?</em></h3>
<p>&#8220;<em>The <strong>OpenMP</strong> (Open Multi-Processing) is an <a title="Application programming interface" href="http://en.wikipedia.org/wiki/Application_programming_interface">application programming interface</a> (API) that supports multi-platform <a title="Shared memory" href="http://en.wikipedia.org/wiki/Shared_memory">shared memory</a> <a title="Multiprocessing" href="http://en.wikipedia.org/wiki/Multiprocessing">multiprocessing</a> programming in <a title="C (programming language)" href="http://en.wikipedia.org/wiki/C_%28programming_language%29">C</a>, <a title="C++" href="http://en.wikipedia.org/wiki/C%2B%2B">C++</a> and <a title="Fortran" href="http://en.wikipedia.org/wiki/Fortran">Fortran</a> on many architectures, including <a title="Unix" href="http://en.wikipedia.org/wiki/Unix">Unix</a> and <a title="Microsoft Windows" href="http://en.wikipedia.org/wiki/Microsoft_Windows">Microsoft Windows</a> platforms</em>&#8220;. If you have MT processor, you can use it.  In code you should add OpenMP defines and put compile options.  For example in VisualStudio2005: Properties-&gt;C/C++-&gt;Language-&gt;OpenMP support</p>
<h3><em>Is it possible to improve speed of haartraining?</em></h3>
<p>Yes, one of possible ways is to use parallel programming. We have realized OpenCV haartraining using MPI for linux cluster. You can read it <a href="http://www.computer-vision-software.com/blog/2009/06/parallel-world-of-opencv/">here</a></p>
<h2><span style="color: #ff9900;"><em><strong>Object detection with OpenCV XML cascades</strong></em></span></h2>
<p><span style="color: #ff9900;"><em><strong><br />
</strong></em></span></p>
<h3><em>Is it possible to detect rotated faces?</em></h3>
<p>Yes. It is impossible to generate cascade, which can detect face in all orientations. But you can generate cascade for each orientation separately. For this you need positive content of rotated faces. You can try to generate cascade with OpenCV , add -mode ALL, with it tilted haar feature will be used. But it&#8217;s badly implemented, at least in OpenCV 1.1. If you want you can add your own feature to opencv haartraining &#8211; it&#8217;s not too hard.</p>
<p>Another approach is to write head pose estimator. Then rotate your pictures, so that you have frontal face and detect it with OpenCV default face cascade</p>
<h3><em>Is it possible to recognize gender, attention, race with  Haar features?</em></h3>
<p>We tried, but could not do it with OpenCV haartraining. That&#8217;s why for such classification, we used our own <a href="http://www.computer-vision-software.com/blog/2009/07/gender-detection/" target="_blank">gender </a>and <a href="http://www.computer-vision-software.com/blog/2009/11/detect-attention-please/">attention</a> classificators. Of course you can use Adaboost for this task, which is implemented in haartraining, but we did not get good results.</p>
<h3><em>Is it possible to detect faces in real time?</em></h3>
<p>Yes.  On PC default OpenCV facedetector takes about 200 ms for 640&#215;480 picture, about 5fps &#8211; it&#8217;s not real time. We have changed facedetector and get about 15 fps &#8211; which is real time. You can see results  <a href="http://www.computer-vision-software.com/blog/2009/06/fastfurious-face-detection-with-opencv/" target="_blank">here</a> and <a href="http://www.computer-vision-software.com/blog/2009/10/audience-measurement-face-tracker-gender-recognition-attention-recognition-etc/" target="_blank">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=50C4IVuGr44:erw9a7xwULM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=50C4IVuGr44:erw9a7xwULM:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=50C4IVuGr44:erw9a7xwULM:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>Hi All, before posting your question, please look at this FAQ carefully! Also you can read OpenCV haartraining article.  If you are sure, there is no answer to your question, feel free to post comment.  Also please, put comments about improvement of this post.  This post will be updated, if needed.

Positive images


Why positive images are [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2009/11/faq-opencv-haartraining/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">15</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2009/11/faq-opencv-haartraining/</feedburner:origLink></item><item><title>Detect attention, please!</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/CPB_DiWSMwQ/</link><category>OpenCV</category><category>Attention classifier</category><category>Machine learning</category><category>SVM</category><category>Viola-Jones</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rhondasw</dc:creator><pubDate>Sun, 08 Nov 2009 17:13:35 PST</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=100</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p style="padding-left: 30px;">Nowadays, different audience measurement systems become more and more popular. They are used in active advertising, for gathering statistics, etc. One of the key features of these smart systems is <strong>attention detection</strong>.  For advertisers, for instance,  it seems very  important to know, how much attention commercial attracts. In this article, I will describe attention detector module, used in our <a href="http://www.computer-vision-software.com/blog/2009/10/audience-measurement-face-tracker-gender-recognition-attention-recognition-etc/" target="_blank">Audience Measurement system</a>.</p>
<p><span id="more-100"></span></p>
<p>We started our work with attempts to understand, what attention we want to detect.  On the one hand, It seems very easy  to say, if person has attention or not.  On the other hand,  it&#8217;s very difficult to formalize: <strong>What attention is</strong>.  In some articles, it&#8217;s considered to detect attention based on <em>eyes information</em>.  But if person wears sunglasses? Another &#8220;criteria&#8221; is to to use <em>nose information</em>: Where nose points at! For our business case nose information is not enough either. More over, nose can also be &#8220;hidden&#8221;.</p>
<p>That&#8217;s why our attention is based on <strong>head pose information</strong>. We collected face images, which in our opinion, have attention and don&#8217;t have attention.  To be honest, most of images with attention were <em>frontal faces</em> and vice versa.  These two sets resolve task.</p>

<a href='http://www.computer-vision-software.com/blog/2009/11/detect-attention-please/attention-2/' title='attention'><img width="150" height="150" src="http://www.computer-vision-software.com/blog/wp-content/uploads/2009/11/attention1-150x150.jpg" class="attachment-thumbnail" alt="" title="attention" /></a>
<a href='http://www.computer-vision-software.com/blog/2009/11/detect-attention-please/nonatt/' title='nonatt'><img width="150" height="150" src="http://www.computer-vision-software.com/blog/wp-content/uploads/2009/11/nonatt-150x150.jpg" class="attachment-thumbnail" alt="" title="nonatt" /></a>

<p>To teach machine to detect attention , we need a machine learning algorithm. We have Viola Jones one and if it can detect face/non face, why not use it to detect attention/non attention? Learning samples we have&#8230; So with Adabost, we chose 100 Haar-like features. With them, each image is converted to 100-dimensional vector.  To classify it, we used C4.5.  Self-test was very good: 97% accuracy.  But when started testing on real video, we had bad result: 60% accuracy. The problems begun, when  <span style="text-decoration: underline;">lightning conditions were modified</span> or <span style="text-decoration: underline;">face shifted some pixels</span>, even despite the fact that, we used normalization like in OpenCV Viola Jones algorithm. The matter is that, face and non-face images are very different, but faces with attention and with non-attention are very similar.</p>
<p>Thus, we needed <strong>lightning-invariant method</strong>, which is not so sensitive to XY-shifting.  We developed our own template-matching method.  First, using PCA, we get templates of face. With these templates, each face is  converted to N-dimensional vector, which is classified with SVM. Accuracy of our attention system is about <strong>90%</strong>.  Its working you can see in our <a href="../2009/10/audience-measurement-face-tracker-gender-recognition-attention-recognition-etc/" target="_blank">Audience Measurement system</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=CPB_DiWSMwQ:txEfbE3Y4sU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=CPB_DiWSMwQ:txEfbE3Y4sU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=CPB_DiWSMwQ:txEfbE3Y4sU:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>Nowadays, different audience measurement systems become more and more popular. They are used in active advertising, for gathering statistics, etc. One of the key features of these smart systems is attention detection.  For advertisers, for instance,  it seems very  important to know, how much attention commercial attracts. In this article, I will describe attention detector [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2009/11/detect-attention-please/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">1</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2009/11/detect-attention-please/</feedburner:origLink></item><item><title>Object Recognition (Nike logo)</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/6lsQShUOvC8/</link><category>Demo</category><category>Demo video</category><category>Demo videos</category><category>OpenCV</category><category>YouTube</category><category>ARM</category><category>Object detection</category><category>Object Recognition</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex</dc:creator><pubDate>Thu, 22 Oct 2009 02:43:40 PDT</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=98</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/Hgb5IFd2QPY&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/Hgb5IFd2QPY&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></p>
<p><a href="http://www.computer-vision-software.com/files/videos/nike.avi">nike.avi</a></p>
<p>This is a demo video of the invariant orientation and scale fast object detection algorithm. The algorithm is a robust in cases when the object is deformed a little <img src='http://www.computer-vision-software.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><span id="more-98"></span></p>
<p>The algorithm is a cross-platform solution.</p>
<p><strong>Performance</strong>:</p>
<ul>
<li>on ARM11 530MHz, the algorithm gives 1 fps for 640&#215;480 frame;</li>
<li>on Intel P4 3Hz, the algorithm gives 12 fps and more for 640&#215;480 frame.</li>
</ul>
<p><strong>Quality</strong>: 86%.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=6lsQShUOvC8:znVZg9gcmFk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=6lsQShUOvC8:znVZg9gcmFk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=6lsQShUOvC8:znVZg9gcmFk:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>nike.avi
This is a demo video of the invariant orientation and scale fast object detection algorithm. The algorithm is a robust in cases when the object is deformed a little  

The algorithm is a cross-platform solution.
Performance:

on ARM11 530MHz, the algorithm gives 1 fps for 640&amp;#215;480 frame;
on Intel P4 3Hz, the algorithm gives 12 fps and more for 640&amp;#215;480 frame.

Quality: 86%.</description><enclosure url="http://www.computer-vision-software.com/files/videos/nike.avi" length="21383022" type="video/x-msvideo" /><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2009/10/object-recognition-nike-logo/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">3</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2009/10/object-recognition-nike-logo/</feedburner:origLink></item><item><title>Barcode recognition demo</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/_jpQ13YAm_U/</link><category>Demo</category><category>ARM</category><category>barcode</category><category>barcode recognition</category><category>Object Recognition</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ivan Dyukov</dc:creator><pubDate>Mon, 05 Oct 2009 23:45:08 PDT</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=93</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>I would like to represent an executable demo  which was described at  http://www.computer-vision-software.com/blog/2009/07/barcode-recognition/.</p>
<p>This is demo application for Rhonda barcode recognition library. It&#8217;s cross-platform library written on C++ language. It was tested on ARM Cortex-A8, ARM11 and x86 platforms.</p>
<p><strong>Average recognition time on 640&#215;480 frames:</strong></p>
<p>P4 &#8211; 3GHz:  25ms</p>
<p><span id="more-93"></span></p>
<p><strong>Program description:</strong></p>
<p>main window:</p>
<p><img class="alignnone size-medium wp-image-95" title="main_preview" src="http://www.computer-vision-software.com/blog/wp-content/uploads/2009/10/main_preview-300x253.jpg" alt="main_preview" width="300" height="253" /></p>
<p><strong>Supported barcode’s types</strong>: <a title="EAN13" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/EAN13');" href="http://en.wikipedia.org/wiki/EAN13" target="_self">EAN13</a>, <a title="UPCA" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Universal_Product_Code');" href="http://en.wikipedia.org/wiki/Universal_Product_Code" target="_self">UPCA</a></p>
<p><strong>SYSTEM REQUIREMENTS</strong>:<br />
Recommended PC<br />
Processor: Intel P4<br />
Memory: 1GB RAM<br />
Operating system: Windows XP SP3<br />
Minimal screen resolution for Barcode Demo is 1024*768</p>
<p><strong>Recommended camera</strong><br />
Barcode Demo works with any standard USB camera.<br />
Web cam must support 640×480 and 960×720 resolutions and focus range should start  from 5 cm (2 inch).<br />
If you do not already have a camera, we recommend that you purchase the Logitec QuickCam PRO 9000 or the Logitec QuickCam Sphere AF</p>
<p><strong>USAGE INSTRUCTION:</strong><br />
Attach camera to PC and then run “rhonda_barcode_demo.exe”  .</p>
<p>Demo application supports 2 modes: 640×480 and 960×720 resolutions.</p>
<p><strong>Recomended distance from camera to barcode</strong>:<br />
5-11 cm (2-4 inch)  for 640×480 mode<br />
5-20 cm (2-8 inch)  for 960×720 mode</p>
<p>Each frame is scanned in 8 directions.  Time of processing of each frame and  each direction are printed to a console window.</p>
<p><img class="alignnone size-medium wp-image-96" title="console_window" src="http://www.computer-vision-software.com/blog/wp-content/uploads/2009/10/console_window-300x148.jpg" alt="console_window" width="300" height="148" /></p>
<p>For better recognition, use manual focus of your camera.</p>
<p>Press link below to <strong>download the demo:</strong></p>
<div><a href="http://www.computer-vision-software.com/blog/wp-content/plugins/smartcounter/redirect.php?dcp_action=goto&dcp_id=2" target="_blank"><img alt="Download Rhonda Barcode Demo (Windows version)" border="0" src="http://www.computer-vision-software.com/blog/wp-content/plugins/smartcounter/download.jpg"></a><br />722 Downloads Since 2009-09-28</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=_jpQ13YAm_U:4BQxYELmuqY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=_jpQ13YAm_U:4BQxYELmuqY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=_jpQ13YAm_U:4BQxYELmuqY:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>I would like to represent an executable demo  which was described at  http://www.computer-vision-software.com/blog/2009/07/barcode-recognition/.
This is demo application for Rhonda barcode recognition library. It&amp;#8217;s cross-platform library written on C++ language. It was tested on ARM Cortex-A8, ARM11 and x86 platforms.
Average recognition time on 640&amp;#215;480 frames:
P4 &amp;#8211; 3GHz:  25ms

Program description:
main window:

Supported barcode’s types: EAN13, UPCA
SYSTEM REQUIREMENTS:
Recommended PC
Processor: Intel [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2009/10/barcode/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">2</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2009/10/barcode/</feedburner:origLink></item><item><title>Audience Measurement (face tracker, gender recognition, attention recognition, etc)</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/v4vEgbTulRk/</link><category>Demo</category><category>Demo video</category><category>Demo videos</category><category>OpenCV</category><category>YouTube</category><category>Demography</category><category>Demography classifier</category><category>face detection</category><category>Face tracker</category><category>Gender recognition</category><category>Object Tracking</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex</dc:creator><pubDate>Mon, 05 Oct 2009 01:23:13 PDT</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=91</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/cPEGXJAvy0Q&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/cPEGXJAvy0Q&amp;rel=0&amp;color1=0xd6d6d6&amp;color2=0xf0f0f0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></p>
<p><a href="http://www.computer-vision-software.com/files/videos/am-3.avi">am-3.avi</a></p>
<p>This is a demo video of Rhonda Audience Measurement system (MyAudience product, <a href="http://www.MyAudience.com">www.MyAudience.com</a>).</p>
<p><span id="more-91"></span></p>
<p>The system is able to recognize gender of a person. So, red rectangle is for a woman, dark blue rectangle is for a man. The quality of gender recognition algorithm is 90%.</p>
<p>The system works on Intel Atom: 10 fps and higher, and on Intel Pentium 4: 15 fps and higher. Besides, it is a cross-platform solution. It was tested on both Windows XP and Linux, and also it was tested on ARM Cortext-A8.</p>
<p>No accelerations (CUDA, fixed point, etc) are used! So, the solution has great potential for improvements.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=v4vEgbTulRk:Dl7RtoLOqTQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=v4vEgbTulRk:Dl7RtoLOqTQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=v4vEgbTulRk:Dl7RtoLOqTQ:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>am-3.avi
This is a demo video of Rhonda Audience Measurement system (MyAudience product, www.MyAudience.com).

The system is able to recognize gender of a person. So, red rectangle is for a woman, dark blue rectangle is for a man. The quality of gender recognition algorithm is 90%.
The system works on Intel Atom: 10 fps and higher, and on Intel Pentium [...]</description><enclosure url="http://www.computer-vision-software.com/files/videos/am-3.avi" length="26675290" type="video/x-msvideo" /><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2009/10/audience-measurement-face-tracker-gender-recognition-attention-recognition-etc/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">6</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2009/10/audience-measurement-face-tracker-gender-recognition-attention-recognition-etc/</feedburner:origLink></item><item><title>Cross-platform solution for getting MJPEG stream from AXIS ip-camera (AXIS 211M)</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/9_81EHuMci0/</link><category>OpenCV</category><category>ARM</category><category>IpCamera</category><category>IplImage</category><category>MJPEG</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Andrew Chen</dc:creator><pubDate>Sat, 29 Aug 2009 00:55:42 PDT</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=86</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<div style="text-align: left;">
<p style="text-align: left;">This paper describes how-to get MJPEG stream from AXIS ip-camera in your C++ application. My approach is a cross-platform solution and much better than solution from <a href="http://www.computer-vision-software.com/blog/2009/04/how-to-get-mjpeg-stream-from-axis-ip-cameras-axis-211m-and-axis-214-ptz-as-camera-device-in-opencv-using-directshow/">http://www.computer-vision-software.com/blog/2009/04/how-to-get-mjpeg-stream-from-axis-ip-cameras-axis-211m-and-axis-214-ptz-as-camera-device-in-opencv-using-directshow/</a>.</p>
<p><span id="more-86"></span></p>
<p><strong>Dependencies</strong></p>
<p>We used boost library (boost/asio, <a href="http://www.boost.org/">http://www.boost.org</a>). There are very useful network interfaces:</p>
<ul>
<li><span style="color: #003366;"><em><strong>boost::asio::io_service</strong>: </em><span style="color: #000000;">the </span></span>io_service class provides the core I/O functionality for users of the asynchronous I/O objects;</li>
<li><span style="color: #003366;"><strong><em>boost::asio::ip::tcp::socket</em></strong>: <span style="color: #000000;">the </span></span>socket class has a function that will retrieve the remote endpoint;</li>
<li><span style="color: #003366;"><strong><em>boost::asio::ip::tcp::resolver</em></strong>:</span> the resolver class init net-connection.</li>
</ul>
<p><strong>Network interface implementing</strong></p>
<p>I created few useful network functions over &#8221;boost::asio&#8221;: connecting, sending and receiving packets.</p>
<p>The network interface will be implemented via boost objects. Definitions are:</p>
<p><span style="color: #003366;"><em><strong>boost::asio::io_service</strong> m_ios;<br />
<strong>boost::asio::ip::tcp::socket</strong> m_socket(m_ios);<br />
<strong>boost::asio::ip::tcp::resolver</strong> m_resolver(m_ios);</em></span></p>
<p>So, the functions like:</p>
<pre class="python:nogutter">void connect(void)
{
    boost::asio::ip::tcp::resolver::iterator   end_point;
    boost::system::error_code                   ecode;
    boost::asio::ip::tcp::resolver::query     query(boost::asio::ip::tcp::v4(),
                                                                   “192.168.0.1”, “80”);

    end_point = m_resolver.resolve(query);
    m_socket.connect(*iterator, ecode);

    assert(!ecode);
}

int send(void *buffer, int buf_size)
{
    boost::system::error_code   ecode;
    boost::uint32_t                  sent_size = 0;

    sent_size = boost::asio::write(m_socket,
                                             boost::asio::buffer(buffer, buffer_size),
                                             boost::asio::transfer_all(),
                                             ecode);
    if(ecode)
        printf("socket write operation failed\n");

    return sent_size;
}

int receive(void *buffer, int buf_size)
{
    boost::system::error_code   ecode;
    int                                   received_size = 0;

    received_size = boost::asio::read(m_socket,
                                                  boost::asio::buffer(buffer, buffer_size),
                                                  boost::asio::transfer_at_least(1),
                                                  ecode);

    if(ecode)
        printf("socket read operation failed\n");

    return received_size;
}</pre>
<p>Also there is disconnect function, it is written in the same manner.</p>
<p><em>Note: this is reductive version of code for better interpretation. </em></p>
<p><strong>Getting JPEG frame from ip camera<br />
</strong></p>
<p>We should send request to the camera for getting mjpeg stream. The command like:</p>
<p><span style="color: #003366;"><em>“GET /axis-cgi/mjpg/video.cgi?resolution=&lt;width&gt;x&lt;height&gt;&amp;fps=&lt;fps&gt;\r\n\r\n”,</em></span></p>
<p>where:</p>
<ul>
<li><span style="color: #003366;"><em><strong>&lt;width&gt;</strong></em></span> &#8211; width of requested frame;</li>
<li><span style="color: #003366;"><em><strong>&lt;height&gt;</strong></em></span> &#8211; height of requested frame;</li>
<li><span style="color: #003366;"><em><strong>&lt;fps&gt;</strong></em></span> &#8211; the requested number of frames per second;</li>
<li><em><span style="color: #003366;"><strong>“\r\n\r\n</strong>”</span></em> – end marker of request.</li>
</ul>
<p>Example is:</p>
<p><span style="color: #003366;"><em>“GET /axis-cgi/mjpg/video.cgi?resolution=640&#215;480&amp;fps=15\r\n\r\n”</em></span></p>
<p>The device sends response: 183 bytes. We need to check the response to make sure that is ok.</p>
<p>E.g. successful response:</p>
<p><span style="color: #003366;"><em>“HTTP/1.0 200 OK\r\nCache-Control: no-cache\r\nPragma: no-cache\r\nExpires: Thu, 01 Dec 1994 16:00:00 GSM\r\nConnection: close\r\nContent-Type: multipart/x-mixed-replace; boundary=&#8211;myboundary”</em></span></p>
<p>E.g. unsuccessful response:</p>
<p><em><span style="color: #003366;">“HTTP/1.0 501 Not implemented\r\nDate: Sat, 29 Aug 2009 14:00:10 GSM\r\nAccept-Ranges: bytes\r\nConnection: close\r\n…”</span></em></p>
<p>As you can see, the successful response must contain <span style="color: #003366;"><em>“HTTP/1.0 200 OK”</em></span> string at beginning.</p>
<p>The value of “boundary” (<span style="color: #003366;"><em>“&#8211;myboundary”</em></span>) field is most important, because this string will be used as separator further.</p>
<p>The frame will be received part by part. The first packet size is 67 bytes it is meta-information. E.g.:</p>
<p><span style="color: #003366;"><em>“&#8211;myboundary\r\nContent-Type: image/jpeg\r\nContent-Length: 56296\r\n\r\n”</em></span></p>
<p><span style="color: #003366;"><em>“&#8211;myboundary”</em></span> string at the begin is confirmation of beginning of new frame. Also, we should read and save value of the field <span style="color: #003366;"><em>“Content-Length”</em></span> (56296). It is size of  compressed jpeg frame. The second and following packets are jpeg-picture essentially. We receive few packets with jpg data and save each packet to memory buffer and calculate total size of received packets, and if the total size is equal to value<em> </em>of <em><span style="color: #003366;">“Content-Length”</span></em>, it means that full picture is received and the memory buffer contains it. Now, you can save the memory buffer to the disc-storage (into “123.jpg” file e.g.), and open it with any graphic-viewer and make sure that is usual jpg image.</p>
<p>Note: the jpeg picture should contain the end marker<span style="color: #003366;"><em> “\r\n”</em></span> (2 bytes), so I recommend you to receive 2 bytes more.</p>
<p>Next frame can be received with the same aproach: the first package size is 67 bytes…</p>
<p>Note:  symbols <span style="color: #003366;"><em>“\r\n”</em></span> – 2 byte 0&#215;0A and 0&#215;0D accordingly.</p>
<p>Also, I recommend to develop separated thread for getting JPG frames from ip camera in order to avoid losing of connection&#8230;</p>
<p>We tested this solution under MS Windows, Linux, Intel P4 and also under Intel Atom and ARM Cortex-A8. All works fine.</p>
<p>We are using this approach in my module which decodes each JPG frame from Axis camera and convertes it to OpenCV IplImage (BGR frame).</p>
<p>P.S. Besides, we developed solutions for Arecont and ACTi ip-cameras. Sure, the implementations are different, but common idea is the same.</p>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=9_81EHuMci0:lILI1r0Mbm4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=9_81EHuMci0:lILI1r0Mbm4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=9_81EHuMci0:lILI1r0Mbm4:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>This paper describes how-to get MJPEG stream from AXIS ip-camera in your C++ application. My approach is a cross-platform solution and much better than solution from http://www.computer-vision-software.com/blog/2009/04/how-to-get-mjpeg-stream-from-axis-ip-cameras-axis-211m-and-axis-214-ptz-as-camera-device-in-opencv-using-directshow/.

Dependencies
We used boost library (boost/asio, http://www.boost.org). There are very useful network interfaces:

boost::asio::io_service: the io_service class provides the core I/O functionality for users of the asynchronous I/O objects;
boost::asio::ip::tcp::socket: the socket class [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2009/08/cross-platform-solution-for-getting-mjpeg-stream-from-axis-ip-camera-axis-211m/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">2</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2009/08/cross-platform-solution-for-getting-mjpeg-stream-from-axis-ip-camera-axis-211m/</feedburner:origLink></item></channel></rss>
