<?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>Mon, 09 Aug 2010 17:43:24 PDT</lastBuildDate><generator>http://wordpress.org/?v=3.0.1</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>Currency recognition using cortex-like model.</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/s0SwubVFOak/</link><category>Currency recognition</category><category>HMAX</category><category>Object Recognition</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Igor Stepura</dc:creator><pubDate>Mon, 09 Aug 2010 00:05:18 PDT</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=125</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Currency recognition seems to be one of the popular topic in &#8220;applied&#8221; computer vision. There are a lot of  articles, blog entries describing different approaches to currency recognition. In this post I&#8217;ll share my experience of using so-called HMAX model.</p>
<p><span id="more-125"></span></p>
<p><strong>Introduction</strong></p>
<p>HMAX aims to model hierarchical object recognition in cortex. I won&#8217;t get into details of HMAX model, just provide some useful links for curious readers:<br />
<a href=" http://riesenhuberlab.neuro.georgetown.edu/hmax.html"></p>
<p>http://riesenhuberlab.neuro.georgetown.edu/hmax.html</a></p>
<p><a href="http://cbcl.mit.edu/cbcl/publications/index-pubs.html">http://cbcl.mit.edu/cbcl/publications/index-pubs.html</a></p>
<p>My approach in using HMAX for currency recognition was pretty simple.</p>
<p>1. Generate proper С1-feature dictionary<br />
2. Using C1-feature dictionary, generate C2 vectors for images in training dataset<br />
3. Train multi-class SVM classifier using C2 vectors.<br />
4. Test classifier on testing dataset<br />
5. PROFIT</p>
<p><strong>C1 dictionary generation</strong><br />
My initial approach was to generate dictionary automatically using an &#8220;interesting point&#8221; detector and then generate C-1 patches of size corresponding to the size of detected image structure. Hessian-Laplace (see Mikolajczyk K. and Schmid, C. 2004. ) method seemed to suit well for this task, since it  detects characteristic scale of interesting points. My implementation of Hessian-Laplace worked reasonable fine, however number of interesting points it detected was big, so it was pretty hard for my C1 extractor to decide which one of these points was really &#8220;interesting&#8221; for currency recognition.<br />
As a result &#8211; none of my automatically generated dictionaries (which contained about 1000 samples) produce suitable classification outputs.</p>
<p>So I decided to start from smaller dictionary, which would contain hand-picked, really descriptive patches from all kind of bills. For each image in C1 dataset I took 8 patches ( see example of pacthes below). All images in C1 dataset were resized to have width 300 pixels. Size of C1 dictionary now became 88. </p>
<p><a href="http://www.computer-vision-software.com/blog/wp-content/uploads/2010/08/1_face_000.bmp"><img src="http://www.computer-vision-software.com/blog/wp-content/uploads/2010/08/1_face_000.bmp" alt="" title="1_face_000" class="aligncenter size-full wp-image-126" /></a></p>
<p><strong>Classifier training</strong><br />
The size of my training dataset was 337 images of different dollar bills of all classes (1 to 100) + set of &#8220;background&#8221; images.</p>
<p>I used LibSVM for classifier training and testing, using RBF and Linear classifier kernels.</p>
<p>To train models with RBF kernels I used script easy.py from LibSVM &#8211; this handy script automatically scales training data and the searches for the best C/gamma parameters of the kernel.<br />
Linear classifiers were trained using semi-automated approach &#8211; I scaled training data first, then used grid.py to find best value for C parameter of the kernel. </p>
<p>Something like that:<br />
 <code>svm-scale -s newdict.range newdict.l > newdict.scale</p>
<p>./grid.py -log2g 1,1,1 -log2c -5,15,0.5 -t 0 newdict.scale</p>
<p>svm-train -t 0 -c 0.353553390593 newdict.scale newdict.model</code></p>
<p>And for testing:<br />
<code>svm-scale -r newdict.range newdict.t > newdict.t.scale</p>
<p>svm-predict newdict.t.scale newdict.model newdict.model.predict</code></p>
<p><strong>Experiment results</strong></p>
<p>Best classification accuracy I&#8217;ve reached so far is <strong>88.62%</strong> using linear classifier. </p>
<p><strong>Conclusions and future work</strong></p>
<p>HMAX model has proved successful in classification of currency images and seem to have potential for better results.</p>
<p>Possible directions toward better classification could be:<br />
1. Brightness correction. HMAX implementation I used seems to be pretty sensitive to brightness changes. I&#8217;ll need to investigate this more deeply and if necessary &#8211; normalize trainig/testing images to get rid of brightness-related issues.</p>
<p>2. Quality of C1-dictionary. While my current dictionary proved to be good enough to recognize dollar bill classes, I suppose it could be improved. For example &#8211; data there could be more patches per bill class, taken for different layers (bands) of C1 &#8220;pyramid&#8221;. The size of the features may also vary to achieve better results.</p>
<p>3. HMAX model tuning. Perhaps model modification according to approach of Jim Mutch и David G. Lowe (<a href="http://www.cs.ubc.ca/~lowe/papers/08mutch.pdf"> PDF</a>) would give better recognition results.</p>
<p>4. Use Ada-Boost in addition to SVM for better model training.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=s0SwubVFOak:-I-cYSf8WaM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=s0SwubVFOak:-I-cYSf8WaM:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=s0SwubVFOak:-I-cYSf8WaM:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>Currency recognition seems to be one of the popular topic in &amp;#8220;applied&amp;#8221; computer vision. There are a lot of articles, blog entries describing different approaches to currency recognition. In this post I&amp;#8217;ll share my experience of using so-called HMAX model. Introduction HMAX aims to model hierarchical object recognition in cortex. I won&amp;#8217;t get into details [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2010/08/currency-recognition-using-cortex-like-model/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/08/currency-recognition-using-cortex-like-model/</feedburner:origLink></item><item><title>Compiling OpenCV for Android using NDK 3</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/tdyTVHkBuQU/</link><category>OpenCV</category><category>Android</category><category>ARM</category><category>face detection</category><category>NDK</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">apermyakov</dc:creator><pubDate>Wed, 21 Apr 2010 23:01:50 PDT</pubDate><guid isPermaLink="false">http://www.computer-vision-software.com/blog/?p=116</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p><a href="http://www.computer-vision-software.com/blog/wp-content/uploads/2010/04/Picture-18.jpg"></a></p>
<p>Build platform: Ubuntu 9.10<br />
Target platform: Android</p>
<p><strong>Download and prepare OpenCV library source code. </strong></p>
<p><strong>1. </strong>Download the latest version of OpenCV (<a href="http://sourceforge.net/project/showfiles.php?group_id=22870" target="_blank">http://sourceforge.net/project/showfiles.php?group_id=22870</a>).</p>
<p>2. As build platform is Linux, select linux version (for example<em> OpenCV2.1.0.tat.bz</em>).</p>
<p><span id="more-116"></span></p>
<p><strong>3. </strong>Unpack somewhere to home dir.</p>
<p><strong>Download and prepare cross-compiler</strong></p>
<p><strong><span style="font-weight: normal;">1. Download Android NDK 3 for Linux (<a href="http://developer.android.com/sdk/ndk/index.html" target="_blank">http://developer.android.com/sdk/ndk/index.html</a>)</span></strong></p>
<p><strong><span style="font-weight: normal;">2. Unpack it to <em>~/android_ndk_3/</em></span></strong></p>
<p><strong><span style="font-weight: normal;"><em><span style="font-style: normal;"><strong>3. </strong>Then run <em>~/android_ndk_3/build/host-setup.sh</em> but first fix the error in line 119</span></em></span></strong></p>
<p><strong><span style="font-weight: normal;"><em><span style="font-style: normal;">Change</span></em></span></strong></p>
<p><strong><span style="font-weight: normal;"><em><span style="font-style: normal;">if [ "$result" = "Pass" ] ; then</span></em></span></strong></p>
<p><strong><span style="font-weight: normal;"><em><span style="font-style: normal;">to</span></em></span></strong></p>
<p><strong><span style="font-weight: normal;"><em><span style="font-style: normal;">if [ "$result" == "Pass" ] ; then</span></em></span></strong></p>
<p><strong><span style="font-weight: normal;"><em><span style="font-style: normal;"><strong>4. </strong>Do/install whatever needed to let host-setup.sh complete successful.</span></em></span></strong></p>
<p><strong>Create NDK project/Modify Makefiles</strong></p>
<p>There is one big issue with NKD toolchein. It has trimmed stdc library which does not contain STL. Because of that some files (like <em>cvkdtree.cpp</em> in cv) can not be compiled since they use vector, list and other stuff. The solution is to compile STL from source code. In my OpenCV NDK project I used STL sources from uClibc (<a href="http://www.uclibc.org" target="_blank">http://www.uclibc.org</a>).</p>
<p>The simpliest way to start your OpenCV NDK project is to update <em>hello-jni</em> project with OpenCV source files.</p>
<p>The <em>~/android_ndk_3/apps/hello-jni/project/jni</em> folder of hello-jni project may look like this</p>
<ol>cv<br />
- hdr<br />
- src<br />
cvaux<br />
- hdr<br />
- src<br />
cxcore<br />
- hdr<br />
- src<br />
stl<br />
- hdr<br />
- src<br />
Android.mk<br />
hello-jni.c</ol>
<p>The <em>~/android_ndk_3/apps/hello-jni/project/jni/Android.mk</em> may looks like this</p>
<ol>APPS_PATH := $(call my-dir)############################<br />
# stl<br />
############################<br />
include $(CLEAR_VARS)LOCAL_PATH := $(APPS_PATH)/stl/src<br />
LOCAL_C_INCLUDES := $(APPS_PATH)/stl/hdrLOCAL_MODULE := stl<br />
LOCAL_SRC_FILES := string.cpp algorithm.cpp char_traits.cpp iterator.cpp limits.cpp list.cpp vector.cppinclude $(BUILD_STATIC_LIBRARY)############################<br />
# cxcore<br />
############################<br />
include $(CLEAR_VARS)LOCAL_PATH := $(APPS_PATH)/cxcore/src<br />
LOCAL_C_INCLUDES := $(APPS_PATH)/cxcore/hdrLOCAL_CXXFLAGS := -DHAVE_CONFIG_HLOCAL_MODULE := cxcore<br />
LOCAL_SRC_FILES := cxalloc.cpp cxarithm.cpp cxarray.cpp cxcmp.cpp cxconvert.cpp cxcopy.cpp cxdatastructs.cpp cxdrawing.cpp cxdxt.cpp cxerror.cpp cximage.cpp cxjacobieigens.cpp cxlogic.cpp cxlut.cpp cxmathfuncs.cpp cxmatmul.cpp cxmatrix.cpp cxmean.cpp cxmeansdv.cpp cxminmaxloc.cpp cxnorm.cpp cxouttext.cpp cxpersistence.cpp cxprecomp.cpp cxrand.cpp cxsumpixels.cpp cxsvd.cpp cxswitcher.cpp cxtables.cpp cxutils.cpp dummy.cppinclude $(BUILD_STATIC_LIBRARY)############################<br />
# cv<br />
############################<br />
include $(CLEAR_VARS)</p>
<p>LOCAL_PATH := $(APPS_PATH)/cv/src<br />
LOCAL_C_INCLUDES := $(APPS_PATH)/cv/hdr $(APPS_PATH)/cxcore/hdr $(APPS_PATH)/stl/hdr</p>
<p>LOCAL_MODULE := cv<br />
LOCAL_SRC_FILES := cvkdtree.cpp cvaccum.cpp cvadapthresh.cpp cvapprox.cpp cvcalccontrasthistogram.cpp cvcalcimagehomography.cpp cvcalibinit.cpp cvcalibration.cpp cvcamshift.cpp cvcanny.cpp cvcolor.cpp cvcondens.cpp cvcontours.cpp cvcontourtree.cpp cvconvhull.cpp cvcorner.cpp cvcornersubpix.cpp cvderiv.cpp cvdistransform.cpp cvdominants.cpp cvemd.cpp cvfeatureselect.cpp cvfilter.cpp cvfloodfill.cpp cvfundam.cpp cvgeometry.cpp cvhaar.cpp cvhistogram.cpp cvhough.cpp cvimgwarp.cpp cvinpaint.cpp cvkalman.cpp cvlinefit.cpp cvlkpyramid.cpp cvmatchcontours.cpp cvmoments.cpp cvmorph.cpp cvmotempl.cpp cvoptflowbm.cpp cvoptflowhs.cpp cvoptflowlk.cpp cvpgh.cpp cvposit.cpp cvprecomp.cpp cvpyramids.cpp cvpyrsegmentation.cpp cvrotcalipers.cpp cvsamplers.cpp cvsegmentation.cpp cvshapedescr.cpp cvsmooth.cpp cvsnakes.cpp cvstereobm.cpp cvstereogc.cpp cvsubdivision2d.cpp cvsumpixels.cpp cvsurf.cpp cvswitcher.cpp cvtables.cpp cvtemplmatch.cpp cvthresh.cpp cvundistort.cpp cvutils.cpp dummy.cpp</p>
<p>LOCAL_STATIC_LIBRARIES := cxcore stl</p>
<p>include $(BUILD_STATIC_LIBRARY)</p>
<p>############################<br />
# cvaux<br />
############################<br />
include $(CLEAR_VARS)</p>
<p>LOCAL_PATH := $(APPS_PATH)/cvaux/src<br />
LOCAL_C_INCLUDES := $(APPS_PATH)/cvaux/hdr $(APPS_PATH)/cv/hdr $(APPS_PATH)/cv/src $(APPS_PATH)/cxcore/hdr $(APPS_PATH)/stl/hdr</p>
<p>LOCAL_MODULE := cvaux<br />
LOCAL_SRC_FILES := camshift.cpp cvaux.cpp cvauxutils.cpp cvbgfg_acmmm2003.cpp cvbgfg_codebook.cpp cvbgfg_common.cpp cvbgfg_gaussmix.cpp cvcalibfilter.cpp cvclique.cpp cvcorrespond.cpp cvcorrimages.cpp cvcreatehandmask.cpp cvdpstereo.cpp cveigenobjects.cpp cvepilines.cpp cvface.cpp cvfacedetection.cpp cvfacetemplate.cpp cvfindface.cpp cvfindhandregion.cpp cvhmm.cpp cvhmm1d.cpp cvhmmobs.cpp cvlcm.cpp cvlee.cpp cvlevmar.cpp cvlevmarprojbandle.cpp cvlevmartrif.cpp cvlines.cpp cvlmeds.cpp cvmat.cpp cvmorphcontours.cpp cvmorphing.cpp cvprewarp.cpp cvscanlines.cpp cvsegment.cpp cvsubdiv2.cpp cvtexture.cpp cvtrifocal.cpp cvvecfacetracking.cpp cvvideo.cpp decomppoly.cpp dummy.cpp enmin.cpp extendededges.cpp precomp.cpp vs/bgfg_estimation.cpp vs/blobtrackanalysis.cpp vs/blobtrackanalysishist.cpp vs/blobtrackanalysisior.cpp vs/blobtrackanalysistrackdist.cpp vs/blobtrackgen1.cpp vs/blobtrackgenyml.cpp vs/blobtrackingauto.cpp vs/blobtrackingcc.cpp vs/blobtrackingccwithcr.cpp vs/blobtrackingkalman.cpp vs/blobtrackinglist.cpp vs/blobtrackingmsfg.cpp vs/blobtrackingmsfgs.cpp vs/blobtrackpostprockalman.cpp vs/blobtrackpostproclinear.cpp vs/blobtrackpostproclist.cpp vs/enteringblobdetection.cpp vs/enteringblobdetectionreal.cpp vs/testseq.cpp</p>
<p># failed to compile<br />
#cv3dtracker.cpp</p>
<p>LOCAL_STATIC_LIBRARIES := cv cxcore stl</p>
<p>include $(BUILD_STATIC_LIBRARY)</ol>
<p>The <em>~/android_ndk_3/apps/hello-jni/Application.mk</em> file needs to be updated as follows</p>
<ol>APP_PROJECT_PATH := $(call my-dir)/project<br />
APP_MODULES      := stl cxcore cv cvaux hello-jni</ol>
<p>To build the project go to <em>~/android_ndk_3</em> and type</p>
<ol>make APP=hello-jni</ol>
<p>Of course there will be compile issues. Understand and fix them. Easiest cases are related to syntax mismatch between different compilers. In more complicated cases some code should be commented out. For example usage of libs with optimizations for Intel processor is not needed for ARM.</p>
<p>HighGui is also can be built but only partially. Simply remove files that causing problems from Android.mk. In my case the rest of files were enough to use cvLoadImage function for bmp file.</p>
<p><strong>Running facedetect openCV example</strong></p>
<p>There is no way to run native C code as separate application on Android. Instead native C functions can be called from Java apps. Because of that I made native function FaceDetect using OpenCV example application facedetect.c.</p>
<p>The declaration looks like this</p>
<ol>void<br />
Java_com_example_hellojni_HelloJni_FaceDetect( JNIEnv* env, jobject thiz, jbyteArray jyuv_buff, int w, int h, jbyteArray jbgra_buff)<br />
{<br />
&#8230;<br />
}</ol>
<p>This function takes YUV_NV21 buffer (preview from camera captured by Java app), converts it to BGRA8888, searches the faces, draws circles around the faces and returns updated RGBA8888 buffer back to Java app. Java app can draw it on the screen.</p>
<p style="text-align: center;"><a href="http://www.computer-vision-software.com/blog/wp-content/uploads/2010/04/Picture-18.jpg"><img class="aligncenter" title="Picture 18" src="http://www.computer-vision-software.com/blog/wp-content/uploads/2010/04/Picture-18-300x225.jpg" alt="" width="300" height="225" /></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=tdyTVHkBuQU:onDSSI_ouiI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?a=tdyTVHkBuQU:onDSSI_ouiI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ComputerVisionSoftware?i=tdyTVHkBuQU:onDSSI_ouiI:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded><description>Build platform: Ubuntu 9.10 Target platform: Android Download and prepare OpenCV library source code. 1. Download the latest version of OpenCV (http://sourceforge.net/project/showfiles.php?group_id=22870). 2. As build platform is Linux, select linux version (for example OpenCV2.1.0.tat.bz). 3. Unpack somewhere to home dir. Download and prepare cross-compiler 1. Download Android NDK 3 for Linux (http://developer.android.com/sdk/ndk/index.html) 2. Unpack it [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.computer-vision-software.com/blog/2010/04/android/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/2010/04/android/</feedburner:origLink></item><item><title>People counting with top-mounted camera</title><link>http://feedproxy.google.com/~r/ComputerVisionSoftware/~3/KxLK6CWZ8OU/</link><category>Demo</category><category>Demo video</category><category>Demo videos</category><category>YouTube</category><category>Object Tracking</category><category>OpenCV</category><category>People counting</category><category>video</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rhondasw</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>
<p><a title="people_counter.avi" href="http://www.computer-vision-software.com/files/videos/people_counter.avi">people_counter.avi</a></p>
<p>Marketing researches are area where required to analyze a lot of data. E.g. we want to understand how many people are visiting a bank. In order to count this value, we need to count each man or woman which are entering to or exiting from the bank. For resolving this task there are a lot of approaches: e.g. use special gate with laser or mechanical counter. Though there are people counting tasks where such approaches cannot work or too unuseful. E.g. barrier cannot be used where people flow is very high, and laser counters have limitations as well.</p>
<p>Opposite the approaches above, we found papers where top-mounted camera is used for resolving the people counting task.</p>
<p><span id="more-114"></span></p>
<p> The fact is that most of organization have own IP or CCTV camera based security infrastructure. And also often there is a camera which is already top-mounted. Thus top-mounted camera counting approach is looked very perspective from reusing infrastructure point of view.</p>
<p>We researched a lot of approaches. There are a lot of ready methods for people counting with top-mounted camera. But such methods either are patented or don’t meet our expectation in quality or speed. Thus we developed own method (see demo video).</p>
<p>Method counts human each time they cross a predefined counting line (that is why it is often called as “line-crossing”). The assumption is that the line should be selected orthogonally to the main people flow.</p>
<p>Now we skip implementation details of the method. If shortly, our method is a real time 15 fps+, we tested it usual USB or IP cameras. We tested our method in indoor and outdoor use-case and the quality is 80-90% (dependent on environment condition).</p>
<p>Our method can be used in other applications, e.g. vehicle counting, you could look at the video how it works. Have a nice watching&#8230;</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>people_counter.avi Marketing researches are area where required to analyze a lot of data. E.g. we want to understand how many people are visiting a bank. In order to count this value, we need to count each man or woman which are entering to or exiting from the bank. For resolving this task there are a lot [...]</description><enclosure url="http://www.computer-vision-software.com/files/videos/people_counter.avi" length="23698432" type="video/x-msvideo" /><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/">2</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 [...]</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/">9</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/">6</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 [...]</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/">53</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/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="nonatt" title="nonatt" /></a>
<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="attention" title="attention" /></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. [...]</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 />1604 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 [...]</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/">3</slash:comments><feedburner:origLink>http://www.computer-vision-software.com/blog/2009/10/barcode/</feedburner:origLink></item></channel></rss>
