Sunday, May 6, 2012

OpenCV Face Recognition using PCA technique


Step 1 :  Download and Install OpenCV 2.1.0 .
              OpenCV 2.1.0 installation on Visual Studio 2008 guide is here .

Step 2 :  Start with a new C++ Console win32 Application project on Visual studio.
              Then create a new  NearestTest.cpp   file within that project.

Step 3 :  Then create a face database with using several images as follows,
              Database folder  ->     

                             
    
                     


Step 4 : Mainly this app consisting with two parts,
                     1. Image Training Part  -
                                  first you have to train Face Images from train.txt
                                  training images.
                           ->   learn()  method                            
                     2. Image Recognition Part -
                                 then using test.txt testing images, recognize each
                                 and every face through training images (facedata.xml).
                           ->  recognize() method

               

- After doing training ->  it will create facedata.xml with using PCA technique.
- Then using facedata.xml, recognition will be done.


Step 5 :  Create the Project Folder Structure as follows and then download all the
              coding stuffs from  above and then add to NearestTest.cpp file.

             

Step 6 : After creating folder structure and .cpp file build the whole project.
                1. first train the images-->  facedata.xml will be generated.
      

              2. then test the app using test images--> output is as follows,

       

         

Thursday, May 3, 2012

Easy way to generate Excel file using PHP

Step 1 :  Download php-export-data.php phpExcelsheetgenerate library php file and upload it to your project folder for generating Excel  file.

Step 2 : Use above library file to generate Excel sheet with our data as Follows,

Example.php


Step 3 : Then view the test.xls Excel Sheet file with your own data and have a chocolate.

Friday, December 16, 2011

Implementing a Queue Data Structure using JAVA

package QueueImp;

import java.util.LinkedList;

public
class Queue{

   
    private LinkedList<E> list;   

    public Queue(){       
        list = new LinkedList<E>();
    }

    public boolean isEmpty(){      // Check whether the Queue is empty
        return (list.size() == 0);
    }

    public void enqueue(Object item){      // Add element as the tail of Queue       
        list.add(item);
    }

    public Object dequeue(){        // Remove the head of Queue       
        Object item = list.get(1);       
         list.remove(1);       
         return item;
    }

    public Object peek(){       // Retrieve the head of Queue
        return list.get(1);
    }
}

Tuesday, September 27, 2011

Learn Objective C - iPhone App Development

Go through following link to learn Objective C programming language. Mainly that gives a basic Objective C knowledge as a starting point for iPhone App Development.

Learn Objective - C

Monday, September 5, 2011

Retrieve Users from LDAP server

I have already mentioned about how to set up LDAP server within Apache DS.Now you can add users to LDAP server by importing example.ldif file or creating users from scratch using this post.

After  following above steps you can view LDAP browser in Apache DS as follows,

Ex:-




Now it is the time to retrieve the users from LDAP server.
For that mainly I am using JAVA technology and Eclipse IDE.

Following is the simple code stuffs to retrieve all the users in LDAP server relevant to my LDAP browser as above and change colored stuffs which suit for your settings,

LdapSearch.java

import java.util.Properties;
import javax.naming.Context;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;

public class LdapSearch {

public static void main(String[] args) throws Exception {
       
Properties env = new Properties();              env.put("java.naming.factory.initial","com.sun.jndi.ldap.LdapCtxFactory");
env.put("java.naming.ldap.version", "3");
env.put("java.naming.provider.url", "ldap://localhost:10389");
env.put(Context.SECURITY_PRINCIPAL, "cn=jayan,ou=users,o=wso2");env.put(Context.SECURITY_CREDENTIALS, "075");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
       
DirContext ctx = null;
           
            try {
                ctx = new InitialDirContext(env);

                String url="ldap://localhost:10389/ou=users,o=wso2";
                                                                           // try changing yellow stuffs

                NamingEnumeration listResults = null;           
                listResults = ctx.list(url);
         
                while (listResults.hasMore()) {
                    NameClassPair ncp = (NameClassPair) listResults.next();                  
                    System.out.println(ncp.getName());        // users are here             
                }
            } catch (NamingException e) {               
                e.printStackTrace();
            }           
    }





Output :-
  
    
Download LdapSearch.java file ...