tag:blogger.com,1999:blog-40443253582775775062024-03-17T00:37:36.942-07:00All about openCVThanks for more than two lakh views. All about openCV, Image Processing converging towards Biometric face recognition. Use the Easy Navigation button on the top bar to view all the posts at a glance related to openCV. I kept this blog small so that anyone can complete going through all posts and acquaint himself with openCV.Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-4044325358277577506.post-18418531311726002772014-07-26T09:40:00.001-07:002022-05-19T09:50:43.758-07:00Message board<div dir="ltr" style="text-align: left;" trbidi="on">
Update (02 April, 2012) :<br />
If anyone wants to publish a paper in biometrics, which you feel is revolutionary, try the <a href="https://sites.google.com/a/nd.edu/btas_2012/" rel="nofollow" target="_blank">BTAS</a> conference. It was an international conference on biometrics and has very high value. The deadline is April, 15th<br />
<br />
Update (29 April, 2012):<br />
And I wrote a post about - <a href="http://hackingthecode.blogspot.in/2012/03/about-hackers-and-how-to-become-one.html" target="_blank">how to become a hacker</a><br />
My projects are at <a href="https://github.com/dileep98490">https://github.com/dileep98490</a><br />
<br />
Update (28 June, 2012):<br />
<div style="text-align: -webkit-auto;">
My final year thesis - <a href="http://ethesis.nitrkl.ac.in/3558/1/thesis.pdf" target="_blank">On Matching Forensic Sketches to Mug shot photos</a></div>
<div style="text-align: -webkit-auto;">
<span style="line-height: 15px;">There is a conference <a href="https://sites.google.com/site/wiaf2012/" rel="nofollow" target="_blank">"What's in a Face"</a> whose main aim is to improve the research on Human Face. The deadline is July 3rd. It's an international conference, and even if you think you could not attend (due to monetary problems), try sending the paper. If you get acceptance, then it is something that you can write proudly in your resume.</span></div>
<br />
Best of luck :)<br />
<br />
Update (05 July, 2012):<br />
Have released the SURF source code. Enjoy :)<br />
<br />
Update (24 September, 2012):<br />
Anyway, my first paper. Similar to the thesis in I already uploaded this contains, SIFT vs SURF comparison for the same project using openCV<br />
<a href="http://www.springerlink.com/content/r744311v038r1488/" target="_blank">http://www.springerlink.com/content/r744311v038r1488/ </a><br />
<br />
Update (19 May, 2022):</div><div dir="ltr" style="text-align: left;" trbidi="on">Though a bit delayed, started making videos on Machine learning. Do check them out here - <a href="https://youtube.com/playlist?list=PL-elbRpCumxyjFkghgs8NvJg7knCTJ7Pj">https://youtube.com/playlist?list=PL-elbRpCumxyjFkghgs8NvJg7knCTJ7Pj</a> <br /></div>
Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0tag:blogger.com,1999:blog-4044325358277577506.post-85167140225360213412014-07-26T09:39:00.001-07:002014-07-26T09:44:10.143-07:00Ceemple - C++ based technical computing<div dir="ltr" style="text-align: left;" trbidi="on">
Today, let me give you a glimpse of a wonderful tool called Ceemple, which I believe is still in beta stage, but can be downloaded from www.ceemple.com.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWPVAe5UhWQ8R9RW4T0Rcz3TE7P7XD4N3oTcfQ0_aMIj0tkKIUYKIFMzO8iUv8Q3r1LU4jJcRoPxa3Pn2DYO9aHadfElN7G4y1-BwnFRQnZYlZ01QgoUZob_v6J56_-iSvUVdirNzNBIg/s1600/slide10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWPVAe5UhWQ8R9RW4T0Rcz3TE7P7XD4N3oTcfQ0_aMIj0tkKIUYKIFMzO8iUv8Q3r1LU4jJcRoPxa3Pn2DYO9aHadfElN7G4y1-BwnFRQnZYlZ01QgoUZob_v6J56_-iSvUVdirNzNBIg/s1600/slide10.png" height="345" width="640" /></a></div>
<br />
<br />
It is one package, fit all tool for C++; where on installing Ceemple, you get all the computational and graphical libraries, which you can use hassle free, while concentrating only on development.<br />
<br />
Many of you told me about the problems being faced, while installing openCV in windows and how you failed to integrate it to into your existing Code Blocks or Dev C++ software. Now it's all done for you by the Ceemple team. You just need to download, install and zup... ready to go. It is too easy. Also, you have a hell lot of other libraries including Matlab, Python etc., which you can use for building real things - super fast. If you are a less software guy and more of a researcher, this tool is the boon for you, and it's open source nature makes it tasty enough for gulping directly. For a detailed comparative analysis and the usefulness of the tool, you can visit this <a href="http://www.ceemple.com/benefits-of-using-ceemple/" target="_blank">link</a></div>
Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com1tag:blogger.com,1999:blog-4044325358277577506.post-37990690596095426122012-07-05T07:16:00.000-07:002012-07-05T07:16:34.287-07:00SURF Source Code (Part-2)<div dir="ltr" style="text-align: left;" trbidi="on">
Many of you might have already figured out, how to strip the code. The below is the stripped version. Here, we can just supply the gallery image and probe image, the same way as the previous post as arg1 and arg2. But here, no GUI utilities are being used. Just the output needed is printed to standard output. This drastically reduces the time for the program execution. Also, I have removed the flann method of matching, since any one (findpairs and flannfindpairs - functions) can be used and both the methods given have the same recognition performance.<br />
<br />
<pre class="brush : cpp;collapse : true">/*
* A Demo to OpenCV Implementation of SURF
* Further Information Refer to "SURF: Speed-Up Robust Feature"
* Author: Liu Liu
* liuliu.1987+opencv@gmail.com
* Modified by : http://www.opencvuser.blogspot.com
* Modifying Author : Dileep Kumar Kotha
*/
#include <cv.h>
#include <highgui.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
using namespace std;
static double dis=0;//Dileep:For calculating the distance
IplImage *image = 0;
double
compareSURFDescriptors( const float* d1, const float* d2, double best, int length )
{
double total_cost = 0;
assert( length % 4 == 0 );
for( int i = 0; i < length; i += 4 )
{
double t0 = d1[i] - d2[i];
double t1 = d1[i+1] - d2[i+1];
double t2 = d1[i+2] - d2[i+2];
double t3 = d1[i+3] - d2[i+3];
total_cost += t0*t0 + t1*t1 + t2*t2 + t3*t3;
/*
We are sending a total cost, that's slightly greater or smaller than the best
*/
if( total_cost > best )
break;
}
return total_cost;
}
int
naiveNearestNeighbor( const float* vec, int laplacian,
const CvSeq* model_keypoints,
const CvSeq* model_descriptors )
{
int length = (int)(model_descriptors->elem_size/sizeof(float));
int i, neighbor = -1;
double d, dist1 = 1e6, dist2 = 1e6;
CvSeqReader reader, kreader;
cvStartReadSeq( model_keypoints, &kreader, 0 );
cvStartReadSeq( model_descriptors, &reader, 0 );
for( i = 0; i < model_descriptors->total; i++ )
{
const CvSURFPoint* kp = (const CvSURFPoint*)kreader.ptr;
const float* mvec = (const float*)reader.ptr;
CV_NEXT_SEQ_ELEM( kreader.seq->elem_size, kreader );
CV_NEXT_SEQ_ELEM( reader.seq->elem_size, reader );
if( laplacian != kp->laplacian )
continue;
d = compareSURFDescriptors( vec, mvec, dist2, length );
if( d < dist1 )
{
dist2 = dist1;
dist1 = d;
neighbor = i;
}
else if ( d < dist2 )
dist2 = d;
}
dis=dis+dist1;
/*Dileep:We are finding the distance from every descriptor of probe image to every descriptor of the galley image. Finally in the findpairs function, we divide this distance with the total no. of descriptors to get the average of all the distances
*/
if ( dist1 < 0.6*dist2 )
return neighbor;
return -1;
}
void
findPairs( const CvSeq* objectKeypoints, const CvSeq* objectDescriptors,
const CvSeq* imageKeypoints, const CvSeq* imageDescriptors, vector<int>& ptpairs )
{
int i;
CvSeqReader reader, kreader;
cvStartReadSeq( objectKeypoints, &kreader );
cvStartReadSeq( objectDescriptors, &reader );
ptpairs.clear();
for( i = 0; i < objectDescriptors->total; i++ )
{
const CvSURFPoint* kp = (const CvSURFPoint*)kreader.ptr;
const float* descriptor = (const float*)reader.ptr;
CV_NEXT_SEQ_ELEM( kreader.seq->elem_size, kreader );
CV_NEXT_SEQ_ELEM( reader.seq->elem_size, reader );
int nearest_neighbor = naiveNearestNeighbor( descriptor, kp->laplacian, imageKeypoints, imageDescriptors);
//Dileep:For every descriptor, we are trying to find it's nearest neighbour in the probe image
if( nearest_neighbor >= 0 )
{
ptpairs.push_back(i);
ptpairs.push_back(nearest_neighbor);
}
}
printf("\n%lf\n",(dis/objectDescriptors->total));////Dileep:Here's where I am outputting the distance between the images
/*Dileep: If you are using this for recognition, write this distance to a file along with the name of the image you are matching against. After doing this for several images, you can then sort them in ascending order to find the best possible match - the one with the smallest distance. Here, I am outputting the distance to stdout
*/
}
int main(int argc, char** argv)
{
const char* object_filename = argc == 3 ? argv[1] : "box.png";
const char* scene_filename = argc == 3 ? argv[2] : "box_in_scene.png";
//Dileep:When you are excuting the object file, please write Command:./objectfile probe_image Gallery_image
/*Dileep:
Probe_image - This is the image for which you need to find the match
Gallery_image - This is one of the set of images, you use for matching
You keep the same probe image same, repeatedly changing the gallery image and outputting the distance in the format
<Gallery_name distance> into a file
Finally you can sort the distances in ascending order. And the one with the shortest distance - You can output it's name as the best possible match
It may become tedious to continually write the same command multiple times, changing the gallery file name. Try to use shell script with a for loop
*/
CvMemStorage* storage = cvCreateMemStorage(0);
IplImage* object = cvLoadImage( object_filename, CV_LOAD_IMAGE_GRAYSCALE );
IplImage* image = cvLoadImage( scene_filename, CV_LOAD_IMAGE_GRAYSCALE );
if( !object || !image )
{
fprintf( stderr, "Can not load %s and/or %s\n"
"Usage: find_obj [<object_filename> <scene_filename>]\n",
object_filename, scene_filename );
exit(-1);
}
CvSeq *objectKeypoints = 0, *objectDescriptors = 0;
CvSeq *imageKeypoints = 0, *imageDescriptors = 0;
int i;
CvSURFParams params = cvSURFParams(500, 1);
double tt = (double)cvGetTickCount();
cvExtractSURF( object, 0, &objectKeypoints, &objectDescriptors, storage, params );
printf("Object Descriptors: %d\n", objectDescriptors->total);
cvExtractSURF( image, 0, &imageKeypoints, &imageDescriptors, storage, params );
printf("Image Descriptors: %d\n", imageDescriptors->total);
tt = (double)cvGetTickCount() - tt;
printf( "Extraction time = %gms\n", tt/(cvGetTickFrequency()*1000.));
vector<int> ptpairs;
findPairs( objectKeypoints, objectDescriptors, imageKeypoints, imageDescriptors, ptpairs );
return 0;
}
</pre>
<div>
<br /></div>
<br /></div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com9tag:blogger.com,1999:blog-4044325358277577506.post-79552346097935105172012-07-05T07:15:00.000-07:002012-07-05T07:24:09.406-07:00SURF Souce Code (Part-1)<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
When you install openCV, openCV samples folder also gets installed. The samples will be present in your <b>InstallationDirectory/samples/C</b>. For me it's present in <b>OpenCV-2.1.0/samples/c</b>.This folder contains the sample codes of many good openCV programmes that can be used for a wide variety of purposes. One more thing is that, it also contains the compiled object files along with the source code for each programme. The programme , we will be looking is find_obj.cpp and the compiled code will be with the name find_obj. This programme uses SURF to do an object detection. The original code, written by Liu, is modified by me to give the below code. Note that the comments made by me, start with <b>Dileep:</b></div>
<pre class="brush : cpp; collapse: true">/*
* A Demo to OpenCV Implementation of SURF
* Further Information Refer to "SURF: Speed-Up Robust Feature"
* Author: Liu Liu
* liuliu.1987+opencv@gmail.com
* Modified by : http://www.opencvuser.blogspot.com
* Modifying Author : Dileep Kumar Kotha
*/
#include <cv.h>
#include <highgui.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
using namespace std;
static double dis=0;//For calculating the average descriptor distance
// define whether to use approximate nearest-neighbor search
//#define USE_FLANN
IplImage *image = 0;
double
compareSURFDescriptors( const float* d1, const float* d2, double best, int length )
{
double total_cost = 0;
assert( length % 4 == 0 );
for( int i = 0; i < length; i += 4 )
{
double t0 = d1[i] - d2[i];
double t1 = d1[i+1] - d2[i+1];
double t2 = d1[i+2] - d2[i+2];
double t3 = d1[i+3] - d2[i+3];
total_cost += t0*t0 + t1*t1 + t2*t2 + t3*t3;
/*
We are sending a total cost, that's slightly greater or smaller than the best
*/
if( total_cost > best )
break;
}
return total_cost;
}
int
naiveNearestNeighbor( const float* vec, int laplacian,
const CvSeq* model_keypoints,
const CvSeq* model_descriptors )
{
int length = (int)(model_descriptors->elem_size/sizeof(float));
int i, neighbor = -1;
double d, dist1 = 1e6, dist2 = 1e6;
CvSeqReader reader, kreader;
cvStartReadSeq( model_keypoints, &kreader, 0 );
cvStartReadSeq( model_descriptors, &reader, 0 );
for( i = 0; i < model_descriptors->total; i++ )
{
const CvSURFPoint* kp = (const CvSURFPoint*)kreader.ptr;
const float* mvec = (const float*)reader.ptr;
CV_NEXT_SEQ_ELEM( kreader.seq->elem_size, kreader );
CV_NEXT_SEQ_ELEM( reader.seq->elem_size, reader );
if( laplacian != kp->laplacian )
continue;
d = compareSURFDescriptors( vec, mvec, dist2, length );
if( d < dist1 )
{
dist2 = dist1;
dist1 = d;
neighbor = i;
}
else if ( d < dist2 )
dist2 = d;
}
dis=dis+dist1;
if ( dist1 < 0.6*dist2 )
return neighbor;
return -1;
}
void
findPairs( const CvSeq* objectKeypoints, const CvSeq* objectDescriptors,
const CvSeq* imageKeypoints, const CvSeq* imageDescriptors, vector<int>& ptpairs )
{
int i;
CvSeqReader reader, kreader;
cvStartReadSeq( objectKeypoints, &kreader );
cvStartReadSeq( objectDescriptors, &reader );
ptpairs.clear();
for( i = 0; i < objectDescriptors->total; i++ )
{
const CvSURFPoint* kp = (const CvSURFPoint*)kreader.ptr;
const float* descriptor = (const float*)reader.ptr;
CV_NEXT_SEQ_ELEM( kreader.seq->elem_size, kreader );
CV_NEXT_SEQ_ELEM( reader.seq->elem_size, reader );
int nearest_neighbor = naiveNearestNeighbor( descriptor, kp->laplacian, imageKeypoints, imageDescriptors);
if( nearest_neighbor >= 0 )
{
ptpairs.push_back(i);
ptpairs.push_back(nearest_neighbor);
}
}
printf("\n%lf\n",(dis/objectDescriptors->total));////Dileep:Here's where I am outputting the distance between the images
/*Dileep: If you are using this for recognition, write this distance to a file along with the name of the image you are matching against. After doing this for several images, you can then sort them in ascending order to find the best possible match - the one with the smallest distance. Here, I am outputting the distance to stdout
*/
}
////Dileep:I am commenting the below one since it's of flann method and what ever the method we choose to find distance, the result is the same
/*
void
flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors,
const CvSeq*, const CvSeq* imageDescriptors, vector<int>& ptpairs )
{
int length = (int)(objectDescriptors->elem_size/sizeof(float));
cv::Mat m_object(objectDescriptors->total, length, CV_32F);
cv::Mat m_image(imageDescriptors->total, length, CV_32F);
// copy descriptors
CvSeqReader obj_reader;
float* obj_ptr = m_object.ptr<float>(0);
cvStartReadSeq( objectDescriptors, &obj_reader );
for(int i = 0; i < objectDescriptors->total; i++ )
{
const float* descriptor = (const float*)obj_reader.ptr;
CV_NEXT_SEQ_ELEM( obj_reader.seq->elem_size, obj_reader );
memcpy(obj_ptr, descriptor, length*sizeof(float));
obj_ptr += length;
}
CvSeqReader img_reader;
float* img_ptr = m_image.ptr<float>(0);
cvStartReadSeq( imageDescriptors, &img_reader );
for(int i = 0; i < imageDescriptors->total; i++ )
{
const float* descriptor = (const float*)img_reader.ptr;
CV_NEXT_SEQ_ELEM( img_reader.seq->elem_size, img_reader );
memcpy(img_ptr, descriptor, length*sizeof(float));
img_ptr += length;
}
// find nearest neighbors using FLANN
cv::Mat m_indices(objectDescriptors->total, 2, CV_32S);
cv::Mat m_dists(objectDescriptors->total, 2, CV_32F);
cv::flann::Index flann_index(m_image, cv::flann::KDTreeIndexParams(4)); // using 4 randomized kdtrees
flann_index.knnSearch(m_object, m_indices, m_dists, 2, cv::flann::SearchParams(64) ); // maximum number of leafs checked
int* indices_ptr = m_indices.ptr<int>(0);
float* dists_ptr = m_dists.ptr<float>(0);
for (int i=0;i<m_indices.rows;++i) {
if (dists_ptr[2*i]<0.6*dists_ptr[2*i+1]) {
ptpairs.push_back(i);
ptpairs.push_back(indices_ptr[2*i]);
}
}
}
// a rough implementation for object location
int
locatePlanarObject( const CvSeq* objectKeypoints, const CvSeq* objectDescriptors,
const CvSeq* imageKeypoints, const CvSeq* imageDescriptors,
const CvPoint src_corners[4], CvPoint dst_corners[4] )
{
double h[9];
CvMat _h = cvMat(3, 3, CV_64F, h);
vector<int> ptpairs;
vector<CvPoint2D32f> pt1, pt2;
CvMat _pt1, _pt2;
int i, n;
#ifdef USE_FLANN
flannFindPairs( objectKeypoints, objectDescriptors, imageKeypoints, imageDescriptors, ptpairs );
#else
findPairs( objectKeypoints, objectDescriptors, imageKeypoints, imageDescriptors, ptpairs );
#endif
n = ptpairs.size()/2;
if( n < 4 )
return 0;
pt1.resize(n);
pt2.resize(n);
for( i = 0; i < n; i++ )
{
pt1[i] = ((CvSURFPoint*)cvGetSeqElem(objectKeypoints,ptpairs[i*2]))->pt;
pt2[i] = ((CvSURFPoint*)cvGetSeqElem(imageKeypoints,ptpairs[i*2+1]))->pt;
}
_pt1 = cvMat(1, n, CV_32FC2, &pt1[0] );
_pt2 = cvMat(1, n, CV_32FC2, &pt2[0] );
if( !cvFindHomography( &_pt1, &_pt2, &_h, CV_RANSAC, 5 ))
return 0;
for( i = 0; i < 4; i++ )
{
double x = src_corners[i].x, y = src_corners[i].y;
double Z = 1./(h[6]*x + h[7]*y + h[8]);
double X = (h[0]*x + h[1]*y + h[2])*Z;
double Y = (h[3]*x + h[4]*y + h[5])*Z;
dst_corners[i] = cvPoint(cvRound(X), cvRound(Y));
}
return 1;
}
*/
int main(int argc, char** argv)
{
const char* object_filename = argc == 3 ? argv[1] : "box.png";
const char* scene_filename = argc == 3 ? argv[2] : "box_in_scene.png";
CvMemStorage* storage = cvCreateMemStorage(0);
cvNamedWindow("Object", 1);
cvNamedWindow("Object Correspond", 1);
static CvScalar colors[] =
{
{{0,0,255}},
{{0,128,255}},
{{0,255,255}},
{{0,255,0}},
{{255,128,0}},
{{255,255,0}},
{{255,0,0}},
{{255,0,255}},
{{255,255,255}}
};
IplImage* object = cvLoadImage( object_filename, CV_LOAD_IMAGE_GRAYSCALE );
IplImage* image = cvLoadImage( scene_filename, CV_LOAD_IMAGE_GRAYSCALE );
if( !object || !image )
{
fprintf( stderr, "Can not load %s and/or %s\n"
"Usage: find_obj [<object_filename> <scene_filename>]\n",
object_filename, scene_filename );
exit(-1);
}
IplImage* object_color = cvCreateImage(cvGetSize(object), 8, 3);
cvCvtColor( object, object_color, CV_GRAY2BGR );
CvSeq *objectKeypoints = 0, *objectDescriptors = 0;
CvSeq *imageKeypoints = 0, *imageDescriptors = 0;
int i;
CvSURFParams params = cvSURFParams(500, 1);
double tt = (double)cvGetTickCount();
cvExtractSURF( object, 0, &objectKeypoints, &objectDescriptors, storage, params );
printf("Object Descriptors: %d\n", objectDescriptors->total);
cvExtractSURF( image, 0, &imageKeypoints, &imageDescriptors, storage, params );
printf("Image Descriptors: %d\n", imageDescriptors->total);
tt = (double)cvGetTickCount() - tt;
printf( "Extraction time = %gms\n", tt/(cvGetTickFrequency()*1000.));
CvPoint src_corners[4] = {{0,0}, {object->width,0}, {object->width, object->height}, {0, object->height}};
CvPoint dst_corners[4];
IplImage* correspond = cvCreateImage( cvSize(image->width, object->height+image->height), 8, 1 );
cvSetImageROI( correspond, cvRect( 0, 0, object->width, object->height ) );
cvCopy( object, correspond );
cvSetImageROI( correspond, cvRect( 0, object->height, correspond->width, correspond->height ) );
cvCopy( image, correspond );
cvResetImageROI( correspond );
#ifdef USE_FLANN
printf("Using approximate nearest neighbor search\n");
#endif
/*
if( locatePlanarObject( objectKeypoints, objectDescriptors, imageKeypoints,
imageDescriptors, src_corners, dst_corners ))
{
for( i = 0; i < 4; i++ )
{
CvPoint r1 = dst_corners[i%4];
CvPoint r2 = dst_corners[(i+1)%4];
cvLine( correspond, cvPoint(r1.x, r1.y+object->height ),
cvPoint(r2.x, r2.y+object->height ), colors[8] );
}
}
*/
vector<int> ptpairs;
#ifdef USE_FLANN
flannFindPairs( objectKeypoints, objectDescriptors, imageKeypoints, imageDescriptors, ptpairs );
#else
findPairs( objectKeypoints, objectDescriptors, imageKeypoints, imageDescriptors, ptpairs );
#endif
////Dileep:It is used to draw the the lines and rectangles in the windows that display images. If you want just the distance, you can comment the whole
////below code
for( i = 0; i < (int)ptpairs.size(); i += 2 )
{
CvSURFPoint* r1 = (CvSURFPoint*)cvGetSeqElem( objectKeypoints, ptpairs[i] );
CvSURFPoint* r2 = (CvSURFPoint*)cvGetSeqElem( imageKeypoints, ptpairs[i+1] );
cvLine( correspond, cvPointFrom32f(r1->pt),
cvPoint(cvRound(r2->pt.x), cvRound(r2->pt.y+object->height)), colors[8] );
}
cvShowImage( "Object Correspond", correspond );
for( i = 0; i < objectKeypoints->total; i++ )
{
CvSURFPoint* r = (CvSURFPoint*)cvGetSeqElem( objectKeypoints, i );
CvPoint center;
int radius;
center.x = cvRound(r->pt.x);
center.y = cvRound(r->pt.y);
radius = cvRound(r->size*1.2/9.*2);
cvCircle( object_color, center, radius, colors[0], 1, 8, 0 );
}
cvShowImage( "Object", object_color );
cvWaitKey(0);
//cvSaveImage("Object_1.png",correspond);
//cvSaveImage("Object_2.png",object_color);
cvDestroyWindow("Object");
cvDestroyWindow("Object SURF");
cvDestroyWindow("Object Correspond");
return 0;
}
</pre>
</div>
There are enough comments in it, explaining what each part does. compile it. If you compile it to the object file find_obj, the command below works.<br />
<br />
<b>./find_obj</b><br />
<br />
Otherwise, replace it with a.out. Also, copy the two images in the samples folder named box.png and box_in_scene.png into the folder where you run the above command.<br />
<br />
Now for ./find_obj
Since we are not supplying arguements, it will take the default box.png and box_in_scene.png and tries to find the first object inside the second object. The below figure appears.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtf9YNAU9bNLOBgJRW5Pw_DBzsjGnZ0y07Jy599ZV5y_588NHJR1y2gZrJd9ODJ5k0NlLU8ZEeMr51XxSOL2ySZMgzhKlJHJPmhe08YQOm4YMtT42D5k1phPDTknbhPVkihuRcJ2em1cc/s1600/Object_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="SURF example" border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtf9YNAU9bNLOBgJRW5Pw_DBzsjGnZ0y07Jy599ZV5y_588NHJR1y2gZrJd9ODJ5k0NlLU8ZEeMr51XxSOL2ySZMgzhKlJHJPmhe08YQOm4YMtT42D5k1phPDTknbhPVkihuRcJ2em1cc/s640/Object_1.png" width="540" /></a></div>
<br />
<br />
What's actually happening here is object detection. But I included a "dis" variable and also printing it to standard ouput, so that you will also know the average distance of all the descriptors. If you want, you can keep two photographs of the same person with different facial expressions in the same folder and supply them as arg1 and arg2 (in which case you will get distance as zero, ofcourse :P)<br />
<br />
<b>./findobj arg1 arg2 </b><br />
<br />
If we keep on changing the second arguement(the image we are supplying as arg2), we can actually use it for recognition. Then the one with the least distance is the best possible match for the first argument (the image we are supplying as arg1). In the next post, I will strip all the unnecessary components of this code and make this usable for recognition. You can try to do it yourself.</div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com11tag:blogger.com,1999:blog-4044325358277577506.post-63188478283240255352012-03-03T19:24:00.001-08:002017-06-26T09:35:24.985-07:00SURF Source code<div dir="ltr" style="text-align: left;" trbidi="on">
When you install openCV, openCV samples folder also gets installed. The samples will be present in your <b>InstallationDirectory/samples/C</b>. For me it's present in <b>OpenCV-2.1.0/samples/c</b>.This folder contains the sample codes of many good openCV programmes that can be used for a wide variety of purposes. One more thing is that, it also contains the compiled object files along with the source code for each programme. The programme , we will be looking is find_obj.cpp and the compiled code will be with the name find_obj. This programme uses SURF to do an object detection.
<br />
<!-- adsense -->
<br />
I have modified the code to make it work for recognition. I did my summer project at IIT Kharagpur, and there we performed the experiments on face recognition with SURF. For the first time in face recognition history, we worked with color FERET database. We wrote a paper, describing our approach and writing the results of our work. The Research paper was sent to the proceedings of an international conference. Till that gets published, I cannot share my work. But it's so simple and intuitive, when you look at the code I mentioned. Best of luck with your work.<br />
<br />
<b>Update (29/06/12) :</b><br />
I will release the modified source code on or before 8th July</div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com24Rourkela, Orissa, India22.249444 84.88298822.1318735 84.7250595 22.3670145 85.0409165tag:blogger.com,1999:blog-4044325358277577506.post-63838668109307978382012-03-01T07:00:00.002-08:002017-06-26T07:58:11.030-07:00SURF - Algorithm for matching<div dir="ltr" style="text-align: left;" trbidi="on">
Many people talk about SURF and using it for recognition. But no one actually tells you, how it is used or what might be the algorithm for doing it. This series of posts, will detail you of using it practically. If you followed my previous posts, understanding this would be a lot more easier. You can skip the next paragraph. For noobs they have to read the next paragraph.<br />
<br />
This post is made, assuming that you have openCV installed in your computer. If you haven't, go to my previous post for <a href="http://opencvuser.blogspot.in/2011/06/installing-opencv.html">Installing openCV</a>. To practice some openCV programming go to the <a href="http://opencvuser.blogspot.in/2011/06/coding-image-processing.html"> assignments </a>. If you don't know anything of openCV and are a complete absolute beginner, then go to the <a href="http://opencvuser.blogspot.in/p/easy-navigation.html">Easy navigation</a> and start reading all the posts in the serial order. Most of them are practicals though to get your hands dirty. Also, if you have an open source OS, then this post will be more straight forward; although it isn't necessary. I know that many people use it in matlab. The code can be easily ported if you are well versed with C.<br />
<br />
Let me start with giving a quick overview of SURF, so that understanding certain parts of the code we are going to write, will be easier to you. SURF stands for Speeded up Robust Features. In a given image, SURF tries to find the interest points - The points where the variance is maximum. It then constructs a 64-variable vector around it to extract the features (A 128-variable one is also possible, but it would consume more time for matching). In this way, there will be as many descriptors in an image as there are interest points. Now, when we use SURF for matching, we follow the below steps for every probe image (The image we need to match against)<br />
<!-- adsense -->
<br />
1. Take a descriptor of the probe image<br />
2. Compare this with all the descriptors of the gallery image (One of the set of possible matching images)<br />
3. Find the nearest descriptor which is the one with the lowest distance to our descriptor compared to all the other descriptors<br />
4. The nearest descriptor distance is stored<br />
5. Take a descrptor other than the one's already taken from probe image and go to step-2<br />
6. Now all the nearest descriptor distances are added, and the sum is divided with the total number of probe descriptors. This gives us the average distance<br />
7. This average distance, along with the name of the gallery image we just matched, can be outputted to a file<br />
8. For every gallery image, go to step-1<br />
9. When all the gallery images get over, sort the distances in the outputted file and the one with the lowest distance is the best match for our probe image<br />
<br />
There is already a function in openCV called <b>cvExtractSURF</b> to extract the SURF features of images. But there is no function to directly compare two images using SURF and give their distance. In the next post, we will be talking about doing this</div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com10tag:blogger.com,1999:blog-4044325358277577506.post-35212613383832963892011-09-11T10:45:00.000-07:002012-02-10T05:24:28.828-08:00CSU - Face Evaluation System<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: inherit;">Guess, you people have unzipped the CSU face evaluation system, about which I explained in the previous post. After unzipping, consider the folder in which we unzipped is called Main folder.</span><br />
<div>
<span class="Apple-style-span" style="font-family: inherit;"><br />
</span></div>
<div>
<span class="Apple-style-span" style="font-family: inherit;">Inside the Main folder, there will be a README file, that instructs how to install the CSU face evaluation system. Do it, and make sure it happens with out any errors. If there is an error, it is related to some package absense. Look through the error carefully and install the missing packages.</span></div>
<div>
<span class="Apple-style-span" style="font-family: inherit;"><br />
</span></div>
<div>
After installing, with in that README file, there are some tests related to scraps data which is present in the Mainfolder/data/csuScrapShots/source/pgm folder. These are the images from the year book of 1925 of CSU. So we can perform initial tests of PCA, LDA, Bayesian and EBGM approaches using the commands listed in the README.</div>
<div>
<br /></div>
<div>
Also, with in that README file, if you have FERET database, there are tests related to grey FERET database. If you don't have a FERET database, you can try to get it online searching in google. I would have given you, but it's redistribution is prohibited.</div>
<div>
<br /></div>
<div>
After running the tests on either of them or any one of them, you can view the results in Mainfolder/results folder.</div>
<div>
<br /></div>
<div>
The UsersGuide pdf document, that is present in the main folder, explains you everything you need to know, to get started using that system. It is like a bible for CSU face evaluation system.</div>
<div>
<br /></div>
<div>
In the main folder, the src folder contains C-programmes related to various executables that we use while we are running tests related to biometric face recognition.</div>
<div>
<br /></div>
<div>
The data folder is the epi centre of all the data that we use in running the tests. The normalised images are also stored here.</div>
<div>
<br /></div>
<div>
The distances folder contains the distance metrics related to PCA, LDA and other approaches. Carefully observe these distance files, relating it to the data. It is because, if you build a face recognition system, you have to make the distance files similar to the ones present here and keep them in a folder just like PCA, LDA and all and trigger the comparison scripts.</div>
<div>
<br /></div>
<div>
The final results are stored in results folder. The training data, which is created when we are doing PCA, LDA or Bayesian training is stored in train folder. </div>
<div>
<br /></div>
<div>
This is it guys, I have shown you a way into biometric face recognition. Now it's up to you to figure out. If you need any help, leave the comments, I am always ready to help. If I think there is a need for extra post, I will definitely do it. </div>
<div>
<br /></div>
<div>
But I don't want you to stick to my blog for your entire career. That is the reason I kept a time frame.</div>
<div>
<br /></div>
<div>
Life has to go on. Hit the "+1" on right side bar and say good bye.</div>
<div>
</div>
</div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0tag:blogger.com,1999:blog-4044325358277577506.post-63231063578777387622011-08-25T05:03:00.000-07:002011-08-25T05:03:04.201-07:00Review and what needs to be done - Biometric Face recognition system<div dir="ltr" style="text-align: left;" trbidi="on"><br />
We talked about haar training in the previous post. Let's see how far we have come till date<br />
<br />
1. Installed opencv<br />
2. Did some good exercises related to openCV intro programming<br />
3. Created eye and face detectors using haar cascade classifiers<br />
4. Learnt how to create an xml file with haar training that can be used to create an object detector<br />
<br />
Now let's divulge into our main topic of biometric face recognition. In one of my previous posts, I told you about Biometric face recognition, it's significance and the contests related to it.<br />
<br />
The reason I made you learn the creating of face detector due to the fact that the first step in face recognition is detecting the face in a back ground, like the one shown below<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFw4FRG6lbzqPzgQdw7o_DM879Kzz5jG3jVHhWHy4fmAYly6T4JT-GaPND5X_oJ1PCZkuEc6iaJMqx8kImrtpJEnmKOgU6ODqRIAVNJUcCW3wX650gASc9x7Ch-oTPvlSzOVYAv6XTKag/s1600/fun5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFw4FRG6lbzqPzgQdw7o_DM879Kzz5jG3jVHhWHy4fmAYly6T4JT-GaPND5X_oJ1PCZkuEc6iaJMqx8kImrtpJEnmKOgU6ODqRIAVNJUcCW3wX650gASc9x7Ch-oTPvlSzOVYAv6XTKag/s320/fun5.jpg" width="213" /></a></div><br />
<br />
Detecting face is just the beginning. The next step is to normalise the face, so that only the face part is cut. Then we will apply histogram equilisation to make the face invariant to brightness and contrast. Finally, we rotate the face, so that the eye coordinates remain on same height. This is needed, since we will be comparing photos for face recognition and if the guy tilts the head, his nose may be taken as one of the eyes, by mistake by the recognition system. In the end, the piece that we actually need looks like this<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_usKGkbMwmZ-5zGUuxxyOi_rcLacDdqhWxrKxRzpPXWWY9Sj3M4ZknVHbHC4xktFMwutHxHpzyaifNSTmM8C0ZlU3zABrnlw_025LAgUjTHG07ygNO5Mg7wDogz05Y9acXglny0oCx50/s1600/00001_930831_fb_a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_usKGkbMwmZ-5zGUuxxyOi_rcLacDdqhWxrKxRzpPXWWY9Sj3M4ZknVHbHC4xktFMwutHxHpzyaifNSTmM8C0ZlU3zABrnlw_025LAgUjTHG07ygNO5Mg7wDogz05Y9acXglny0oCx50/s1600/00001_930831_fb_a.jpg" /></a></div><br />
<br />
The face recognition system compares this face, with the faces like this to recognise people. Incidentally, there is a savior for us. It's the CSU face evaluation system. Just google for the name and download the zipped file. The beauty of CSU face evaluation system is that, you supply the image containing face, along with any back ground, with the eye center coordinates, and it returns you the face which is detected, normalised, equalised and rotated.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfczYwh5DP5hjdzh95dsaYle4-rjUiAMECow682N-jGK-FCvtD4ZCHs2TZyfKn22V70aLqMUhcMtMMx3FBvIW-M6tqH1PGAj3yvEZrqOEGVX5UHn4BCPyci22Lk1DSNypNXkpcp05M7vI/s1600/CSU_faceeval+copy.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfczYwh5DP5hjdzh95dsaYle4-rjUiAMECow682N-jGK-FCvtD4ZCHs2TZyfKn22V70aLqMUhcMtMMx3FBvIW-M6tqH1PGAj3yvEZrqOEGVX5UHn4BCPyci22Lk1DSNypNXkpcp05M7vI/s1600/CSU_faceeval+copy.jpg" /></a></div><br />
<br />
<br />
The only thing, that we need to supply it, is the eye center coordinates of the image i.e., the x and y coordinates of left eye center (eye ball center) and the same of the right eye. To get these coordinates, I used the eye detector, which I made you learn in the previous posts. Since, it draws a square around the eye, finding the center of that square is no big task. Will explain it to you in future posts, and the next post will be on sunday ( 28/08/11). For now, just download the CSU face evaluation system and try to decipher and also carefully go through it's documentation.<br />
<div><br />
</div></div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0tag:blogger.com,1999:blog-4044325358277577506.post-19636217528691134072011-08-18T10:59:00.000-07:002017-06-26T07:50:51.823-07:00Creating a haar cascade classifier aka haar training<div dir="ltr" style="text-align: left;" trbidi="on">
In the previous posts, I used haar cascade xml files for the detection of face, eyes etc.., In this post, I am going to show you, how to create your own haar cascade classifier xml files. It took me a total of 16 hours to do it. Hope you can do it even sooner, following this post<br />
<br />
Note : The below is only for linux opencv users. If you are a windows user, use this <a href="http://nayakamitarup.blogspot.com/2011/07/how-to-make-your-own-haar-trained-xml.html" rel="nofollow" target="_blank">link</a><br />
<br />
For most of the dough, that is going to come, you will need these executable linux files. Here's the <a href="https://1drv.ms/u/s!Ajd0Eby1xU4SgRHZXiHzRcaOu7Ow" rel="nofollow" target="_blank">link</a> for it.<br />
<br />
Before I start, remember two important definetions<br /><!-- adsense -->
<br />
Positive images : These images contain the object to be detected<br />
Negative images : Absolutely except that image, anything can be present<br />
<br />
It's better to explain, with an example. So I will tell you, a step by step procedure, to make a classifier that detects a pen. You can use the same for any object, you are going to experiment.<br />
<br />
First of all, I took the photographs of three of my pens, along with some background, the pics looked like the one below<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkTpwBecsYTwmGsPhjIyo6Bqo4wJgPG2obc3mBKyQrIX2NMD0lqBayXsRJAK3g112D92UqIbI0mXwS6io4jtGwkV988CjDYLgYsbGoS2TKKz03iOw1iKLIMlvX_6FMNkaiUdEbwn0vVnU/s1600/pi2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkTpwBecsYTwmGsPhjIyo6Bqo4wJgPG2obc3mBKyQrIX2NMD0lqBayXsRJAK3g112D92UqIbI0mXwS6io4jtGwkV988CjDYLgYsbGoS2TKKz03iOw1iKLIMlvX_6FMNkaiUdEbwn0vVnU/s320/pi2.jpg" width="240" /></a></div>
<br />
I took a total of 7 photographs (I didn't care to count, for which pen, I took more photographs, out of three) with my 2MP camera phone and loaded them into my computer. Now I cropped, each one of them using Image Clipper excluding the background and storing only the pen's image. Image clipper can be downloaded from the link below<br />
<br />
<a href="http://code.google.com/p/imageclipper/" rel="nofollow" target="_blank">http://code.google.com/p/imageclipper/</a><br />
<br />
The one thing that I hated about this imageclipper is that even though it made me work fast, it requires me to install a lot of other libraries. It would have been much simpler, if I just used GIMP, to crop, since there were only 7 images and cropping would have been easier. It is upto you, to follow the way you find easier.The cropped image looks like the one below<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs2NXJvg8kf3V16LOUv4I2HUqgKslzs6P5AD3FhA4EDmtkqRGs4zp9iglStBuRHQfLjDgke1z8deTfTUfFgul0tF3tCOaAFh96nirP8ncmpoAaHPFB7Z6ObbTkKPE8MdeIu52PybanyCQ/s1600/pia2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="40" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs2NXJvg8kf3V16LOUv4I2HUqgKslzs6P5AD3FhA4EDmtkqRGs4zp9iglStBuRHQfLjDgke1z8deTfTUfFgul0tF3tCOaAFh96nirP8ncmpoAaHPFB7Z6ObbTkKPE8MdeIu52PybanyCQ/s320/pia2.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
From here on the procedure is simple. As I told you at the starting of post, after downloading the necessary linux executables, keep them in a seperate folder named "Haar_Training", where you need to carry on your experimentations. Now inside that folder, create three folders and fill them with the necessary data, as explained below<br />
<br />
1. Positive_Images : In this folder, I kept all my seven <u>cropped</u> images<br />
2. Negative_Images : In this folder, I kept some other images (99 in total), which can be any image that you have, except, they should be of like genre and should not contain any where the cropped part i.e., pen<br />
3. Samples : Keep it empty<br />
<br />
Now, your Haar_Training folder looks like this<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheBsCvQQgTSI-PeLOBl_Ag5D-vIARB33PL4O4ezy6ilIMT2veWC9A1C2se4gIJ4BoU27ZhWntTjMQPSBvZjmEgAwnRXG4H0nNStMKmBsBnDQyKiyKf8Alv2T3NABKqrnxx6Us72cC1-_Q/s1600/Screenshot-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="221" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheBsCvQQgTSI-PeLOBl_Ag5D-vIARB33PL4O4ezy6ilIMT2veWC9A1C2se4gIJ4BoU27ZhWntTjMQPSBvZjmEgAwnRXG4H0nNStMKmBsBnDQyKiyKf8Alv2T3NABKqrnxx6Us72cC1-_Q/s400/Screenshot-1.png" width="400" /></a></div>
<br />
Now, navigate into that Haar_training folder through terminal. In the folder named "Positive_Images", the images are in png format and in "Negative_Images", they are in ppm format. So accordingly, I collected the information about those files in two text files named postives.dat and negatives.dat repectively using the below two commands<br />
<br />
<span class="Apple-style-span" style="font-family: "arial" , "helvetica" , sans-serif; font-size: 13px;"></span><br />
<pre style="background-attachment: initial; background-clip: initial; background-color: #efefef; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-left-color: rgb(207, 155, 0); border-left-style: solid; border-left-width: 5px; font: normal normal normal 1em/1.5 'Courier News', monospace, bold; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 5px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;">find ./Negative_Images -name '*.ppm' >negatives.dat
find ./Positive_Images -name '*.png' >positives.dat</pre>
<br />
In the next step, I used the samples folder, to store the training samples, by issuing it as arguement, along with positives.dat and negatives.dat using the below command<br />
<br />
<pre style="background-attachment: initial; background-clip: initial; background-color: #efefef; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-left-color: rgb(207, 155, 0); border-left-style: solid; border-left-width: 5px; font: normal normal normal 1em/1.5 'Courier News', monospace, bold; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 5px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;">perl createtrainsamples.pl positives.dat negatives.dat samples 250 "./opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 160 -h 20"</pre>
<br />
The important arguements in the above command, to be discussed are<br />
positives.dat - Contains the list of positive image paths<br />
negatives.dat - Contains the list of negative image paths<br />
samples - The folder that is used to store the data of training samples<br />
250 - No. of training samples<br />
-w 160 -h 20 - These two signify the width and height ratio of the pen. Originally it's -w 20 -h 20 for face. But, since I am using a pen here which is long and thin unlike face I made it 160 and 20<br />
<br />
<br />
The next two commands use the data in samples folder to create a unified training data, that is used for haar training
<span class="Apple-style-span" style="font-family: "arial" , "helvetica" , sans-serif; font-size: 13px;"></span><br />
<br />
<pre style="background-attachment: initial; background-clip: initial; background-color: #efefef; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-left-color: rgb(207, 155, 0); border-left-style: solid; border-left-width: 5px; font: normal normal normal 1em/1.5 'Courier News', monospace, bold; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 5px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;">find samples/ -name '*.vec' > samples.dat
./mergevec samples.dat samples.vec</pre>
<br />
Finally, run this command<br />
<br />
<span class="Apple-style-span" style="font-family: "arial" , "helvetica" , sans-serif; font-size: 13px;"></span><br />
<pre style="background-attachment: initial; background-clip: initial; background-color: #efefef; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-left-color: rgb(207, 155, 0); border-left-style: solid; border-left-width: 5px; font: normal normal normal 1em/1.5 'Courier News', monospace, bold; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 5px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;">opencv_haartraining -data haarcascade -vec samples.vec -bg negatives.dat -nstages 20 -nsplits 2 -minhitrate 0.999 -maxfalsealarm 0.5 -npos 250 -nneg 99 -w 160 -h 20 -nonsym -mem 2048 -mode ALL</pre>
<br />
This creates the haarcascade xml file desired by us in the same Haar_training folder, keeping all the meta data, that is forms in the meanwhile in the haarcascade folder, which is created automatically. The arguements to be noted in the above command are<br />
<br />
haarcascade : The folder in which meta data can be kept<br />
samples.vec : The unified training data, that we created just a while ago, before this command<br />
negatives.dat : The list of negative image paths<br />
20 - Stages, the more, the better, but great time consumer<br />
99 - No. of negative images<br />
2048 - The RAM memory that can be used<br />
<br />
It took me five hours for this process to complete and generate my final pen detector. If you are a bit skeptic about the final outcome, instead of waiting for five hours, at any time, when the above command is running, you can issue the below command, to generate a intermediate haar cascade xml file, from the data available.<br />
<span class="Apple-style-span" style="font-family: "arial" , "helvetica" , sans-serif; font-size: 13px;"></span><br />
<pre style="background-attachment: initial; background-clip: initial; background-color: #efefef; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-left-color: rgb(207, 155, 0); border-left-style: solid; border-left-width: 5px; font: normal normal normal 1em/1.5 'Courier News', monospace, bold; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 5px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;">./convert_cascade --size="160x20" haarcascade haarcascade-inter.xml</pre>
Now finally after five hours, I got the haar cascade xml file. As I have shown you, in the previous posts, the way to use haar cascade xml files. I experimented on some pens of my own. Below is the youtube video for it.<br />
<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="345" src="https://www.youtube.com/embed/j75MqwFxb1A" width="640"></iframe><br />
<br />
<br />
<br />
<br />
<b>Update (16 March, 2012):</b> On the request of people I am sharing the haar classifier file for Pen detection. Below it the link for it.<br />
<br />
<a href="https://skydrive.live.com/redir.aspx?cid=124ec5b5bc117437&resid=124EC5B5BC117437!162&parid=124EC5B5BC117437!103&authkey=!ACKyT-9Z85Lz84M" rel="nofollow" target="_blank">Pen detector</a><br />
<br />
Please note that I used very less sample images, less than a 100 to create it, while in reality we use at-least 5000-10000 images to create a robust classifier. So, it may give false positives in some cases<br />
<br />
<b>Update (25 March,2012)</b>: The link to the executable Linux files that I gave earlier is slowly loading or sometimes not working at all. So here's the new link for it<br />
<br />
<a href="https://1drv.ms/u/s!Ajd0Eby1xU4SgRHZXiHzRcaOu7Ow" rel="nofollow" target="_blank">Linux Executables</a><br />
<br />
<b>Update (16 Nov,2012)</b>: Some of the commands, go out of page. For them select the first few words of the command; press shift+end; and then copy<br />
<br />
Hit the +1 below if you found this blog helpful :) </div>
Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com190tag:blogger.com,1999:blog-4044325358277577506.post-31840032519265453182011-06-17T00:24:00.000-07:002011-06-17T03:00:07.589-07:00Face + Eye detector<div dir="ltr" style="text-align: left;" trbidi="on">In my previous post, I showed you how to use your webcam to do face detection.In this post, I will explain you of how to use your webcam for eye and face detection.<br />
<br />
Before we start, for those of you who couldn't use your webcam for face detection, I have ripped the code from previous post to make a code that takes an image as input and returns the same image with a rectangle drawn over the face as output.Here's the link for it<br />
<br />
<a href="http://www.mediafire.com/?cs8yw8c4nfaif">http://www.mediafire.com/?cs8yw8c4nfaif</a><br />
<br />
Let's go straight into our eye +face detector.Before you go inside the code, first check the face detector , because most of the code here is hacked from it.Check it out here<br />
<br />
<a href="http://www.opencvuser.co.cc/2011/06/face-detector.html">http://www.opencvuser.co.cc/2011/06/face-detector.html</a><br />
<br />
Here's the code for eye+face detector using your inbuilt webcam.Also note that, there is no robust eye detector related cascase file (XML file) till date.I have tested and included the most powerful one.But neverthless, if you have spectacles, remove them during testing.<br />
<br />
<br />
<br />
<pre class="brush : cpp">//Programme to detect faces through the webcam using the haar cascade
//Links Used:http://www.opencvuser.co.cc/2011/06/face-detector.html
#include<stdio.h>
#include<cv.h>
#include<highgui.h>
CvHaarClassifierCascade *cascadeface,*cascadeeyes,*cascadenose,*cascademouth;
CvMemStorage *Membuffer;
void detectfaces(IplImage *frame)
{
int i;
CvSeq *faces=cvHaarDetectObjects(frame,cascadeface,Membuffer,1.1,3,0,cvSize(30,30));//Maximum 3 neighbourhood images and the last cvsize gives minimum size of face
for(i=0;i<(faces?faces->total:0);i++)
{CvRect *r=(CvRect *)cvGetSeqElem(faces,i);
cvRectangle(frame,cvPoint(r->x,r->y),cvPoint(r->x+r->width,r->y+r->height),CV_RGB(255,0,0),1,8,0);
//cvSetImageROI(frame,*r);
//Draws a rectangle with two points given with color of red and thickness as 8 and line type - 1
}
}
void detecteyes(IplImage *frame)
{
int i;
CvSeq *eyes=cvHaarDetectObjects(frame,cascadeeyes,Membuffer,1.1,3,0,cvSize(10,10));//Maximum 3 neighbourhood images and the last cvsize gives minimum size of eyes
for(i=0;i<(eyes?eyes->total:0);i++)
{CvRect *r=(CvRect *)cvGetSeqElem(eyes,i);
cvRectangle(frame,cvPoint(r->x,r->y),cvPoint(r->x+r->width,r->y+r->height),CV_RGB(0,255,0),1,8,0);
//Draws a rectangle with two points given with color of red and thickness as 8 and line type - 1
}
}
int main(int argc,char *argv[])
{IplImage *frame;
CvCapture *capture;
int key,i;
cascadeface=(CvHaarClassifierCascade *)cvLoad("haarcascade_frontalface_alt.xml",0,0,0);
cascadeeyes=(CvHaarClassifierCascade *)cvLoad("haarcascade_eye_tree_eyeglasses.xml",0,0,0);
//Loading the haar... file
Membuffer=cvCreateMemStorage(0);//Allocating the default memory for image (64K at Present)
capture=cvCaptureFromCAM(0);//Capture the image from cam with index 0
assert(cascadeface && cascadeeyes && Membuffer && capture);
cvNamedWindow("Video",1);
while(key!='q')
{frame=cvQueryFrame(capture);
if(!frame)
break;
//cvFlip(frame,frame,-1);//Uncomment this if you are getting inverted video
frame->origin=0;
detectfaces(frame);
detecteyes(frame);
cvShowImage("Video",frame);//For showing the video
key=cvWaitKey(10);
}
cvReleaseCapture(&capture);
cvDestroyWindow("Video");
//cvReleaseHaarClassifierCascade(&cascade);
cvReleaseMemStorage(&Membuffer);
}
</pre><br />
<br />
The downloadable Linux executable and the two XML files I used, along with the original program are in the below link<br />
<br />
<br />
<a href="http://www.mediafire.com/?u167ycmi1jz3w">http://www.mediafire.com/?u167ycmi1jz3w</a><br />
<br />
For any doubts, use the comments section.<br />
<br />
Don't have the time for making video, will upload soon.</div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com3tag:blogger.com,1999:blog-4044325358277577506.post-76796212565096242652011-06-15T09:08:00.000-07:002012-04-23T05:43:32.555-07:00Face detector<div dir="ltr" style="text-align: left;" trbidi="on">
Today, let's take an important step towards face recognition - face detection<br />
<br />
First, let me tell you the difference between both.Face detection is just telling whether there is a face or not in the given image, on the other hand, face recognition is telling to which person that face belongs.<br />
<br />
This is the code for face detection using your webcam.Actually, this is not exclusively my code, I hacked it from the code given by Nashruddin which inturn was hacked from the openCV samples.Any way, that's what makes the open source software better and better forever :)<br />
<br />
Here's the code snippet<br />
<pre class="brush : cpp">//Programme to detect faces through the webcam using the haar cascade
//Links Used:http://nashruddin.com/OpenCV_Face_Detection
#include<stdio.h>
#include<cv.h>
#include<highgui.h>
CvHaarClassifierCascade *cascade;
CvMemStorage *Membuffer;
void detectfaces(IplImage *frame)
{
int i;
CvSeq *faces=cvHaarDetectObjects(frame,cascade,Membuffer,1.1,3,0,cvSize(30,30));//Maximum 3 neighbourhood images and the last cvsize gives minimum size of face
for(i=0;i<(faces?faces->total:0);i++)
{CvRect *r=(CvRect *)cvGetSeqElem(faces,i);
cvRectangle(frame,cvPoint(r->x,r->y),cvPoint(r->x+r->width,r->y+r->height),CV_RGB(255,0,0),1,8,0);
//Draws a rectangle with two points given with color of red and thickness as 8 and line type - 1
}
cvShowImage("Video",frame);
}
int main(int argc,char *argv[])
{IplImage *frame;
CvCapture *capture;
int key;
char filename[]="haarcascade_frontalface_alt.xml";//This is the cascading file that is needed for face detector it is generally present in if openCV is your installation folder, it is present in openCV/data/haarcascades folder, don't forget to paste the haarcascade file in the same folder as your program before compiling
cascade=(CvHaarClassifierCascade *)cvLoad(filename,0,0,0);
//Loading the haar... file
Membuffer=cvCreateMemStorage(0);//Allocating the default memory for image (64K at Present)
capture=cvCaptureFromCAM(0);//Capture the image from cam with index 0
//Note that if you are using a Laptop with an external webcam it has an index 1 since the Lappie cam's index is 0
assert(cascade && Membuffer && capture);//To make sure that everything needed is always available
cvNamedWindow("Video",1);
while(key!='q')
{frame=cvQueryFrame(capture);
if(!frame)
break;
//cvFlip(frame,frame,-1);//If you are using openCV on windows, uncomment this line
frame->origin=0;
detectfaces(frame);
key=cvWaitKey(10);//Wait for 10 milli seconds, the user may press 'q'
}
cvReleaseCapture(&capture);
cvDestroyWindow("Video");
cvReleaseHaarClassifierCascade(&cascade);
cvReleaseMemStorage(&Membuffer);
}
</pre>
For your convenience, I have added the comments in the code above.Don't bother if you feel lazy to copy the content.I kept the above program and the haar cascade xml file that you need to use in the link below.<br />
<br />
<br />
<a href="http://www.mediafire.com/?pg798glb1j44r"><img alt="http://www.free-car-magazines.com/images/download-button-animated.gif" src="http://www.free-car-magazines.com/images/download-button-animated.gif" /></a><br />
<br />
I know, some of you are even lazy to, compile the code, so I have included a Linux executable in the above download link.<br />
<br />
And this is a bonus, a youtube video of me with my face detector.I shot the video with poor lighting conditions and a VGA cam, that's why not a good one (I look 10 times more handsome), but serves the purpose<br />
<br />
<object height="344" width="425"><param name="movie" value="http://www.youtube.com/v/qk-VYYk3yis?hl=en&fs=1">
</param>
<param name="allowFullScreen" value="true">
</param>
<param name="allowscriptaccess" value="always">
</param>
<embed src="http://www.youtube.com/v/qk-VYYk3yis?hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
<br /></div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com4tag:blogger.com,1999:blog-4044325358277577506.post-14342129746939322962011-06-14T07:13:00.000-07:002012-03-25T00:57:24.146-07:00Code snippets<div dir="ltr" style="text-align: left;" trbidi="on">
Before you use the snippets, I hope you installed openCV, compiled and understood the helloworld program given in the following website.<br />
<br />
<a href="http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html" rel="nofollow" target="_blank">http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html</a><br />
<br />
If not go back to my previous posts<br />
<br />
All the code in the snippets will be similar to that of hello world program as shown below<br />
<br />
<pre class="brush : cpp">//Program to create the negative of a given image
//Links used:http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/
#include<stdio.h>
#include<cv.h>
#include<highgui.h>
int main(int argc,char *argv[])
{int i,j,k;
IplImage *img=0;
int height,width,step,components;
uchar *data;
if(argc==0)
{printf("Could not load image");
return 0;
}
//Loading image
img=cvLoadImage(argv[1]);
if(img==0)
{printf("Image loading error");
return 0;
}
//Assigning data
height=img->height;
width=img->width;
step=img->widthStep;
components=img->nChannels;
data=(uchar *)(img->imageData);
printf("The picture's size is %d X %dnThe image has %d componentsnEach step length is %dn",height,width,components,step);
//To get the negative of image
for(i=0;i<height;i++)
for(j=0;j<width;j++)
for(k=0;k<components;k++)
data[i*step+j*components+k]=255-data[i*step+j*components+k];
cvNamedWindow("Lena",CV_WINDOW_AUTOSIZE);
cvMoveWindow("Lena",50,50);
//Showing the image
cvShowImage("Lena",img);
cvSaveImage("Lenanegative.jpg",img);
//Waiting for a key press
cvWaitKey(0);
//Releasing the image
cvReleaseImage(&img);
return 0;
}
</pre>
<br />
The code snippets contain three additional problems and their folder names are as follows :<br />
<br />
<br />
<ol style="text-align: left;">
<li>MnMdVr - This folder contains the finding of mean, median and standard deviation of image, using openCV inbuilt functions and some hacking of the helloworld.cpp code, which you wrote previously</li>
<li>Block-Processing - This is same as above, except, the finding of mean, median and variance are found block wise, like for every 20x20 pixels or so</li>
<li>Sobel - This one contains the famous sobel edge detection technique, very simple one</li>
</ol>
<br />
<br />
This is the link for code snippets<br />
<br />
<a href="https://skydrive.live.com/redir.aspx?cid=124ec5b5bc117437&resid=124EC5B5BC117437!164&parid=124EC5B5BC117437!103&authkey=!AC_k7uoQwp2FOso" rel="nofollow" target="_blank">Code Snippets</a>
<br />
<br />
If the link goes down, tell me in the comments section, I will correct it.Also if you have any doubts understanding the code snippets, do comment them.<br />
<br />
So keep trying to understand the code.If you already did the home work yourself, then very good.<br />
<br />
If you have come this far, it is just a few steps away.On thursday, we will discuss about face detection and then saturday and sunday, we will drill down the most important topic -- "Haar Training"<br />
<br />
And one more thing, from next post on, I will be personally posting and analyze the code snippets for you, step by step.</div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0tag:blogger.com,1999:blog-4044325358277577506.post-70358049349395884502011-06-13T07:14:00.000-07:002011-06-13T07:14:28.383-07:00Face recognition<div dir="ltr" style="text-align: left;" trbidi="on">Today, let me tell you about the importance of face recognition and why is it the most sought out research in the present decade.You may have already been using the "iphoto" from Apple, which lets you name people once and then it automatically searches through your entire photo library and names them.That's face recognition.Let me tell you something more.What if it names wrong ?<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX3FmNmYWLXYo8ZqWXYADvqmg-dBkp9wR-Xvddc5xyI0FfS4MUyrG9JDqs0JhxY7neo0XvTS0Uk2ggbaAey9rwoq_B8zqRgiNLrpNbe6B4RjX6bEgqU3DITBvJ1qubJSlVI2DquwzWt5c/s1600/face_x220.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX3FmNmYWLXYo8ZqWXYADvqmg-dBkp9wR-Xvddc5xyI0FfS4MUyrG9JDqs0JhxY7neo0XvTS0Uk2ggbaAey9rwoq_B8zqRgiNLrpNbe6B4RjX6bEgqU3DITBvJ1qubJSlVI2DquwzWt5c/s1600/face_x220.jpg" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 13px;">Credit: Simson Garfinkel and Beth Rosenberg</span></td></tr>
</tbody></table><br />
<br />
Here's the greatness of Apple, it updates it mathematical model and becomes more robust.Some times it may ask you doubts also, like a small child learning to crawl :)<br />
<br />
Google's picasa also offers, I hadn't tested it, but reviews say it is in no way the nearest competitor to Apple.You may have already heard of facebook auto tagging feature, which is a very great idea, but facebook should not have automatically enabled that feature in all accounts.And the latest news is that Google's trying to take advantage of it.It's former CEO Eric Schmidt appealed to the US government that it's a threat to national security.You may have already heard of facebook hiring a private agency to launch "article" attack on google.That's a wholly different story let's come back to our topic.<br />
<br />
Apart from fun, actually the main reason why face recognition had to be invented and to be moved forward like a crusade is the security threats.Reports say that after the 9/11 attacks, the US government has been heavily investing on this, so that the technology can be applied in airports, railway stations and other public places to detect terrorists.But whenever the terrorist grows some beard or changes hair style or face color, it fails.Although recently more scientists claim that they have discovered the best technologies, there is no clear winner in this arena, due to the diversity in the testing procedures.Some facial recognition technologies use one image per person, while others need more than four images per person, and some need facial landmark locations accurately.In order to over come this a common facial recognition test need to be conducted using the same data for all.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX1eeZ06fhRphuYds2ugV7KOatpxCyxPpJPT-qF2sNxlb7kPpJCGKltEZwimH3mtlP-1nZsyssbGODM-E0qAtF7E5BIkqunzgzuNQ69OPy9OQ9Sd6kUNJlPHR_LGFPmgYv1pNCzb4coKo/s1600/FRGC_logo.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX1eeZ06fhRphuYds2ugV7KOatpxCyxPpJPT-qF2sNxlb7kPpJCGKltEZwimH3mtlP-1nZsyssbGODM-E0qAtF7E5BIkqunzgzuNQ69OPy9OQ9Sd6kUNJlPHR_LGFPmgYv1pNCzb4coKo/s1600/FRGC_logo.gif" /></a></div><br />
This need is discovered by the Us Government early on and they have carried out these tests for every four years or so.They started the tests in 1993 and successively conducted on 1993, 1994, 1996, 2000.Recently they started a new format for testing called "Face Recognition Grand Challenge" (FRGC).The most recent one is the FRVT 2006.They may conduct another one in 2012<br />
<br />
If your college or university wants to participate in that evaluation, you can visit their home page.Below is the link for it<br />
<br />
<a href="http://www.frvt.org/FRGC/">http://www.frvt.org/FRGC/</a><br />
<br />
More about face recognition later on.<br />
<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">I hope you are doing well with the assignments, tommorrow I will post all the code snippets for the assignments I gave you.By the end of this month you will be pursuing the research on face recognition I assure you.If you are a first timer, visiting this blog, you can view the archives in the right hand side.</div></div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0tag:blogger.com,1999:blog-4044325358277577506.post-26954989609028607722011-06-12T05:11:00.000-07:002011-06-12T05:11:12.415-07:00Keep working<div dir="ltr" style="text-align: left;" trbidi="on">I expect every one of you is going forward with the assignments.There are some more confusing terms you will encounter while doing the assignments, let me give some details<br />
<br />
<br />
<ol style="text-align: left;"><li>Step - A step is the number of column pixels present in an image.So for every step, the height of the image increases by one step</li>
<li>Components - They are equivalent to channels, so for an RGB image, there are 3 components (Red, Green, Blue) and for a grey scaled image, there is 1 component (White)</li>
<li>Resolution - This is the dimension of the image, in simple terms it is number of row pixels / number of column pixels</li>
</ol><div>Also this is one of the links that I forgot to give, it gives the best possible documentation for openCV</div><div><br />
</div><div><a href="http://www710.univ-lyon1.fr/~bouakaz/OpenCV-0.9.5/docs/ref/OpenCVRef_ImageProcessing.htm">http://www710.univ-lyon1.fr/~bouakaz/OpenCV-0.9.5/docs/ref/OpenCVRef_ImageProcessing.htm</a></div><div><br />
</div><div>You can hack the code given in the below link to perform display histograms</div><div><br />
</div><div><a href="http://xa.yimg.com/kq/groups/1986690/1513778415/name/cvHistogram.c">http://xa.yimg.com/kq/groups/1986690/1513778415/name/cvHistogram.c</a></div><div><br />
</div><div>Keep going forward with enthusiasm and curiosity, I have a time frame for this blog to complete the tutorial in the next 25 posts, but I may take a leave in the middle after the 30th of this month for 20 days, will try to complete it before that.I want to take you people till face recognition and leave you there for furthur research</div></div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0tag:blogger.com,1999:blog-4044325358277577506.post-69159106530872689242011-06-10T20:09:00.000-07:002011-06-10T20:09:02.679-07:00Coding - Image Processing<div dir="ltr" style="text-align: left;" trbidi="on">I hope you already did the Hello World programme mentioned in the previous to previous post.For today, I will give you some assignments, try to do them.Take help of openCV documentation and the Hello World programme you had already written.Try to use the already available functions in openCV library as much as you can<br />
<br />
<br />
<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4LhevnEN5ZK6QJsWcimnL_9p8EQagKQFVtb4dxsmQ_Ujv-3qdLrJBlIHSnD2HSd8b3nniJJ5rYeccNxLDGrybHyton_0kD1lYVj4-6TOAGlM7GwKOVhY5ZeJUhe9ldF-3kexBM6osSOg/s1600/lena.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4LhevnEN5ZK6QJsWcimnL_9p8EQagKQFVtb4dxsmQ_Ujv-3qdLrJBlIHSnD2HSd8b3nniJJ5rYeccNxLDGrybHyton_0kD1lYVj4-6TOAGlM7GwKOVhY5ZeJUhe9ldF-3kexBM6osSOg/s320/lena.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Orginal Color Image</td></tr>
</tbody></table><br />
1.Make a color image into a grey scale image<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNKzd5FjU5R8hHZevZ1E2-kVLA_iyQMtFBaBnKbdiJBPrqjqG1R1h1jwRoJKHbE3lSCMgGtmXnPxbcnZQzNtzUhDpdZip1oue8egvkUAlRe3LqttjsqPVqVf5rkLIQ8a-6FbOYZtmduD8/s1600/LenaBW.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNKzd5FjU5R8hHZevZ1E2-kVLA_iyQMtFBaBnKbdiJBPrqjqG1R1h1jwRoJKHbE3lSCMgGtmXnPxbcnZQzNtzUhDpdZip1oue8egvkUAlRe3LqttjsqPVqVf5rkLIQ8a-6FbOYZtmduD8/s320/LenaBW.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Grey scale Image</td></tr>
</tbody></table><br />
2.Produce a negative of an image (Already over - helloworld)<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4cXtPYCRcj180rCq_7uErA0R6wSi9UF-yILZziwE7e_kQy0kdowm517BLDdOr_UI7aFPf1pIfbVumEzxJuskXEInuC1wUtM1aSuXxjbP5tzkv7Pby12PY86dq2cJAGvev8kHn3WuZFxo/s1600/Lenanegative.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4cXtPYCRcj180rCq_7uErA0R6wSi9UF-yILZziwE7e_kQy0kdowm517BLDdOr_UI7aFPf1pIfbVumEzxJuskXEInuC1wUtM1aSuXxjbP5tzkv7Pby12PY86dq2cJAGvev8kHn3WuZFxo/s320/Lenanegative.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Negative Image</td></tr>
</tbody></table><br />
3.Make a grey scale image, pure black and white (You can use the hint I mentioned in the previous post)<br />
<br />
4.Apply patches of 4 different colors to an images<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSp7Ih7EX726enV3DgoaH8TYfVOQf_O-_5MVT-B3uIq0ynEW-bZqa80fVllURIoD7-PuWsBMCE6-dAgsvH1977VtGZe8F2xqE0XS0K2vqeOM-HQt2B1EB5XrSsb5b7N3smdyYZD4ooMk0/s1600/LenaPatch.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSp7Ih7EX726enV3DgoaH8TYfVOQf_O-_5MVT-B3uIq0ynEW-bZqa80fVllURIoD7-PuWsBMCE6-dAgsvH1977VtGZe8F2xqE0XS0K2vqeOM-HQt2B1EB5XrSsb5b7N3smdyYZD4ooMk0/s320/LenaPatch.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Patched Image</td></tr>
</tbody></table><br />
5.Calculate the mean, variance and standard deviation of the image<br />
<br />
6.Create the histogram of an image, it should be printed as a seperate image<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL6IdkcK8x8dgIl4Xyao4Ac-Hpdekg4iH8P5CBjN8ny5hajXPfG0hn-axSZa_YPL7mosDWt1QI3fvTflUXZ-E5d-BTOaB-v7poDJcf3nZ1A8FqEvxKu161mJJSPwNoy8WGh7tII59EDRI/s1600/Histogram_BluePlane.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL6IdkcK8x8dgIl4Xyao4Ac-Hpdekg4iH8P5CBjN8ny5hajXPfG0hn-axSZa_YPL7mosDWt1QI3fvTflUXZ-E5d-BTOaB-v7poDJcf3nZ1A8FqEvxKu161mJJSPwNoy8WGh7tII59EDRI/s1600/Histogram_BluePlane.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Blue Pane</td></tr>
</tbody></table><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh66KNYmG79nnydPgKK7sCGbwofXrk45ZN-E8n0FJYJPzbftpgImxn5EIz6U7M1oYYoee7s0hX2b08e8fJGa9YBzi-FIHbFEwpqH8gJRxOIrjbm_uSTDRfoZAectem4V6NTKhkOzMyOjIE/s1600/Histogram_GreenPlane.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh66KNYmG79nnydPgKK7sCGbwofXrk45ZN-E8n0FJYJPzbftpgImxn5EIz6U7M1oYYoee7s0hX2b08e8fJGa9YBzi-FIHbFEwpqH8gJRxOIrjbm_uSTDRfoZAectem4V6NTKhkOzMyOjIE/s1600/Histogram_GreenPlane.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Green Pane</td></tr>
</tbody></table><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimdR2Nu3BaIPivTobpWbMpRXEfUqlsn8n4-0Coe2BIx3EHDoJwi2wOQ73klTutftYLK3MVrY8jMtbDVh0F3iUZkkXOxc_OqhrZImMbrxVLk6SmGsNe_ItSYS7lBZyO1_FE0xsCP7PxWnA/s1600/Histogram_RedPlane.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimdR2Nu3BaIPivTobpWbMpRXEfUqlsn8n4-0Coe2BIx3EHDoJwi2wOQ73klTutftYLK3MVrY8jMtbDVh0F3iUZkkXOxc_OqhrZImMbrxVLk6SmGsNe_ItSYS7lBZyO1_FE0xsCP7PxWnA/s1600/Histogram_RedPlane.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Red Pane</td></tr>
</tbody></table><br />
Histogram is a graph, which plots the intensity of a color versus all the pixels in the image.It shows the intensity of that color at every pixel value of the image.So for an RGB image there will be three different histograms each corresponding to a different color and for grey scale only one.<br />
<br />
If you have any doubts post them in the comments section and I am giving you three days of time to accomplish these tasks, meet you again on Tuesday</div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0tag:blogger.com,1999:blog-4044325358277577506.post-65397371306484393612011-06-09T20:31:00.000-07:002011-06-10T10:34:32.618-07:00Image Processing<div dir="ltr" style="text-align: left;" trbidi="on">Most of you may have worked with Adobe Photoshop or Picknik or gimp or other image processing software.Ever wondered, what is the actual thing going on there or how an image gets processed, how it is turned to blur or how it is filtered or what are the principles behind RGB, Grey Scale etc., If you are one among the few who likes to know and want to do it programmatically, it is just a applying a few functions with openCV and this is the most basic necessity for which openCV is created.For today let's discuss theory and tommorrow we will do programming.These are the standard def's of some of the main terms used in image processing<br />
<br />
<span class="Apple-style-span" style="background-color: white;"><b>Pixel</b> </span>- Stands for "Picture Element".It is the basic unit of an image, just like seconds for time<br />
<br />
<b>Binary image</b> - These are the oldest formats of images and most of these are oblivion, since it contains only two colors "Black" and "White" and each pixel is of just one bit, if it is 0 --> black and if it's 1-->White<br />
<br />
<b>Grey Scale Image</b> - This is normally referred to as Black and white image and it's pixel consists of 8bits.If all those are zeros, then it is black and if all those are ones, then it is white and in the between values you will see the variations of colors obtained by the intermixing of black and white.<br />
<br />
<i>Note</i> : And important point to note here is that although Binary images should be called Black and White, they are not called so. Hence in your Black and White TV, or any Black and White image you take, mostly you will see a variation of black and white colors, which are not exactly white nor exactly black.Remember, these are grey scale images actually.<br />
<br />
<b>RGB Image</b> - This is normally referred to as color image and it's pixel consists of 24 bits, 8bits for each of Red, Blue and Green.You must have already known that the intermixing of these primary colors produces almost all the colors.If all the 24 bits are ones, you get a white image and if all are black, you get a black image<br />
<br />
<i>Note</i> : Ever wondered, when people talk about 16 million colors, it's very simple, taking all the 24 bits as unit (although internally divided), we can change each bit as either 0 or 1, that gives us 2^24 or 16 million colors. Take a look at the below picture<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Rgb-compose-Alim_Khan.jpg/800px-Rgb-compose-Alim_Khan.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="211" src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Rgb-compose-Alim_Khan.jpg/800px-Rgb-compose-Alim_Khan.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-family: sans-serif; font-size: 12px; line-height: 15px;">A photograph of <a href="http://en.wikipedia.org/wiki/Mohammed_Alim_Khan" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #0645ad; text-decoration: none;" title="Mohammed Alim Khan">Mohammed Alim Khan</a> (1880-1944),<a class="mw-redirect" href="http://en.wikipedia.org/wiki/Emir_of_Bukhara" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #0645ad; text-decoration: none;" title="Emir of Bukhara">Emir of Bukhara</a>, taken in 1911 by <a class="mw-redirect" href="http://en.wikipedia.org/wiki/Sergei_Mikhailovich_Prokudin-Gorskii" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #0645ad; text-decoration: none;" title="Sergei Mikhailovich Prokudin-Gorskii">Sergei Mikhailovich Prokudin-Gorskii</a> using three exposures with red, green, and blue filters. (Courtesy : Wikipedia)</span></td></tr>
</tbody></table><br />
The three pictures on the right side are black and white images, taken with red, green and blue filters, later on they are projected and combined to give a full color image.This was one of the earliest forms of taking color photographs<br />
<br />
We normally when referring to the 8 bits, we don't use bit wise language which will be a bit confusing, and so we will be using 0 for all 0's and 256 for all 1's and between 0 and 256 for the remaining (Simply using the decimal format, instead of binary format)<br />
<br />
<b>Channel</b> - Also called as component and this is the basic unit of pixel.The combination of 8bits is called a channel. So you can naturally say, that an RGB image is an 3 channelled image and Grey Scale image is an image with only one channel and generally we don't come across or discuss binary images at all, since bit wise representation is oblivion and it is generally ignored here and the rest of our journey with openCV.<br />
<br />
<i>Note</i> : Although due to their bit representation, binary images are oblivion, they are not completely gone.Using heuristics you can easily note that for a grey scale image keeping a threshold (eg:127), you can convert all the pixels greater than threshold into 256 and all of them that are below to 0's, speaking in decimal language.But the actual binary representation is lost here.There is an openCV function CVthreshold(), to do this.See the documentation part you downloaded in the previous post.<br />
<br />
This is it, take rest for today, but don't relax too much, because tommorrow it's going to be PROGRAMMING </div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0tag:blogger.com,1999:blog-4044325358277577506.post-49855731391344773612011-06-08T09:34:00.000-07:002011-06-08T09:34:42.793-07:00Installed openCV, so what's next ?<div dir="ltr" style="text-align: left;" trbidi="on">Now you have crossed the most important barrier and came till here.Most people I know left the openCV during the installation itself feeling the complexity.Anyways, openCV is not for normal people :)<br />
<br />
First of all, before getting started I want to introduce you to some links<br />
<br />
The most important of all is the below link, which contains all the basics of getting started with openCV, try to implement and run the HelloWorld programme mentioned in the website<br />
<a href="http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html">Introduction to programming with OpenCV</a><br />
<br />
Next, a common metting point for all openCV users in the world, just like a common meeting point for you with your friends is openCV users yahoo group.Join it<br />
<br />
<a href="http://tech.groups.yahoo.com/group/OpenCV/">OpenCV Yahoo Users group</a><br />
<br />
There is open CV 2.1 documentation available in the below link, download the pdf<br />
<a href="https://picoforge.int-evry.fr/projects/svn/gpucv/opencv_doc/2.1/opencv.pdf">https://picoforge.int-evry.fr/projects/svn/gpucv/opencv_doc/2.1/opencv.pdf</a><br />
<br />
And here's the official cheat sheet for it<br />
<a href="http://opencv.willowgarage.com/documentation/cpp/index.html">http://opencv.willowgarage.com/documentation/cpp/index.html</a><br />
<br />
The above two links contain all the basic functionalities that you can use with standard openCV library and their corresponding meaning and uses. While doing the hello world programme, I mentioned above, these documents can be used for reference to know, what each open CV function does<br />
<br />
The most important of all, compiling a C++ programme written in openCV, it's one of the lengthiest and you have no need at all to understand what it implies.Consider the name of your programme is "Hell.cpp" and you want a executable "Hell", below is the code for compiling it<br />
<br />
<pre></pre><pre>g++ Hell.cpp -o Hell \
-I /usr/local/include/opencv -L /usr/local/lib \
-lm -lcv -lhighgui -lcvaux</pre><br />
<br />
From the next post on, we start diving into the programming part, starting with image processing.</div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0tag:blogger.com,1999:blog-4044325358277577506.post-83678505031759721082011-06-07T22:27:00.000-07:002011-08-27T11:14:40.872-07:00Installing OpenCV<div dir="ltr" style="text-align: left;" trbidi="on"><div dir="ltr" style="text-align: left;" trbidi="on"><div style="text-align: center;"><div style="text-align: left;">If you have no Open Source OS installed still in your system, go to my <a href="http://opencvuser.blogspot.com/2011/06/before-installing-opencv.html">previous post</a> and there is a link to install openCV in windows. You can skip this post.</div></div><div><br />
</div><div>Also if you have openCV already in your system, skip this post.<br />
<br />
</div><div>OpenCV installing is very trivial and most of the sites tell you it's easy and give you four to five commands that get the things done quickly.But if you want to really harness the complete power of openCV, follow the steps below ( For Ubuntu, can be easily applied to other Linux based OS's )</div><div><br />
</div><div>1. Although OpenCV 2.2 is the latest version, 2.1 is more stable and has got enough libraries to keep you going.</div><div><br />
</div><div>2. Follow the below link to install openCV in a step by step manner (can be applied to all Ubuntu versions)</div><div><a href="http://www.samontab.com/web/2010/04/installing-opencv-2-1-in-ubuntu">http://www.samontab.com/web/2010/04/installing-opencv-2-1-in-ubuntu</a></div><div style="text-align: center;"><br />
</div><div>3. There is just one major step where you need to be carefull, the step where he tells you to check the below image</div><div><br />
</div><div><img alt="" border="0" src="http://www.samontab.com/web/wp-content/uploads/2010/04/Screenshot-samontab@grima17-OpenCV-2.1.0.png" style="cursor: hand; cursor: pointer; display: block; height: 461px; margin: 0px auto 10px; text-align: center; width: 666px;" /></div><div>4. Don't proceed for the next step in that website, till all the parts in the above image, are exactly like the ones you see in your system</div><div><br />
</div><div>This is the way, I resolved the dependencies...</div><div><br />
</div><div>For example, beside FFMPEG in the image, I have a zero, where I need to have one, so I open the Synaptic Package Manager and search for that term and install it and rerun the "cmake ."</div><div><br />
</div><div>5. Try the examples to check your openCV installation and have some fun in the last remnants of that post</div><div><br />
</div><div>6. That's it, you have openCV now and we can keep going from the next post</div><div><br />
</div><div>And one more thing, if you are interested in doing cool things with images or photography, this is a link from the same website (Not at all related to openCV)</div><div><br />
</div><div><a href="http://www.samontab.com/web/2010/11/free-photo-editing-software/">http://www.samontab.com/web/2010/11/free-photo-editing-software/</a></div><div><br />
<b>Update (20/06/11)</b> : Forgot to tell you the one most important thing, before doing anything in the site I have given, you need to run the following command<br />
<br />
<span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; font-size: 13px;"></span><br />
<pre style="background-attachment: initial; background-clip: initial; background-color: #efefef; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-left-color: rgb(207, 155, 0); border-left-style: solid; border-left-width: 5px; font: normal normal normal 1em/1.5 'Courier News', monospace, bold; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 5px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;">sudo apt-get install libavformat-dev libgtk2.0-dev pkg-config cmake libswscale-dev bzip2</pre></div>This will automatically let you over come the ffmpeg error.Also, keep in mind, if anytime while fetching the packages through terminal, you can see, unable to fetch sometimes.Then immediately run the same command with --fix-missing as suffix and keep running it, until you never see the error.The advantage of running the command with this suffix is, it only tries to get the missing files.So for the above command, if you see unable to fetch archives, simply run<br />
<br />
<span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; font-size: 13px;"></span><br />
<pre style="background-attachment: initial; background-clip: initial; background-color: #efefef; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-left-color: rgb(207, 155, 0); border-left-style: solid; border-left-width: 5px; font: normal normal normal 1em/1.5 'Courier News', monospace, bold; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 5px; padding-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px;">sudo apt-get install libavformat-dev libgtk2.0-dev pkg-config cmake libswscale-dev bzip2 --fix -missing</pre><br />
<br />
</div>Don't forget to hit "+1" below this post to make this blog reach more people</div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0tag:blogger.com,1999:blog-4044325358277577506.post-37295442319427448992011-06-07T19:35:00.000-07:002011-06-07T20:12:35.072-07:00Before Installing OpenCV<div>This post is just for the people, who don't have any open source OS or Mac in their computer.For those, who have, you can skip this post.</div><div><br /></div>Hey, let's come back to the installing openCV part in the next post.But first of all, let me tell you one thing, if you are on windows and are planning to learn openCV with the help of Visual Studio or Visual C++ bla bla bla, you will find yourself eventually in a very dangerous position.<div><br /></div><div>I don't say windows is bad.Windows is one of the awesome softwares made in the previous century, but if you are planning to become a serious DEV, in todays world, you have to shift in to one of the Open Source Operating Systems.One more thing people say and a common rumour is that these OS's are not user friendly and they are very unstable.Neverthless, no open source is as robust as windows and the things you hear are partially true.But most of the supporting libraries for openCV and the openCV user community is not inclined to this and you need to install a lot of libraries that may make your system unstable some times.But, if you still plan to go for it, here's the link and don't forget to skip the rest of this post.</div><div><br /></div><div><a href="http://www.aishack.in/2010/02/installing-and-getting-opencv-running/">http://www.aishack.in/2010/02/installing-and-getting-opencv-running/</a></div><div><br /></div><div>If you dare to take a step forward in your learning, and why I supported Windows in the above paragraph.....</div><div><br /></div><div>What's ringing in your head is true, I want you to keep windows in your machine, till you get acquainted with the new OS or you will get bored of it (Either ways, you can go back to your old OS or gain some knowledge).</div><div><br /></div><div>Personally, I recommend Ubuntu, and more preferrably install any version between 9.10 and 10.10.If you want to get started with Ubuntu, you can search for a free E-book "Ubuntu Pocket Guide", a relatively small one, that seriously gives you the confidence of a dev.</div><div><br /></div><div>Ok, we will come back to our point, straight forwardly, I want you to dual boot your machine with Ubuntu.But if you are just a normal guy, who had no knowledge of installing OS, I recommend going with "Wubi" installer.The best thing about Wubi is, it lets you install Ubuntu just like any other Program in the control panel, and you can uninstall it with just a single click.More help about using Wubi, downloading and installing at the below link</div><div><br /></div><div><a href="http://www.ubuntu.com/download/ubuntu/windows-installer">http://www.ubuntu.com/download/ubuntu/windows-installer</a></div><div><br /></div><div>One more serious thing to consider, while installing is that, it asks for you to install in some drive, try to make a seperate drive for it.If you don't know this, no problem, here's your step by step guide about creating a drive or volume or partition (all are same, as per windows terminology)</div><div><br /><a href="http://windows.microsoft.com/en-US/windows-vista/Create-and-format-a-hard-disk-partition">http://windows.microsoft.com/en-US/windows-vista/Create-and-format-a-hard-disk-partition</a></div><div><br /></div><div>I am stressing this because even though you can allocate a space of some 10GB, in your drive with some 70 GB space, when you switch to Ubuntu, none of this 70 GB you can see, but you can see the other drives.</div><div><br /></div><div>If you don't like experimenting, install Ubuntu in the smallest drive in your system or the drive that contains no important information.</div><div><br /></div><div>While installing with Wubi, it restarts itself and when restarting, there will be two options, either windows or Ubuntu, make it go into Ubuntu to complete the installation part.After that when ever you start your system, you will have both Windows and Ubuntu for dual boot and if you want to uninstall, just go to control panel in Windows and check for Ubuntu and press uninstall.And one more thing, 15 GB is good enough space for Ubuntu and if you plan to give more, 20 GB is more than enough.In the next post, let's see about installing openCV</div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com2tag:blogger.com,1999:blog-4044325358277577506.post-46677942465560867932011-06-07T11:41:00.000-07:002013-02-07T23:21:26.247-08:00How to learn Open CV ?<div dir="ltr" style="text-align: left;" trbidi="on">
If you already know a programming language, you are halfway through, since it's only a library and mostly it provides single line functions, that make the most complex tasks easier.<br />
<div>
<br /></div>
<div>
I personally don't recommend any book, since I have never read any book and have no patience to read <i>except novels</i> :)</div>
<div>
<br /></div>
<div>
All the examples I provide will be related to C-language and you can easily get it and understand correlating with other languages.</div>
<div>
<br /></div>
<div>
I will start with image processing and take you slowly to the part where open cv can be used to perform Face Recognition. One thing I want to mention here is that there is no robust face recognising software in the market.Yes, it's the truth.The one I demonstrate, also will not be, but you can use your creativity...</div>
<div>
<br /></div>
<div>
And one more thing, don't read all the posts at a time, each day follow a post and go into it thoroughly.Yeah, now coming to the titled topic, this is the starting step, which will be in my next post ..</div>
<div>
<br /></div>
<div>
Installing Open CV</div>
<div>
<br /></div>
</div>
Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0Bangalore Urban, Karnataka, India12.86987121370732 77.65498750468748312.37417571370732 77.009540504687479 13.36556671370732 78.300434504687487tag:blogger.com,1999:blog-4044325358277577506.post-4805142105544689972011-06-07T11:32:00.000-07:002011-06-10T21:11:55.191-07:00What is Open CV<div dir="ltr" style="text-align: left;" trbidi="on">What is Open CV ?<br />
<div><br />
</div><div>Open CV stands Open Computer Vision Library, created by Intel to shower their Processor power, but eventually became the tool for machine learning.<br />
<div><br />
</div><div>So why you need to learn open CV and what it will hold up to in your future ?</div></div><div><br />
</div><div>Open CV has become the defacto library for image processing and face recognition methods and there is a large community based support for open CV. It provides all the simple tools in the form of functions that make the most complex tasks in image processing easier.One more important things is that every one knows the future is "Robotics", and open CV provides you with the most exciting features to pursue your career in Computer vision.</div><div><br />
</div><div>Although it primarily supports C++, it's libraries are found in other languages like Java, Matlab etc.,</div><div><br />
</div><div>Here is the official wiki page</div><div><a href="http://opencv.willowgarage.com/wiki">http://opencv.willowgarage.com/wiki</a></div><div><br />
</div></div>Dileephttp://www.blogger.com/profile/02950371806239918581noreply@blogger.com0