Merge pull request #620 from apavlenko:java_tutorial_fix
This commit is contained in:
commit
13f402a554
@ -5,8 +5,6 @@
|
||||
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
|
||||
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
|
||||
@ -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.
|
||||
|
||||
What we'll do in this guide
|
||||
***************************
|
||||
===========================
|
||||
|
||||
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.
|
||||
|
||||
Get proper OpenCV
|
||||
*****************
|
||||
=================
|
||||
|
||||
Starting from version 2.4.4 OpenCV includes desktop Java bindings.
|
||||
|
||||
Download
|
||||
########
|
||||
--------
|
||||
|
||||
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/>`_.
|
||||
@ -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.
|
||||
|
||||
Build
|
||||
#####
|
||||
-----
|
||||
|
||||
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`)
|
||||
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.
|
||||
|
||||
Java sample with Ant
|
||||
********************
|
||||
====================
|
||||
|
||||
.. note::
|
||||
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
|
||||
|
||||
Java project in Eclipse
|
||||
***********************
|
||||
=======================
|
||||
|
||||
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
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib2.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib3.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib4.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib5.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib6.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib7.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib8.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
||||
* 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
|
||||
|
||||
* Put some simple OpenCV calls there, e.g.:
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
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
|
||||
|
||||
SBT project for Java and Scala
|
||||
******************************
|
||||
==============================
|
||||
|
||||
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.
|
||||
@ -427,7 +425,7 @@ You should see something like this:
|
||||
:align: center
|
||||
|
||||
Running SBT samples
|
||||
###################
|
||||
-------------------
|
||||
|
||||
Now we'll create a simple face detection application using OpenCV.
|
||||
|
||||
|
@ -301,16 +301,14 @@ endif()
|
||||
# Additional target properties
|
||||
set_target_properties(${the_module} PROPERTIES
|
||||
OUTPUT_NAME "${the_module}${LIB_NAME_SUFIX}"
|
||||
#DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
INSTALL_NAME_DIR ${OPENCV_LIB_INSTALL_PATH}
|
||||
LINK_INTERFACE_LIBRARIES ""
|
||||
)
|
||||
|
||||
if(ANDROID)
|
||||
set_target_properties(${the_module} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH})
|
||||
else()
|
||||
if(WIN32)
|
||||
set_target_properties(${the_module} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
|
||||
endif()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user