Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luigidr committed Oct 9, 2016
1 parent d3790ed commit eb68141
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions docs/source/01-installing-opencv-for-java.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,30 @@
Installing OpenCV for Java
==========================

Introduction to OpenCV for Java.
Introduction to OpenCV for Java
--------------------------------
As of OpenCV 2.4.4, OpenCV supports desktop Java development. This tutorial will help you install OpenCV on your desktop operating system.

Install the latest Java version.
Install the latest Java version
--------------------------------
Download the latest Java JDK at the `Oracle link <http://www.oracle.com/technetwork/java/javase/downloads/index.html>`_. Now you should be able to install the last Java JDK by open the file just downloaded.

Install the latest Eclipse version.
Install the latest Eclipse version
-----------------------------------
Download the latest Eclipse version at the `Eclipse Download page <https://www.eclipse.org/downloads/>`_ choosing the ``Eclipse IDE for Java Developers`` version (suggested).
Extract the downloaded compressed file and put the resulting folder wherever you want to. You don't need to install anything. Alternatively, you can try the Eclipse installer.

Install OpenCV 3.x under Windows.
Install OpenCV 3.x under Windows
------------------------------------
First of all you should download the OpenCV library (version 3.x) from `here <http://opencv.org/downloads.html>`_.
Then, extract the downloaded OpenCV file in a location of your choice. Once you get the folder ``opencv`` put in wherever you prefer.
Now the only two things that you will need are: the ``opencv-3xx.jar`` file located at ``\opencv\build\java`` and the ``opencv_java3xx.dll`` library located at ``\opencv\build\java\x64`` (for 64-bit systems) or ``\opencv\build\java\x86`` (for 32-bit systems). The `3xx` suffix of each file is a shortcut for the current OpenCV version, e.g., it will be `300` for OpenCV 3.0 and `310` for OpenCV 3.1.

Install OpenCV 3.x under macOS.
Install OpenCV 3.x under macOS
---------------------------------
The quickest way to obtain OpenCV under macOS is to use `Homebrew <http://brew.sh>`_. After installing Homebrew, you have to check whether the `XCode Command Line Tools` are already installed on your system. To do so, open the `Terminal` and execute:
The quickest way to obtain OpenCV under macOS is to use `Homebrew <http://brew.sh>`_. After installing Homebrew, you have to check whether the `XCode Command Line Tools` are already installed on your system.

To do so, open the `Terminal` and execute:
``xcode-select --install``
If MacOS ask you for installing such tools, proceed with the download and installation. Otherwise, continue with the OpenCV installation.

Expand All @@ -34,8 +36,8 @@ and effectively install OpenCV:

After the installation of OpenCV, the needed jar file and the dylib library will be located at ``/usr/local/opt/opencv3/share/OpenCV/java/``.

Install OpenCV 3.x under Linux.
-----------------------------------
Install OpenCV 3.x under Linux
---------------------------------
Please, note: the following instructions are also useful if you want to compile OpenCV under Windows or macOS. Linux package management systems (`apt-get`, `yum`, etc.) *may* provide the needed version of the OpenCV library.

As first step, download and install `CMake <http://www.cmake.org/download/>`_ and `Apache Ant <http://ant.apache.org/>`_, if you don't have any of these. Download the OpenCV library from the `its website <http://opencv.org/downloads.html>`_.
Expand Down Expand Up @@ -71,7 +73,7 @@ Wait for the process to be completed...
If everything went well you should have ``opencv-3xx.jar`` in the ``/opencv/build/bin`` directory and ``libopencv_java3xx.so`` in the ``/opencv/build/lib`` directory. The `3xx` suffix of each file is a shortcut for the current OpenCV version, e.g., it will be `300` for OpenCV 3.0 and `310` for OpenCV 3.1. This is everything you need.

Set up OpenCV for Java in Eclipse
---------------------------------
----------------------------------
Open Eclipse and select a workspace of your choice. Create a User Library, ready to be used on all your next projects: go to ``Window > Preferences...``.

.. image:: _static/01 - 02.png
Expand All @@ -88,4 +90,6 @@ Select ``External Folder...`` and browse to select the folder containing the Ope
In case of MacOS, if you installed OpenCV *without* Homebrew, you need to create a soft link with .dylib extension for the .so file. E.g., from the terminal, type:
``ln -s libopencv_java300.so libopencv_java300.dylib``

Finally, if you are using IntelliJ, you can specify the location of the library with the VM argument ``-Djava.library.path=/opencv/build/lib``.
Set up OpenCV for Java in other IDEs (experimental)
---------------------------------------------------
If you are using IntelliJ, you can specify the location of the library with the VM argument ``-Djava.library.path=/opencv/build/lib``.

0 comments on commit eb68141

Please sign in to comment.