Presentation is loading. Please wait.

Presentation is loading. Please wait.

How to install JavaCV in Eclipse. Make sure to download and install all these before you proceed Eclipse for Java EE developers (current is Juno)

Similar presentations


Presentation on theme: "How to install JavaCV in Eclipse. Make sure to download and install all these before you proceed Eclipse for Java EE developers (current is Juno)"— Presentation transcript:

1 How to install JavaCV in Eclipse

2 Make sure to download and install all these before you proceed Eclipse for Java EE developers (current is Juno) http://www.eclipse.org/downloads/packages/release/juno/sr1 http://www.eclipse.org/downloads/packages/release/juno/sr1 Latest version of Java SE (JDK currently 7_25) http://www.oracle.com/technetwork/java/javase/downloads/index.html http://www.oracle.com/technetwork/java/javase/downloads/index.html Microsoft Visual Studio C++ 2010 Redistributable package 32 bit: http://www.microsoft.com/en-us/download/details.aspx?id=5555http://www.microsoft.com/en-us/download/details.aspx?id=5555 64 bit: http://www.microsoft.com/en- us/download/details.aspx?id=14632http://www.microsoft.com/en- us/download/details.aspx?id=14632 Latest version of OpenCV (current is 2.4.5) http://opencv.org/downloads.htmlhttp://opencv.org/downloads.html Latest version of JavaCV bin (current is 0.5) https://code.google.com/p/javacv/downloads/list https://code.google.com/p/javacv/downloads/list

3 Once you install/extract opencv, move the entire folder into the Local Disk (C: drive)

4 Then go to My Computer, System Properties, Advanced System Properties, and click on environment variables Click on New… and enter a name for your path: OPENCV_BUILD The value will be where you just put the opencv folder C:\opencv\build Scroll down to path and click edit and enter: For 32 bit: %OPENCV_BUILD%\x86\vc10\bin For 64 bit: %OPENCV_BUILD%\x64\vc10\bin

5 Once you extract the javacv bin folder, you can move it to whichever place you like, I just left it in the downloads folder. This is the list of jars that it should include. Next, you are going to go to the opencv folder that is in the C: drive and click on build, then Java. This is what you should see. Copy the opencv-245.jar file and paste it in your javacv-bin folder.

6 Make sure you Restart your computer first then Open up Eclipse and create a new Java Project. I named mine javacvtest and the JRE im using is the JDK downloaded earlier JavaSE 1.7_25 Then click finish

7 Right click the project name, and go to New, then Class. Name the class demo then click finish **I will provide an example code later on you can test out to see if you installed javacv correctly**

8 Right Click the project name again but this time go to properties. Under Java Build Path you are going to click on Add External Jars

9 Navigate to wherever you put the javacv bin folder and add all the jar files shown to the right and click ok

10 Go to the opencv folder again in your C: drive then go to build then java. Choose 32 bit or 64 bit according to your computer and there will be a opencv_java245.dll file. Drag the.dll file onto the project name and make sure copy files is selected then click OK.

11 Here is a sample Javacv code that opens up a picture. In order for it to work, you first must choose a picture and drag and drop it onto the project name, make sure copy files is selected and click OK. You also must take into account what you named the picture. In my code the name is “javacv.png” and that is the name of the picture I added. If you want to add a different picture, you just have to change the name in the cvLoadImage function to the name of your picture to work

12 When you click run, your picture should pop up and you will know you installed JavaCV correctly.

13 JavaCV example code import static com.googlecode.javacv.cpp.opencv_core.*; import static com.googlecode.javacv.cpp.opencv_highgui.*; import static com.googlecode.javacv.cpp.opencv_imgproc.*; import com.googlecode.javacv.CanvasFrame; public class demo { public static void main(String[] args) { //Load image img1 as IplImage final IplImage image = cvLoadImage("javacv.png"); //create canvas frame named 'Demo' final CanvasFrame canvas = new CanvasFrame("Demo"); //Show image in canvas frame canvas.showImage(image); //This will close canvas frame on exit canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); }


Download ppt "How to install JavaCV in Eclipse. Make sure to download and install all these before you proceed Eclipse for Java EE developers (current is Juno)"

Similar presentations


Ads by Google