Thursday, October 30, 2014

Write a program to Implement a fingerprint recognition using Java Programming

Problem Statement:
Write a program to Implement a fingerprint recognition using Java Programming 

PROGRAM

import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.PixelGrabber;
import java.io.File;

class fingerprint{
public static void main(String args[]){


try {

String file1 = "sq.png";
String file2 = "sq.png";

Image pic1= Toolkit.getDefaultToolkit().getImage(file1);
Image pic2= Toolkit.getDefaultToolkit().getImage(file2);

try {

PixelGrabber grab11 = new PixelGrabber(pic1, 0, 0, -1, -1,
false);
PixelGrabber grab21 = new PixelGrabber(pic2, 0, 0, -1, -1,
false);

int array1[]= null;

if (grab11.grabPixels()) {
int width = grab11.getWidth();
int height = grab11.getHeight();
array1= new int[width * height];
array1= (int[]) grab11.getPixels();
}

int[] array2 = null;

if (grab21.grabPixels()) {
int width = grab21.getWidth();
int height = grab21.getHeight();
array2 = new int[width * height];
array2 = (int[]) grab21.getPixels();
}

System.out.println("Pixels equal: "
+ java.util.Arrays.equals(array1, array2 ));

} catch (InterruptedException e1) {
e1.printStackTrace();
}

} catch (Throwable t) {
// report error
System.out.println("Fail - " + t.getMessage());
}
}
}

OUTPUT:

pict@locathost-Inspiron-5537:~$ javac fingerprint.java
pict@locathost-Inspiron-5537:~$ java fingerprint
Pixels equal: false
pict@locathost-Inspiron-5537:~$ javac fingerprint.java
pict@locathost-Inspiron-5537:~$ java fingerprint
Pixels equal: true

No comments:

Post a Comment

Perform a suitable assignment using Xen Hypervisor or equivalent open source to configure it. Give necessary GUI.

 To install kvm on Fedora:  yum install kvm  yum install virt-manager libvirt libvirt-python python-virtinst  su -c "yum install @v...