updating JNI lib location for Unix; formatting update
This commit is contained in:
@@ -5,8 +5,6 @@
|
|||||||
Introduction to Java Development
|
Introduction to Java Development
|
||||||
********************************
|
********************************
|
||||||
|
|
||||||
Last updated: 28 February, 2013.
|
|
||||||
|
|
||||||
As of OpenCV 2.4.4, OpenCV supports desktop Java development using nearly the same interface as for
|
As of OpenCV 2.4.4, OpenCV supports desktop Java development using nearly the same interface as for
|
||||||
Android development. This guide will help you to create your first Java (or Scala) application using OpenCV.
|
Android development. This guide will help you to create your first Java (or Scala) application using OpenCV.
|
||||||
We will use either `Eclipse <http://eclipse.org/>`_, `Apache Ant <http://ant.apache.org/>`_ or the
|
We will use either `Eclipse <http://eclipse.org/>`_, `Apache Ant <http://ant.apache.org/>`_ or the
|
||||||
@@ -15,7 +13,7 @@ We will use either `Eclipse <http://eclipse.org/>`_, `Apache Ant <http://ant.apa
|
|||||||
For further reading after this guide, look at the :ref:`Android_Dev_Intro` tutorials.
|
For further reading after this guide, look at the :ref:`Android_Dev_Intro` tutorials.
|
||||||
|
|
||||||
What we'll do in this guide
|
What we'll do in this guide
|
||||||
***************************
|
===========================
|
||||||
|
|
||||||
In this guide, we will:
|
In this guide, we will:
|
||||||
|
|
||||||
@@ -29,12 +27,12 @@ The same process was used to create the samples in the :file:`samples/java` fold
|
|||||||
so consult those files if you get lost.
|
so consult those files if you get lost.
|
||||||
|
|
||||||
Get proper OpenCV
|
Get proper OpenCV
|
||||||
*****************
|
=================
|
||||||
|
|
||||||
Starting from version 2.4.4 OpenCV includes desktop Java bindings.
|
Starting from version 2.4.4 OpenCV includes desktop Java bindings.
|
||||||
|
|
||||||
Download
|
Download
|
||||||
########
|
--------
|
||||||
|
|
||||||
The most simple way to get it is downloading the appropriate package of **version 2.4.4 or higher** from the
|
The most simple way to get it is downloading the appropriate package of **version 2.4.4 or higher** from the
|
||||||
`OpenCV SourceForge repository <http://sourceforge.net/projects/opencvlibrary/files/>`_.
|
`OpenCV SourceForge repository <http://sourceforge.net/projects/opencvlibrary/files/>`_.
|
||||||
@@ -50,7 +48,7 @@ In order to build OpenCV with Java bindings you need :abbr:`JDK (Java Developmen
|
|||||||
`Apache Ant <http://ant.apache.org/>`_ and `Python` v2.6 or higher to be installed.
|
`Apache Ant <http://ant.apache.org/>`_ and `Python` v2.6 or higher to be installed.
|
||||||
|
|
||||||
Build
|
Build
|
||||||
#####
|
-----
|
||||||
|
|
||||||
Let's build OpenCV:
|
Let's build OpenCV:
|
||||||
|
|
||||||
@@ -111,11 +109,11 @@ or
|
|||||||
|
|
||||||
Besides all this will create a ``jar`` containing the Java interface (:file:`bin/opencv-244.jar`)
|
Besides all this will create a ``jar`` containing the Java interface (:file:`bin/opencv-244.jar`)
|
||||||
and a native dynamic library containing Java bindings and all the OpenCV stuff
|
and a native dynamic library containing Java bindings and all the OpenCV stuff
|
||||||
(:file:`bin/Release/opencv_java244.dll` or :file:`lib/libopencv_java244.so` respectively).
|
(:file:`lib/libopencv_java244.so` or :file:`bin/Release/opencv_java244.dll` respectively).
|
||||||
We'll use these files later.
|
We'll use these files later.
|
||||||
|
|
||||||
Java sample with Ant
|
Java sample with Ant
|
||||||
********************
|
====================
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
The described sample is provided with OpenCV library in the :file:`opencv/samples/java/ant` folder.
|
The described sample is provided with OpenCV library in the :file:`opencv/samples/java/ant` folder.
|
||||||
@@ -236,7 +234,7 @@ Java sample with Ant
|
|||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
Java project in Eclipse
|
Java project in Eclipse
|
||||||
***********************
|
=======================
|
||||||
|
|
||||||
Now let's look at the possiblity of using OpenCV in Java when developing in Eclipse IDE.
|
Now let's look at the possiblity of using OpenCV in Java when developing in Eclipse IDE.
|
||||||
|
|
||||||
@@ -256,49 +254,48 @@ Now let's look at the possiblity of using OpenCV in Java when developing in Ecli
|
|||||||
:alt: Eclipse: external JAR
|
:alt: Eclipse: external JAR
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
` `
|
|
|
||||||
|
|
||||||
.. image:: images/eclipse_user_lib2.png
|
.. image:: images/eclipse_user_lib2.png
|
||||||
:alt: Eclipse: external JAR
|
:alt: Eclipse: external JAR
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
` `
|
|
|
||||||
|
|
||||||
.. image:: images/eclipse_user_lib3.png
|
.. image:: images/eclipse_user_lib3.png
|
||||||
:alt: Eclipse: external JAR
|
:alt: Eclipse: external JAR
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
` `
|
|
|
||||||
|
|
||||||
.. image:: images/eclipse_user_lib4.png
|
.. image:: images/eclipse_user_lib4.png
|
||||||
:alt: Eclipse: external JAR
|
:alt: Eclipse: external JAR
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
` `
|
|
|
||||||
|
|
||||||
.. image:: images/eclipse_user_lib5.png
|
.. image:: images/eclipse_user_lib5.png
|
||||||
:alt: Eclipse: external JAR
|
:alt: Eclipse: external JAR
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
` `
|
|
|
||||||
|
|
||||||
.. image:: images/eclipse_user_lib6.png
|
.. image:: images/eclipse_user_lib6.png
|
||||||
:alt: Eclipse: external JAR
|
:alt: Eclipse: external JAR
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
` `
|
|
|
||||||
|
|
||||||
.. image:: images/eclipse_user_lib7.png
|
.. image:: images/eclipse_user_lib7.png
|
||||||
:alt: Eclipse: external JAR
|
:alt: Eclipse: external JAR
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
` `
|
|
|
||||||
|
|
||||||
.. image:: images/eclipse_user_lib8.png
|
.. image:: images/eclipse_user_lib8.png
|
||||||
:alt: Eclipse: external JAR
|
:alt: Eclipse: external JAR
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
` `
|
|
||||||
|
|
||||||
* Add a new Java class (say ``Main``) containing the application entry:
|
* Add a new Java class (say ``Main``) containing the application entry:
|
||||||
|
|
||||||
@@ -307,6 +304,7 @@ Now let's look at the possiblity of using OpenCV in Java when developing in Ecli
|
|||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
* Put some simple OpenCV calls there, e.g.:
|
* Put some simple OpenCV calls there, e.g.:
|
||||||
|
|
||||||
.. code-block:: java
|
.. code-block:: java
|
||||||
|
|
||||||
import org.opencv.core.Core;
|
import org.opencv.core.Core;
|
||||||
@@ -328,7 +326,7 @@ Now let's look at the possiblity of using OpenCV in Java when developing in Ecli
|
|||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
SBT project for Java and Scala
|
SBT project for Java and Scala
|
||||||
******************************
|
==============================
|
||||||
|
|
||||||
Now we'll create a simple Java application using SBT. This serves as a brief introduction to
|
Now we'll create a simple Java application using SBT. This serves as a brief introduction to
|
||||||
those unfamiliar with this build tool. We're using SBT because it is particularly easy and powerful.
|
those unfamiliar with this build tool. We're using SBT because it is particularly easy and powerful.
|
||||||
@@ -427,7 +425,7 @@ You should see something like this:
|
|||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
Running SBT samples
|
Running SBT samples
|
||||||
###################
|
-------------------
|
||||||
|
|
||||||
Now we'll create a simple face detection application using OpenCV.
|
Now we'll create a simple face detection application using OpenCV.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user