Tuesday, June 14, 2011

Java applet loads jar files at runtime

Using the bellow mechanisum, java applet can load jar file that locate in your local machine. This may very usefull when applet size is huge and applet have modules. By using this technique applet modules can load as jar files from the local machine.

CustomClassLoader.java

public class CustomClassLoader extends URLClassLoader {

public CustomClassLoader(URL[] urls, ClassLoader parent) {
super(urls, parent);
}

//You can set required permission for load jar file, by overriding bellow method
@Override
protected PermissionCollection getPermissions(CodeSource codesource) {
PermissionCollection perms = super.getPermissions(codesource);
perms.add(new java.lang.reflect.ReflectPermission("*", "read,write"));
}
}


............Try to load jar file from applet............


try {

// applet class loader try to load a class in the local machine jar file.
//but applet couldn't find this class inside the applet and throws Exception.

Class c = this.getClass().getClassLoader().loadClass("class_name");
Object loadClass = c.newInstance();

}
catch (ClassNotFoundException ex) {
try {
//location of the jar file
String jarpath = "jar_file_path";
URL jarfile = new URL("jar", "", "file:" + jarpath + "!/");

//Initialize the custom class loader
CustomClassLoader cl = new CustomClassLoader(new URL[]{jarfile}, Thread.currentThread().getContextClassLoader());

//load the class using custom class loader
Class c = cl.loadClass(implClass);
loadClass = c.newInstance();
}
catch (Exception e) {
}
}

Sunday, June 6, 2010

Use of face detection technique for power saving of a PC

Face detection is already solved problem area in computer vision. So face detection can be use to many application areas. In here I use face detection technique for power saves of a personal computer (PC). Computer monitor is the most power consuming part of a PC. So we can save lot of power if we can switch off the monitor when we go away from the computer. I did this task by automatically using face detection technique. In this program when we go away from the computer program can’t detect a human face. So it pass signal to the monitor for switch off. When we again come back program can detect a face so then it pass signal to the monitor for switch on. For this we only need a normal web camera no other additional hardware need for that. Bellow video shows how it is works.

Sunday, May 30, 2010

Real Time Sign Language Recognition System

These days i'm working on my final year project. I have been developed gesture and posture recognition system that is able to recognize the sign language and give the output. This system is fully automatic and work in real time. I used OpenCV (Open Source Computer Vision Library) with visual c++ for implement that system. In this system current frame rate is 20 frames/sec. Advantages of that system are no needing too much worry about the background and also no need to ware gloves for hands. In currently this system recognize 5 signs with 90-95% accuracy in the good lighting condition. When the lighting condition became bad recognition rate also rapidly goes down. And also problem can happen when skin-like colors present at the background. Those are the limitations of that system.