dimanche 24 février 2013

What is biometric?


A biometric is a measurement of a biological characteristic such as fingerprint, iris pattern, retina image, face  or a behavioural characteristic such as voice, gait or signature. Using biometrics for identifying human beings offers some unique advantages. Biometrics can be used to identify you as you using some biometric  characteristics to identify individuals automatically. Biometric characteristic are very interesting since they are universally present, unique to the individual, stable over time and easily measurable.
Actually biometrics can be used to answer two principal questions:
• Are you who you claim to be?
• Who are you?
  • Are you who you request to be?

Confirming that someone is who they request to be usually relies on something that they possess, such as a security pass, or something that they know, such as a password. Nontheles nothing can provide absolute confidence as security passes can be stolen and passwords are often written down. 
Biometric technology offers an additional level of confidence, but with the disadvantage that, unlike a password, a person’s characteristics are not secret and can therefore be copied. To confirm an individual’s identity, their biometric is scanned, converted into electronic form and stored either on a card that remains in their possession or in a database.
  • Who are you?

It is possible to answer the question ‘who are you?’ if you are saved in the system database .The biometric of the unknown person is compared against the database in a ‘one-to-many’ search. Their identity can be determined if their biometric has been entered onto the database on a previous occasion.

jeudi 21 février 2013

OpenCV supports Java on desktop



As of OpenCV 2.4.4, OpenCV supports desktop Java development using nearly the same interface as for Android development. This guide will help you to create your first Java (or Scala) application using OpenCV. Here... 

mercredi 13 février 2013

Draw an Arrow with OpenCV (and python version too)

OpenCV does not provide functions to draw an arrow. We will introduce a simple way to do it!
First, we draw a simple line (easy). Then, we plot the two segments that represent the arrow. These segments present an angle of 45 degrees (pi / 4) with the main line.
Here is the code for that:
#include <stdio.h>
#include <cv.h>
#include <highgui.h>


void drawArrow(IplImage *image, CvPoint p, CvPoint q, CvScalar color, int arrowMagnitude = 9, int thickness=1, int line_type=8, int shift=0) 

{
    //Draw the principle line
    cvLine(image, p, q, color, thickness, line_type, shift);
    const double PI = 3.141592653;
    //compute the angle alpha
    double angle = atan2((double)p.y-q.y, (double)p.x-q.x);
    //compute the coordinates of the first segment
    p.x = (int) ( q.x +  arrowMagnitude * cos(angle + PI/4));
    p.y = (int) ( q.y +  arrowMagnitude * sin(angle + PI/4));
    //Draw the first segment
    cvLine(image, p, q, color, thickness, line_type, shift);
    //
compute the coordinates of the second segment
    p.x = (int) ( q.x +  arrowMagnitude * cos(angle – PI/4));
    p.y = (int) ( q.y +  arrowMagnitude * sin(angle – PI/4));
    //
Draw the second segment
    cvLine(image, p, q, color, thickness, line_type, shift);
}  


//How to call this function
int main()

 {
    

   IplImage *canvas = cvCreateImage(cvSize(320, 240), IPL_DEPTH_8U, 3);
    cvNamedWindow(“win”);  
    drawArrow(canvas, cvPoint(10, 20), cvPoint(100, 150), CV_RGB(100, 0, 255), 20);
    cvShowImage(“win”, canvas);
    cvWaitKey();
    cvReleaseImage(&canvas);
    cvDestroyAllWindows();
    return 1;

} 

vendredi 8 février 2013

How to install OpenCV 2.3 on Microsoft Visual C++ Express 2008 (Windows XP)

OpenCV is an open source computer vision library available from here .... The library is written in C and C++ and runs under Linux, Windows and Mac OS X. There is active development on interfaces for Python, Ruby, Matlab, and other languages.  

OpenCV was conceived as a way to make computer vision infrastructure universally available. With the aid of Intel’s Performance Library Team,* OpenCV started with a core of implemented code and algorithmic specifications being sent to members of Intel’s Russian library team. This is the “where” of OpenCV: it started in Intel’s research lab with collaboration from the Soft ware Performance Libraries group together with implementation and optimization expertise in Russia.

For more details of OpenCV, I recommend this book :"Learning OpenCV Computer Vision With The OpenCV Library" which could be found on this link.


This tutorial assumes that you have already installed Microsoft Visual C++ Express 2008 and includes the following steps:
  1. Step1: Downloading and Installing OpenCV OpenCV 
  2. Step2: Include the Bin File and Lib File 
  3. Step3: Configure Visual Studio to use OpenCV 
  4. Setp4:Create a sample project which makes use of OpenCV 2.3

Step1: Downloading and Installing OpenCV 2.3
Go to the folder where you downloaded the executable file and select “Run as Administrator”.
The executable file is essentially an archive of files with an extractor built in. It will ask you to select the location where you would like it to extract all its contents. Select for exemple C:\ as the path and click Extract. It will create a folder called opencv2.3 with the path: C:\opencv2.3

Step2: Include the Bin File and Lib File 
Add the path of the bin and lib file in the ( C:\opencv2.3\build\x86\vc9\lib and C:\opencv2.3\build\x86\vc9\bin ) Environment Variables dialogue (the System Variables box select Path and then Edit).

Step3: Configure Visual Studio to use OpenCV :

* Add Executable, Include and Lib File
This step is done only one time while installing OpenCV Bib:
1- Open Visual C++ Express 2008
2- Go to Tools →  Options → Project and Solution → VC++ Directories
3- Select in the right combox Binary file and add the binary file located in C:\opencv2.3\build\x86\vc9\bin
4-  Select in the right combox Include file and add the three path of Include file located respectively in
      C:\opencv2.3\build\include\opencv
      C:\opencv2.3\build\include\opencv2
      C:\opencv2.3\build\include
5-  Select in the right combox Bib file and add the bib file located in 
     C:\opencv2.3\build\x86\vc9\lib

* Add Lib File
This step is done for every new Visual C++ Project:
 1- Go to Project → Properties  → Configuration properties  →  Liker  → Input  → Additional Dependencies  and add the bib that you are ging to use, for exemple:
  opencv_core231d.lib  opencv_imgproc231d.lib  opencv_highgui231d.lib  opencv_ml231d.lib  opencv_video231d.lib  opencv_features2d231d.lib  opencv_calib3d231d.lib  opencv_objdetect231d.lib  opencv_contrib231d.lib  opencv_legacy231d.lib  opencv_flann231d.lib

2- Click Apply then OK


Setp4:Create a sample project which makes use of OpenCV 2.3
1- Click File → New →Project
2- In the “Installed Templates” box choose Visual C++ → Win32 and select Win32 Console Application
3- Enter a name for the project and specify  the location where you would like to save your project and then click OK
4- Select the Application setting and shoot the Precompiled header and then clich on Finish. 
5- Click on the right of your mouse on the source file  → Add new element →  specify the name of our file, for example "Test.cpp" then click on Add
6- Type the following code on your Test.cpp File:

 #include "stdafx.h"
 #include <highgui.h>
 
int _tmain(int argc, _TCHAR* argv[])

 {
     int c;

     // allocate memory for an image

     IplImage *img;

     // capture from video device #1

     CvCapture* capture = cvCaptureFromCAM(1);

     // create a window to display the images

     cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE);

     // position the window

     cvMoveWindow("mainWin", 5, 5);

     while(1)

     {

         // retrieve the captured frame

         img=cvQueryFrame(capture);

         // show the image in the window

         cvShowImage("mainWin", img );

         // wait 10 ms for a key to be pressed

         c=cvWaitKey(10);

         // escape key terminates program

         if(c == 27)

         break;

     }

  return 0;

 }