All articles represent ideas and point of view of the author. Please use your judgement before taking actions. Author is not responsible for any kind of loss or damage due to actions taken following this blog. You are allowed to copy content provided a visible clickable link or courtesy is expressed to the original article in this blog. If you have suggestions or ideas, please contact admin@thecoolblogs.com

Wednesday, October 23, 2013

Resolving Unsatisfied link error in OpenNI java on Windows

If you are getting any of the following error while trying to Run OpenNI on a windows PC, follow the below steps to rid of the errors (I am assuming you are using Eclipse)

java.lang.UnsatisfiedLinkError: C:\Program Files\OpenNI2\Redist\OpenNI2.jni.dll: Can't find dependent libraries

or

java.lang.UnsatisfiedLinkError: no OpenNI2.jni in java.library.path

Wednesday, February 27, 2013

Connecting MK808 device to ADB using the bridge and OEM USB Drivers


MK808 is a very cheap and handy Android device to play around. Connected to an HDMI monitor, we can easily run Android applications on this device. Before starting, we need to first connect MK808 to the ADB so that we can install/run/debug applications. OEM drivers provided by Google is not sufficient to connect the MK808 device to the ADB. After installing the OEM drivers, please follow the below steps

Get Bitmap image from a YUV in Android


Android Camera preview image is in YUV format. The YUV byte[] will have gray image in the first width*height bytes and color information next. For processing preview image without taking picture from Camera using Camera.takePicture method, mostly we need to convert the YUV byte[] into a Bitmap. Following code will help do that

Friday, October 26, 2012

EXCEPTION_ACCESS_VIOLATION while using JavaCV Facerecognizer class


The below error while executing JavaCV code happen mostly when you try to invoke a method on a non-existing pointer.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007feea1adf5f, pid=10548, tid=8644
#
# JRE version: 7.0_07-b11
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.3-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [jniopencv_contrib.dll+0xdf5f]
#

We need to understand that JavaCV is a JNI wrapper for OpenCV and other similar native libraries. The objects returned using these methods work a bit different from the normal java objects. The above error happens mainly due to trying to operate on a pointer that no longer exists.
Please refer to the below class, for example

Creating an LBPH (Local Binary Pattern Histogram) face recognizer using FaceRecognizer class in JavaCV


In this article we will discuss how to create a Java based LBP face recognizer using JavaCV. JavaCV is a wrapper to the Open CV libraries for image processing. The workflow that I am trying to implement is as below

  • The calling program will supply a bunch of images and a person name to this class ( learnNewFace(String personName, IplImage[] images)
  • The class will store the images in a folder and map the person name to an integer id
  • The class will then read all the images and person names and train the model
  • Once training is complete client can invoke identifyFace method giving an image to find out the matching personName (identifyFace(IplImage image))