Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenCV Computer Vision with Java

You're reading from   OpenCV Computer Vision with Java Create multiplatform computer vision desktop and web applications using the combination of OpenCV and Java

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher
ISBN-13 9781783283972
Length 174 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Daniel Lelis Baggio Daniel Lelis Baggio
Author Profile Icon Daniel Lelis Baggio
Daniel Lelis Baggio
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Setting Up OpenCV for Java FREE CHAPTER 2. Handling Matrices, Files, Cameras, and GUIs 3. Image Filters and Morphological Operators 4. Image Transforms 5. Object Detection Using Ada Boost and Haar Cascades 6. Detecting Foreground and Background Regions and Depth with a Kinect Device 7. OpenCV on the Server Side Index

The Java OpenCV project in Eclipse

Using OpenCV in any IDE is pretty simple. It is as simple as adding OpenCV JAR, that is, opencv-300.jar to your classpath. But, as it relies on the native code, you need to point out the dynamic link libraries—so for Linux, .dll for Windows, and dylib for MacOsX.

  1. In Eclipse, go to File | New | Java Project.
    The Java OpenCV project in Eclipse
  2. Give the new project a descriptive name, such as SimpleSample. Select the project in the Package Explorer, go to the Project menu and click on Properties. On the Java Build Path tab, go to the Libraries tab, and click on the Add Library… button on the right-hand side, as shown in the following screenshot:
    The Java OpenCV project in Eclipse
  3. Select User Library in the Add Library dialog, and then click Next.
  4. Now, click on the User Libraries… button.
  5. Click on New…. Name your library appropriately, for example, opencv-3.0.0. It's time to reference the JAR files.
  6. Click on Add JARs….
  7. Select the opencv-300.jar file in your filesystem; it should be in the opencv\build\java folder. Then, point to the native library location expanding your JAR as in the following screenshot:
    The Java OpenCV project in Eclipse
  8. Now, select Native library location by clicking on the Edit… button on the right-hand side of the window and set your native libraries' location folder, for example, opencv\build\java\x64\.
  9. Now that OpenCV is properly configured, just select it in your Add library dialog by pressing Finish.

Notice that your project now points to the OpenCV JAR. You can also browse the main classes from the Package Explorer, as seen in the following screenshot:

The Java OpenCV project in Eclipse

After the The NetBeans configuration section, a source code to create a simple OpenCV application can be found.

You have been reading a chapter from
OpenCV Computer Vision with Java
Published in: Jul 2015
Publisher:
ISBN-13: 9781783283972
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image