Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
aaefd318
Commit
aaefd318
authored
Mar 05, 2013
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more formatting
parent
23fb570c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
java_dev_intro.rst
doc/tutorials/introduction/desktop_java/java_dev_intro.rst
+21
-21
No files found.
doc/tutorials/introduction/desktop_java/java_dev_intro.rst
View file @
aaefd318
...
@@ -52,7 +52,7 @@ Build
...
@@ -52,7 +52,7 @@ Build
Let's build OpenCV:
Let's build OpenCV:
.. code-block:: bash
.. code-block:: bash
git clone git://github.com/Itseez/opencv.git
git clone git://github.com/Itseez/opencv.git
cd opencv
cd opencv
...
@@ -63,13 +63,13 @@ Let's build OpenCV:
...
@@ -63,13 +63,13 @@ Let's build OpenCV:
Generate a Makefile or a MS Visual Studio* solution, or whatever you use for
Generate a Makefile or a MS Visual Studio* solution, or whatever you use for
building executables in your system:
building executables in your system:
.. code-block:: bash
.. code-block:: bash
cmake -DBUILD_SHARED_LIBS=OFF ..
cmake -DBUILD_SHARED_LIBS=OFF ..
or
or
.. code-block:: bat
.. code-block:: bat
cmake -DBUILD_SHARED_LIBS=OFF -G "Visual Studio 10" ..
cmake -DBUILD_SHARED_LIBS=OFF -G "Visual Studio 10" ..
...
@@ -81,7 +81,7 @@ Examine the output of CMake and ensure ``java`` is one of the modules "To be bui
...
@@ -81,7 +81,7 @@ Examine the output of CMake and ensure ``java`` is one of the modules "To be bui
If not, it's likely you're missing a dependency. You should troubleshoot by looking
If not, it's likely you're missing a dependency. You should troubleshoot by looking
through the CMake output for any Java-related tools that aren't found and installing them.
through the CMake output for any Java-related tools that aren't found and installing them.
.. image:: images/cmake_output.png
.. image:: images/cmake_output.png
:alt: CMake output
:alt: CMake output
:align: center
:align: center
...
@@ -97,13 +97,13 @@ through the CMake output for any Java-related tools that aren't found and instal
...
@@ -97,13 +97,13 @@ through the CMake output for any Java-related tools that aren't found and instal
Now start the build:
Now start the build:
.. code-block:: bash
.. code-block:: bash
make -j8
make -j8
or
or
.. code-block:: bat
.. code-block:: bat
msbuild /m OpenCV.sln /t:Build /p:Configuration=Release /v:m
msbuild /m OpenCV.sln /t:Build /p:Configuration=Release /v:m
...
@@ -336,14 +336,14 @@ First, download and install `SBT <http://www.scala-sbt.org/>`_ using the instruc
...
@@ -336,14 +336,14 @@ First, download and install `SBT <http://www.scala-sbt.org/>`_ using the instruc
Next, navigate to a new directory where you'd like the application source to live (outside :file:`opencv` dir).
Next, navigate to a new directory where you'd like the application source to live (outside :file:`opencv` dir).
Let's call it "JavaSample" and create a directory for it:
Let's call it "JavaSample" and create a directory for it:
.. code-block:: bash
.. code-block:: bash
cd <somewhere outside opencv>
cd <somewhere outside opencv>
mkdir JavaSample
mkdir JavaSample
Now we will create the necessary folders and an SBT project:
Now we will create the necessary folders and an SBT project:
.. code-block:: bash
.. code-block:: bash
cd JavaSample
cd JavaSample
mkdir -p src/main/java # This is where SBT expects to find Java sources
mkdir -p src/main/java # This is where SBT expects to find Java sources
...
@@ -352,7 +352,7 @@ Now we will create the necessary folders and an SBT project:
...
@@ -352,7 +352,7 @@ Now we will create the necessary folders and an SBT project:
Now open :file:`project/build.scala` in your favorite editor and paste the following.
Now open :file:`project/build.scala` in your favorite editor and paste the following.
It defines your project:
It defines your project:
.. code-block:: scala
.. code-block:: scala
import sbt._
import sbt._
import Keys._
import Keys._
...
@@ -380,20 +380,20 @@ It defines your project:
...
@@ -380,20 +380,20 @@ It defines your project:
Now edit :file:`project/plugins.sbt` and paste the following.
Now edit :file:`project/plugins.sbt` and paste the following.
This will enable auto-generation of an Eclipse project:
This will enable auto-generation of an Eclipse project:
.. code-block:: scala
.. code-block:: scala
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
Now run ``sbt`` from the :file:`JavaSample` root and from within SBT run ``eclipse`` to generate an eclipse project:
Now run ``sbt`` from the :file:`JavaSample` root and from within SBT run ``eclipse`` to generate an eclipse project:
.. code-block:: bash
.. code-block:: bash
sbt # Starts the sbt console
sbt # Starts the sbt console
> eclipse # Running "eclipse" from within the sbt console
> eclipse # Running "eclipse" from within the sbt console
You should see something like this:
You should see something like this:
.. image:: images/sbt_eclipse.png
.. image:: images/sbt_eclipse.png
:alt: SBT output
:alt: SBT output
:align: center
:align: center
...
@@ -404,7 +404,7 @@ we'll be using SBT to build the project, so if you choose to use Eclipse it will
...
@@ -404,7 +404,7 @@ we'll be using SBT to build the project, so if you choose to use Eclipse it will
To test that everything is working, create a simple "Hello OpenCV" application.
To test that everything is working, create a simple "Hello OpenCV" application.
Do this by creating a file :file:`src/main/java/HelloOpenCV.java` with the following contents:
Do this by creating a file :file:`src/main/java/HelloOpenCV.java` with the following contents:
.. code-block:: java
.. code-block:: java
public class HelloOpenCV {
public class HelloOpenCV {
public static void main(String[] args) {
public static void main(String[] args) {
...
@@ -414,13 +414,13 @@ Do this by creating a file :file:`src/main/java/HelloOpenCV.java` with the follo
...
@@ -414,13 +414,13 @@ Do this by creating a file :file:`src/main/java/HelloOpenCV.java` with the follo
Now execute ``run`` from the sbt console, or more concisely, run ``sbt run`` from the command line:
Now execute ``run`` from the sbt console, or more concisely, run ``sbt run`` from the command line:
.. code-block:: bash
.. code-block:: bash
sbt run
sbt run
You should see something like this:
You should see something like this:
.. image:: images/sbt_run.png
.. image:: images/sbt_run.png
:alt: SBT run
:alt: SBT run
:align: center
:align: center
...
@@ -433,7 +433,7 @@ First, create a :file:`lib/` folder and copy the OpenCV jar into it.
...
@@ -433,7 +433,7 @@ First, create a :file:`lib/` folder and copy the OpenCV jar into it.
By default, SBT adds jars in the lib folder to the Java library search path.
By default, SBT adds jars in the lib folder to the Java library search path.
You can optionally rerun ``sbt eclipse`` to update your Eclipse project.
You can optionally rerun ``sbt eclipse`` to update your Eclipse project.
.. code-block:: bash
.. code-block:: bash
mkdir lib
mkdir lib
cp <opencv_dir>/build/bin/opencv_<version>.jar lib/
cp <opencv_dir>/build/bin/opencv_<version>.jar lib/
...
@@ -441,7 +441,7 @@ You can optionally rerun ``sbt eclipse`` to update your Eclipse project.
...
@@ -441,7 +441,7 @@ You can optionally rerun ``sbt eclipse`` to update your Eclipse project.
Next, create the directory :file:`src/main/resources` and download this Lena image into it:
Next, create the directory :file:`src/main/resources` and download this Lena image into it:
.. image:: images/lena.png
.. image:: images/lena.png
:alt: Lena
:alt: Lena
:align: center
:align: center
...
@@ -451,7 +451,7 @@ Items in the resources directory are available to the Java application at runtim
...
@@ -451,7 +451,7 @@ Items in the resources directory are available to the Java application at runtim
Next, copy :file:`lbpcascade_frontalface.xml` from :file:`opencv/data/lbpcascades/` into the :file:`resources`
Next, copy :file:`lbpcascade_frontalface.xml` from :file:`opencv/data/lbpcascades/` into the :file:`resources`
directory:
directory:
.. code-block:: bash
.. code-block:: bash
cp <opencv_dir>/data/lbpcascades/lbpcascade_frontalface.xml src/main/resources/
cp <opencv_dir>/data/lbpcascades/lbpcascade_frontalface.xml src/main/resources/
...
@@ -517,19 +517,19 @@ You will also get errors if you try to load OpenCV when it has already been load
...
@@ -517,19 +517,19 @@ You will also get errors if you try to load OpenCV when it has already been load
Now run the face detection app using ``sbt run``:
Now run the face detection app using ``sbt run``:
.. code-block:: bash
.. code-block:: bash
sbt run
sbt run
You should see something like this:
You should see something like this:
.. image:: images/sbt_run_face.png
.. image:: images/sbt_run_face.png
:alt: SBT run
:alt: SBT run
:align: center
:align: center
It should also write the following image to :file:`faceDetection.png`:
It should also write the following image to :file:`faceDetection.png`:
.. image:: images/faceDetection.png
.. image:: images/faceDetection.png
:alt: Detected face
:alt: Detected face
:align: center
:align: center
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment