<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Damiles &#187; featured</title>
	<atom:link href="http://blog.damiles.com/tag/featured/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.damiles.com</link>
	<description>Blender, OpenCV, OpenCV, Tutorials and more...</description>
	<lastBuildDate>Mon, 11 Feb 2013 13:36:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Mastering OpenCV with Practical Computer Vision Projects</title>
		<link>http://blog.damiles.com/2012/12/mastering-opencv-with-practical-computer-vision-projects/</link>
		<comments>http://blog.damiles.com/2012/12/mastering-opencv-with-practical-computer-vision-projects/#comments</comments>
		<pubDate>Tue, 18 Dec 2012 08:08:12 +0000</pubDate>
		<dc:creator>damiles</dc:creator>
				<category><![CDATA[books]]></category>
		<category><![CDATA[OpenCV]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[featured]]></category>

		<guid isPermaLink="false">http://blog.damiles.com/?p=369</guid>
		<description><![CDATA[Announcing the new &#8220;Mastering OpenCV&#8221; book that I co-authored! The book &#8220;Mastering OpenCV with Practical Computer Vision Projects&#8221; is now for sale from Packt Publishing with free shipping to many countries! Each chapter is a separate project containing step-by-step tutorials + full source-code using the latest C++ interface of OpenCV v2.4, written by 7 authors [...]]]></description>
			<content:encoded><![CDATA[<p>Announcing the new &#8220;Mastering OpenCV&#8221; book that I co-authored!</p>
<p>The book &#8220;Mastering OpenCV with Practical Computer Vision Projects&#8221; is now for sale from Packt Publishing with free shipping to many countries! Each chapter is a separate project containing step-by-step tutorials + full source-code using the latest C++ interface of OpenCV v2.4, written by 7 authors that are well-known among the OpenCV community for their blogs &amp; open-source projects.</p>
<p>Chapters (each is a project with full source-code):<br />
- Cartoonifier and Skin Changer for Android.<br />
- Marker-based Augmented Reality on iPhone or iPad.<br />
- Marker-less Augmented Reality.<br />
- Exploring Structure from Motion using OpenCV.<br />
- Number Plate Recognition using SVM and Neural Networks.<br />
- Non-rigid Face Tracking.<br />
- 3D Head Pose Estimation using AAM and POSIT.<br />
- Face Recognition using Eigenfaces or Fisherfaces.<br />
- Developing Fluid Wall using the Microsoft Kinect.</p>
<p>Authors (in alphabetical order):<br />
- Daniel Lélis Baggio (&#8220;<a href="http://code.google.com/p/ehci/">http://code.google.com/p/ehci/</a>&#8220;)<br />
- Shervin Emami (&#8220;<a href="http://www.shervinemami.info/openCV.html">http://www.shervinemami.info/openCV.html</a>&#8220;)<br />
- David Millán Escrivá (&#8220;<a href="http://blog.damiles.com/">http://blog.damiles.com/</a>&#8220;)<br />
- Khvedchenia Ievgen (&#8220;<a href="http://computer-vision-talks.com/">http://computer-vision-talks.com/</a>&#8220;)<br />
- Naureen Mahmood (&#8220;<a href="http://howdweknows.blogspot.com/">http://howdweknows.blogspot.com/</a>&#8220;)<br />
- Jason Saragih (&#8220;<a href="http://jsaragih.org/">http://jsaragih.org/</a>&#8220;)<br />
- Roy Shilkrot (&#8220;<a href="http://www.morethantechnical.com/">http://www.morethantechnical.com/</a>&#8220;)</p>
<p>The book can be purchased from &#8220;<a href="http://www.packtpub.com/cool-projects-with-opencv/book">http://www.packtpub.com/cool-projects-with-opencv/book</a>&#8221; either as a physical book or as a PDF eBook.</p>
<p>The latest code can be downloaded from &#8220;<a href="https://github.com/MasteringOpenCV/code">https://github.com/MasteringOpenCV/code</a>&#8220;, including a screenshot of each project (scroll down on the front page).</p>
<p>Note: You should already have basic experience with OpenCV and C/C++ before reading this book, as this book does not explain the basics of OpenCV and it assumes you already have it installed. For example, you could read the &#8220;Learning OpenCV&#8221; book and/or the &#8220;OpenCV 2 Cookbook&#8221; to learn the basics of OpenCV, then read this &#8220;Mastering OpenCV&#8221; book for more advanced skills and project ideas!<img class="alignnone" title="Mastering OpenCV with practical computer vision projects" src="http://www.packtpub.com/sites/default/files/7829OS_Mastering%20OpenCV%20with%20Practical%20Computer%20Vision%20Projects.jpg" alt="Mastering OpenCV with practical computer vision projects" width="500" height="617" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.damiles.com/2012/12/mastering-opencv-with-practical-computer-vision-projects/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Basic OCR in OpenCV</title>
		<link>http://blog.damiles.com/2008/11/basic-ocr-in-opencv/</link>
		<comments>http://blog.damiles.com/2008/11/basic-ocr-in-opencv/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 19:59:29 +0000</pubDate>
		<dc:creator>damiles</dc:creator>
				<category><![CDATA[OpenCV]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[knn]]></category>
		<category><![CDATA[ocr]]></category>

		<guid isPermaLink="false">http://blog.damiles.com/?p=93</guid>
		<description><![CDATA[Demo Source from GitHub In this tutorial we go to create a basic number OCR. It consist to classify a handwrite number into his class. To do it, we go to use all we learn in before tutorials, we go to use a simple basic painter and the basic pattern recognition and classification with openCV [...]]]></description>
			<content:encoded><![CDATA[<p><a class="download" title="Demo Source Basic OCR" href="https://github.com/damiles/basicOCR" target="_blank">Demo Source from GitHub</a></p>
<p>In this tutorial we go to create a basic number OCR. It consist to classify a handwrite number into his class.</p>
<p>To do it, we go to use all we learn in before tutorials, we go to use a simple <a title="Basic Painter" href="http://blog.damiles.com/?p=72" target="_blank">basic painter</a> and <a title="pattern recognition" href="http://blog.damiles.com/?p=84" target="_blank">the basic pattern recognition and classification with openCV</a> tutorial.</p>
<p>In a typical pattern recognition classifier consist in three modules:</p>
<p style="text-align: center;"><a href="http://blog.damiles.com/wp-content/uploads/2008/11/pr.gif"><img class="aligncenter size-full wp-image-94" title="Pattern recognition modules" src="http://blog.damiles.com/wp-content/uploads/2008/11/pr.gif" alt="" width="400" height="600" /></a></p>
<p><span id="more-93"></span>Preprocessing: in this module we go to process our input image, for example size normalize, convert color to BN&#8230;</p>
<p>Feature extraction: in this module we convert our image processed to a characteristic vector of features to classify, it can be the pixels matrix convert to vector or get contour chain codes data representation</p>
<p>Classification module get the feature vectors and train our system or classify an input feature vector with a classify method as knn.</p>
<p>In this basic OCR we go to use this graph:</p>
<p style="text-align: center;"><a href="http://blog.damiles.com/wp-content/uploads/2008/11/knnc-graph.jpg"><img class="aligncenter size-full wp-image-95" title="knnc-graph" src="http://blog.damiles.com/wp-content/uploads/2008/11/knnc-graph.jpg" alt="" width="400" height="500" /></a></p>
<p>Where we get a train set and test set of image to train and test our classifier method (knn)</p>
<p>We have a 1000 handwrite images, 100 images of each number. We get 50 images of each number (class) to train and other 50 to test our system.</p>
<p style="text-align: center;"><a href="http://blog.damiles.com/wp-content/uploads/2008/11/numbers.gif"><img class="aligncenter size-full wp-image-97" title="numbers" src="http://blog.damiles.com/wp-content/uploads/2008/11/numbers.gif" alt="" width="400" height="400" /></a></p>
<p>Then the first work we do is pre-process all train image, to do it we create a preprocessing function. In this function we get a image and a new width and height we want as result of preprocessing, then the function return a normalized size with bounding box image. You can see more clear the process in this graph:</p>
<p style="text-align: center;"><a href="http://blog.damiles.com/wp-content/uploads/2008/11/preprocesing.gif"><img class="aligncenter size-full wp-image-100" title="preprocesing" src="http://blog.damiles.com/wp-content/uploads/2008/11/preprocesing.gif" alt="" width="400" height="600" /></a></p>
<p>Pre-processing code:</p>
<pre class="brush: cpp;">
void findX(IplImage* imgSrc,int* min, int* max){
int i;
int minFound=0;
CvMat data;
CvScalar maxVal=cvRealScalar(imgSrc-&gt;width * 255);
CvScalar val=cvRealScalar(0);
//For each col sum, if sum &lt; width*255 then we find the min
//then continue to end to search the max, if sum&lt; width*255 then is new max
for (i=0; i&lt; imgSrc-&gt;width; i++){
cvGetCol(imgSrc, &amp;data, i);
val= cvSum(&amp;data);
if(val.val[0] &lt; maxVal.val[0]){
*max= i;
if(!minFound){
*min= i;
minFound= 1;
}
}
}
}

void findY(IplImage* imgSrc,int* min, int* max){
int i;
int minFound=0;
CvMat data;
CvScalar maxVal=cvRealScalar(imgSrc-&gt;width * 255);
CvScalar val=cvRealScalar(0);
//For each col sum, if sum &lt; width*255 then we find the min
//then continue to end to search the max, if sum&lt; width*255 then is new max
for (i=0; i&lt; imgSrc-&gt;height; i++){
cvGetRow(imgSrc, &amp;data, i);
val= cvSum(&amp;data);
if(val.val[0] &lt; maxVal.val[0]){
*max=i;
if(!minFound){
*min= i;
minFound= 1;
}
}
}
}
CvRect findBB(IplImage* imgSrc){
CvRect aux;
int xmin, xmax, ymin, ymax;
xmin=xmax=ymin=ymax=0;

findX(imgSrc, &amp;xmin, &amp;xmax);
findY(imgSrc, &amp;ymin, &amp;ymax);

aux=cvRect(xmin, ymin, xmax-xmin, ymax-ymin);

//printf(&quot;BB: %d,%d - %d,%d\n&quot;, aux.x, aux.y, aux.width, aux.height);

return aux;

}

IplImage preprocessing(IplImage* imgSrc,int new_width, int new_height){
IplImage* result;
IplImage* scaledResult;

CvMat data;
CvMat dataA;
CvRect bb;//bounding box
CvRect bba;//boundinb box maintain aspect ratio

//Find bounding box
bb=findBB(imgSrc);

//Get bounding box data and no with aspect ratio, the x and y can be corrupted
cvGetSubRect(imgSrc, &amp;data, cvRect(bb.x, bb.y, bb.width, bb.height));
//Create image with this data with width and height with aspect ratio 1
//then we get highest size betwen width and height of our bounding box
int size=(bb.width&gt;bb.height)?bb.width:bb.height;
result=cvCreateImage( cvSize( size, size ), 8, 1 );
cvSet(result,CV_RGB(255,255,255),NULL);
//Copy de data in center of image
int x=(int)floor((float)(size-bb.width)/2.0f);
int y=(int)floor((float)(size-bb.height)/2.0f);
cvGetSubRect(result, &amp;dataA, cvRect(x,y,bb.width, bb.height));
cvCopy(&amp;data, &amp;dataA, NULL);
//Scale result
scaledResult=cvCreateImage( cvSize( new_width, new_height ), 8, 1 );
cvResize(result, scaledResult, CV_INTER_NN);

//Return processed data
return *scaledResult;

}</pre>
<p>We use the function getData of basicOCR class to create the train data and train classes, this function get all images under OCR folder to create this train data, the OCR forlder is structured with 1 folder to each class and each file have are pbm files with this name cnn.pbm where c is the class {0..9} and nn is the number of image {00..99}</p>
<p>Each image we get is pre-processed and then convert the data in a feature vector we use.</p>
<p>basicOCR.cpp getData code:</p>
<pre class="brush: cpp;">
void basicOCR::getData()
{
IplImage* src_image;
IplImage prs_image;
CvMat row,data;
char file[255];
int i,j;
for(i =0; i&lt;classes; i++){
for( j = 0; j&lt; train_samples; j++){

//Load file
if(j&lt;10)
sprintf(file,&quot;%s%d/%d0%d.pbm&quot;,file_path, i, i , j);
else
sprintf(file,&quot;%s%d/%d%d.pbm&quot;,file_path, i, i , j);
src_image = cvLoadImage(file,0);
if(!src_image){
printf(&quot;Error: Cant load image %s\n&quot;, file);
//exit(-1);
}
//process file
prs_image = preprocessing(src_image, size, size);

//Set class label
cvGetRow(trainClasses, &amp;row, i*train_samples + j);
cvSet(&amp;row, cvRealScalar(i));
//Set data
cvGetRow(trainData, &amp;row, i*train_samples + j);

IplImage* img = cvCreateImage( cvSize( size, size ), IPL_DEPTH_32F, 1 );
//convert 8 bits image to 32 float image
cvConvertScale(&amp;prs_image, img, 0.0039215, 0);

cvGetSubRect(img, &amp;data, cvRect(0,0, size,size));

CvMat row_header, *row1;
//convert data matrix sizexsize to vecor
row1 = cvReshape( &amp;data, &amp;row_header, 0, 1 );
cvCopy(row1, &amp;row, NULL);
}
}
}</pre>
<p>After processed and get train data and classes whe then train our model with this data, in our sample we use knn method then:</p>
<pre class="brush: cpp;">knn=new CvKNearest( trainData, trainClasses, 0, false, K );</pre>
<p>Then we now can test our model, and we can use the test result to compare to another methods we can use, or if we reduce the image scale or similar. There are a function to create the test in our basicOCR class, test function.</p>
<p>This function get the other 500 samples and classify this in our selected method and check the obtained result.</p>
<pre class="brush: cpp;">void basicOCR::test(){
IplImage* src_image;
IplImage prs_image;
CvMat row,data;
char file[255];
int i,j;
int error=0;
int testCount=0;
for(i =0; i&lt;classes; i++){
for( j = 50; j&lt; 50+train_samples; j++){

sprintf(file,&quot;%s%d/%d%d.pbm&quot;,file_path, i, i , j);
src_image = cvLoadImage(file,0);
if(!src_image){
printf(&quot;Error: Cant load image %s\n&quot;, file);
//exit(-1);
}
//process file
prs_image = preprocessing(src_image, size, size);
float r=classify(&amp;prs_image,0);
if((int)r!=i)
error++;

testCount++;
}
}
float totalerror=100*(float)error/(float)testCount;
printf(&quot;System Error: %.2f%%\n&quot;, totalerror);

}</pre>
<p>Test use the classify function that get image to classify, process image, get feature vector and classify it with a find_nearest of knn class. This function we use to classify the input user images:</p>
<pre class="brush: cpp;">float basicOCR::classify(IplImage* img, int showResult)
{
IplImage prs_image;
CvMat data;
CvMat* nearest=cvCreateMat(1,K,CV_32FC1);
float result;
//process file
prs_image = preprocessing(img, size, size);

//Set data
IplImage* img32 = cvCreateImage( cvSize( size, size ), IPL_DEPTH_32F, 1 );
cvConvertScale(&amp;prs_image, img32, 0.0039215, 0);
cvGetSubRect(img32, &amp;data, cvRect(0,0, size,size));
CvMat row_header, *row1;
row1 = cvReshape( &amp;data, &amp;row_header, 0, 1 );

result=knn-&gt;find_nearest(row1,K,0,0,nearest,0);

int accuracy=0;
for(int i=0;i&lt;K;i++){
if( nearest-&gt;data.fl[i] == result)
accuracy++;
}
float pre=100*((float)accuracy/(float)K);
if(showResult==1){
printf(&quot;|\t%.0f\t| \t%.2f%%  \t| \t%d of %d \t| \n&quot;,result,pre,accuracy,K);
printf(&quot; ---------------------------------------------------------------\n&quot;);
}

return result;

}</pre>
<p>All work or training and test is in basicOCR class, when we create a basicOCR instance then only we need call to classify function to classify our input image. Then we go to use basic Painter we create before in other tutorial to user interactivity to draw a image and classify it.</p>
<p><a class="download" title="Demo Source Basic OCR" href="https://github.com/damiles/basicOCR" target="_blank">Demo Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.damiles.com/2008/11/basic-ocr-in-opencv/feed/</wfw:commentRss>
		<slash:comments>296</slash:comments>
		</item>
		<item>
		<title>GNUPLOT &#8211; 3d plot surface</title>
		<link>http://blog.damiles.com/2008/10/gnuplot-3d-plot-surface/</link>
		<comments>http://blog.damiles.com/2008/10/gnuplot-3d-plot-surface/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 21:12:09 +0000</pubDate>
		<dc:creator>damiles</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>
		<category><![CDATA[other]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[gnuplot]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.damiles.com/?p=36</guid>
		<description><![CDATA[For 3d plot gnuplot use command splot. splot sin(sqrt((x*x+y*y)))/sqrt(x*x+y*y) t &#8220;weaves&#8221; We can add the style pm3d to add a gradient surface texture splot sin(sqrt((x*x+y*y)))/sqrt(x*x+y*y) with pm3d t &#8220;weaves&#8221; But you can see we need more resolution, then we must set more isosamples: set isosamples 75,75 For more info go to gnuplot page]]></description>
			<content:encoded><![CDATA[<p>For 3d plot gnuplot use command splot.</p>
<blockquote><p>splot sin(sqrt((x*x+y*y)))/sqrt(x*x+y*y) t &#8220;weaves&#8221;</p></blockquote>
<div id="attachment_37" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.damiles.com/wp-content/uploads/2008/10/ejemplo00.jpg"><img class="size-medium wp-image-37" title="ejemplo00" src="http://blog.damiles.com/wp-content/uploads/2008/10/ejemplo00-300x198.jpg" alt="Gnuplot surface wireframe" width="300" height="198" /></a>
<p class="wp-caption-text">Gnuplot surface wireframe</p>
</div>
<p>We can add the style pm3d to add a gradient surface texture</p>
<blockquote><p>splot sin(sqrt((x*x+y*y)))/sqrt(x*x+y*y) with pm3d t &#8220;weaves&#8221;</p></blockquote>
<div id="attachment_38" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.damiles.com/wp-content/uploads/2008/10/ejemplo0.jpg"><img class="size-medium wp-image-38" title="ejemplo0" src="http://blog.damiles.com/wp-content/uploads/2008/10/ejemplo0-300x198.jpg" alt="Gnuplot surface 3d pm3d" width="300" height="198" /></a>
<p class="wp-caption-text">Gnuplot surface 3d pm3d</p>
</div>
<p>But you can see we need more resolution, then we must set more isosamples:</p>
<blockquote><p>set isosamples 75,75</p></blockquote>
<div id="attachment_39" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.damiles.com/wp-content/uploads/2008/10/ejemplo1.jpg"><img class="size-medium wp-image-39" title="ejemplo1" src="http://blog.damiles.com/wp-content/uploads/2008/10/ejemplo1-300x198.jpg" alt="Gnuplot surface with pm3d and isosample 75,75" width="300" height="198" /></a>
<p class="wp-caption-text">Gnuplot surface with pm3d and isosample 75,75</p>
</div>
<p>For more info go to <a title="Gnuplot page" href="http://www.gnuplot.info/help.html" target="_blank">gnuplot page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.damiles.com/2008/10/gnuplot-3d-plot-surface/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
