You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/html/01 - Installing OpenCV for Java.html
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ <h2>Install Open CV 2.4.6 under Linux or Mac.<a class="headerlink" href="#instal
77
77
As first step, if you don’t have these already, download and install <aclass="reference external" href="http://www.cmake.org/download/">CMake</a> and <aclass="reference external" href="http://ant.apache.org/">Apache Ant</a>.
78
78
Extract the downloaded OpenCV file in a location of your choice and open CMake ( cmake-gui ).
79
79
Put the location of the extracted OpenCV library in the <codeclass="docutils literal"><spanclass="pre">Where</span><spanclass="pre">is</span><spanclass="pre">the</span><spanclass="pre">source</span><spanclass="pre">code</span><spanclass="pre">field</span></code> (e.g., /opencv2.4.6.1/) and put the destination directory of your build in the <codeclass="docutils literal"><spanclass="pre">Where</span><spanclass="pre">to</span><spanclass="pre">build</span><spanclass="pre">the</span><spanclass="pre">binaries</span></code> field (e.g., /opencv2.4.6.1/build), at last, check the <codeclass="docutils literal"><spanclass="pre">Grouped</span></code> and <codeclass="docutils literal"><spanclass="pre">Advanced</span></code> checkboxes.</p>
<p>Now press <codeclass="docutils literal"><spanclass="pre">Configure</span></code> and use the default compilers for <codeclass="docutils literal"><spanclass="pre">Unix</span><spanclass="pre">Makefiles</span></code>.
82
82
In the <codeclass="docutils literal"><spanclass="pre">Ungrouped</span><spanclass="pre">Entries</span></code> group, insert the path to the Apache Ant executable (e.g., <codeclass="docutils literal"><spanclass="pre">/apacheant1.9.2/bin/ant</span></code>).
83
83
In the <codeclass="docutils literal"><spanclass="pre">BUILD</span></code> group, unselect:
@@ -91,19 +91,19 @@ <h2>Install Open CV 2.4.6 under Linux or Mac.<a class="headerlink" href="#instal
91
91
insert the Java include path (e.g., <codeclass="docutils literal"><spanclass="pre">/usr/lib/jvm/java7oracle/include/</span></code>)
92
92
insert the alternative Java include path (e.g., <codeclass="docutils literal"><spanclass="pre">/usr/lib/jvm/java7oracle/include/linux</span></code>)
93
93
Once we have pressed <codeclass="docutils literal"><spanclass="pre">Generate</span></code> twice the CMake window should appear with a white background. Now close CMake.</p>
<p>Now open the terminal , go to the <codeclass="docutils literal"><spanclass="pre">build</span></code> folder of OpenCV and build everything with the command: <codeclass="docutils literal"><spanclass="pre">make</span><spanclass="pre">-j8</span></code> (wait for the process to be completed...).
96
96
If everything went well you should have <codeclass="docutils literal"><spanclass="pre">opencv-246.jar</span></code> and <codeclass="docutils literal"><spanclass="pre">libopencv_java246.so</span></code> files in the <codeclass="docutils literal"><spanclass="pre">/opencv-2.4.6.1/build/bin</span></code> directory and the <codeclass="docutils literal"><spanclass="pre">data</span></code> folder in the <codeclass="docutils literal"><spanclass="pre">/opencv-2.4.6.1/</span></code> directory.</p>
<h2>Set up OpenCV for Java in Eclipse<aclass="headerlink" href="#set-up-opencv-for-java-in-eclipse" title="Permalink to this headline">¶</a></h2>
100
100
<p>Open Eclipse and select a workspace of your choice. Create a User Library, ready to be used on all the next projects: go to <codeclass="docutils literal"><spanclass="pre">Window</span><spanclass="pre">></span><spanclass="pre">Preferences...</span></code>.</p>
<p>From the menu navigate under <codeclass="docutils literal"><spanclass="pre">Java</span><spanclass="pre">></span><spanclass="pre">Build</span><spanclass="pre">Path</span><spanclass="pre">></span><spanclass="pre">User</span><spanclass="pre">Libraries</span></code> and choose <codeclass="docutils literal"><spanclass="pre">New...</span></code>.
103
103
Enter a name for the library (e.g., opencv246) and select the newly created user library.
104
104
Choose <codeclass="docutils literal"><spanclass="pre">Add</span><spanclass="pre">External</span><spanclass="pre">JARs...</span></code>, browse to select <codeclass="docutils literal"><spanclass="pre">opencv246.jar</span></code>.
105
105
After adding the jar, extend it and select <codeclass="docutils literal"><spanclass="pre">Native</span><spanclass="pre">library</span><spanclass="pre">location</span></code> and press <codeclass="docutils literal"><spanclass="pre">Edit...</span></code>.</p>
<p>Select <codeclass="docutils literal"><spanclass="pre">External</span><spanclass="pre">Folder...</span></code> and browse to select the folder containing the OpenCV libraries (e.g., <codeclass="docutils literal"><spanclass="pre">C:\opencv\build\java\x64</span></code> under Windows).</p>
<h1>First Java Application with OpenCV<aclass="headerlink" href="#first-java-application-with-opencv" title="Permalink to this headline">¶</a></h1>
54
+
<divclass="admonition note">
55
+
<pclass="first admonition-title">Note</p>
56
+
<pclass="last">We assume that by now you have already read the previous tutorials. If not, please check previous tutorials at <aclass="reference external" href="http://polito-java-opencv-tutorials.readthedocs.org/en/latest/index.html">http://polito-java-opencv-tutorials.readthedocs.org/en/latest/index.html</a>. You can also find the source code and resources at <aclass="reference external" href="https://github.com/java-opencv/Polito-Java-OpenCV-Tutorials-Source-Code">https://github.com/java-opencv/Polito-Java-OpenCV-Tutorials-Source-Code</a></p>
<h2>Introduction to a OpenCV application with Java<aclass="headerlink" href="#introduction-to-a-opencv-application-with-java" title="Permalink to this headline">¶</a></h2>
56
60
<p>This tutorial will guide you through the creation of a simple Java console application using the OpenCV library by mean of Eclipse.</p>
@@ -70,17 +74,17 @@ <h2>What we will do in this tutorial<a class="headerlink" href="#what-we-will-do
70
74
<divclass="section" id="create-a-new-project">
71
75
<h2>Create a New Project<aclass="headerlink" href="#create-a-new-project" title="Permalink to this headline">¶</a></h2>
72
76
<p>Open Eclipse and create a new Java project; open the <codeclass="docutils literal"><spanclass="pre">File</span></code> menu, go to <codeclass="docutils literal"><spanclass="pre">New</span></code> and click on <codeclass="docutils literal"><spanclass="pre">Java</span><spanclass="pre">Project</span></code>.</p>
<p>In the <codeclass="docutils literal"><spanclass="pre">New</span><spanclass="pre">Java</span><spanclass="pre">Project</span></code> dialog write the name of your project and click on <codeclass="docutils literal"><spanclass="pre">Finish</span></code>.</p>
75
79
</div>
76
80
<divclass="section" id="add-a-user-library">
77
81
<h2>Add a User Library<aclass="headerlink" href="#add-a-user-library" title="Permalink to this headline">¶</a></h2>
78
82
<p>If you followed the previous tutorial (<codeclass="docutils literal"><spanclass="pre">Installing</span><spanclass="pre">OpenCV</span><spanclass="pre">for</span><spanclass="pre">Java</span></code>), you should already have the OpenCV library set in your workspace’s user libraries, if not please check out the previous tutorial.
79
83
Now you should be ready to add the library to your project.
80
84
Inside Eclipse’s <codeclass="docutils literal"><spanclass="pre">Package</span><spanclass="pre">Explorer</span></code> just right-click on your project’s folder and go to <codeclass="docutils literal"><spanclass="pre">Build</span><spanclass="pre">Path</span><spanclass="pre">--></span><spanclass="pre">Add</span><spanclass="pre">Libraries...</span></code>.</p>
<p>Select <codeclass="docutils literal"><spanclass="pre">User</span><spanclass="pre">Libraries</span></code> and click on <codeclass="docutils literal"><spanclass="pre">Next</span></code>, check the checkbox of the OpenCV library and click <codeclass="docutils literal"><spanclass="pre">Finish</span></code>.</p>
0 commit comments