Pages

Monday, 27 May 2013

Video Processing is becoming the source of revolutionary technology as Gestures are being used to manipulate objects in physical world with digital world . As Pranav Mistry gave that presentation on Sixth Sense Device ,there is ongoing research and development on gestural interfaces.

Marvin Framework provides extensible, cross-platform and open source image processing framework developed in Java. The framework provides features to:

manipulate images

manipulate captured video frames

multithreading image processing

integrate plug-ins with Graphical User Interface(GUI)

analyze plug-in performance

extend features via plug-in

unit test automation

Marvin Framework has got varied range of plugins to manipulate frames of image captured from webcam so that gesture can be formed and can be used to make some action based on that.

As we have released Marvin Framework 1.4.3 , a change we have done , now it can work with JavaCV or any other API . If you download jar file through above highlighted link , you need to do the following steps to start working again on Marvin Framework.

STEP 1 - Download Jar file from above highlighted link , after downloading extract it in some folder, make sure you have already setup JavaCV .

STEP 6 - If you have done carefully , then all the errors have been gone now. Please check the method call videoAdapter.connect(1) , here 1 is referring to capture device '1' so may be you can get exception

You can try using 0 in place of 1 , or run this code to get the device number of webcam or more than one webcam you may be having to list the device number , you can run the following code

importcom.googlecode.javacv.cpp.videoInputLib.videoInput;

class Main {

publicstaticvoid main(String[] args){

int n=videoInput.listDevices();

for(int i=0;i<n;i++)

{

System.out.println(i+" = "+videoInput.getDeviceName(i));

}

}

}

In my laptop it outputs like

so this tells that capture device hp webcam has number 0 , so i will change the code to videoAdatpter.connect(0);

You can try different programs available in Sample programs if you download source code of Marvin Project.

4) Now run MarvinVideoTest.java , your Webcam will start capturing and with plugin EdgeDetector.

5) You can test if JavaCV is setup correctly by running this demo , remember to add img1.png in your project.

We will soon update the Marvin Project with these modifications.

We get lot of advantage in this method, the interface is just need to be implemented by Adapter class , which allows users to choose any video capture API of java , not only JavaCV , but xuggler , FMJ , any API can be used to connect to the camera. Just you need to connect the camera using API and get frames.

Many of us struggled to get Video capture to work through Java , because of JMF , Oracle shut down the development of JMF after 2009 , it was difficult to capture video from Webcam as with JMF , it always gives Exception : Video Not Found

JavaCV , an OpenCV Java API , is easy to use and working API to do video manipulation with Java language without JMF.

Marvin Framework uses JMF in file MarvinVideoManager.Java
But i have made it working with JavaCV.

2) After Downloading Extract the Open CV to this Location :- C:\Opencv\

Please do not extract in other folder because some dll's point to the directory c:\opencv ,so , it can create a problem.

3) Now run this exact command at CMD - SETX /M OPENCV_DIR c:\Opencv\build

This sets the path of OpenCV in Environment .After that go to Environment Variables in System Properties and set the path accordinglythe path is MyComputer->System Properties->Advanced System Properties.At Advanced tab click on Environment Variables , there you will find a variable as path , if its not there , click on add make a path variable and enter the value as explained below.

Go to the very last position of the “Path” value and add one of the following strings:

For the 64 bit version, use - ;%OPENCV_DIR%\x64\vc10\bin;
For the 32 bit version, use - ;%OPENCV_DIR%\x86\vc10\bin;

4) Next thing is to set up JavaCV , you need to just extract the zip file downloaded , anywhere...now when you make any project in Eclipse using Marvin Framework , add the jars javacpp.jar and javacv.jar into build path.