Skip to content

Commit d972af0

Browse files
committed
Merge pull request #45 from P0ulp/master
Updated loading of native lib for the new processing 2.1 export mode …
2 parents ce489bd + 75d3e65 commit d972af0

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

.classpath

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<classpath>
33
<classpathentry kind="src" path="src"/>
44
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
5-
<classpathentry kind="lib" path="/Users/p0/Documents/Eclipse/processing-libraries/core.jar"/>
65
<classpathentry kind="lib" path="lib/opencv-245.jar"/>
6+
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/processing-core"/>
7+
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/processing-opencv"/>
78
<classpathentry kind="output" path="bin"/>
89
</classpath>

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local.properties
99
.settings/
1010
.loadpath
1111
distribution/*
12+
lib/
1213

1314
# External tool builders
1415
.externalToolBuilders/

resources/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ sketchbook.location=${user.home}/Documents/Processing/
3838
# Uncommenting the line below will overwrite the classpath.local.location from
3939
# above.
4040

41-
classpath.local.location=${user.home}/Documents/code/eclipse/libs
41+
classpath.local.location=${user.home}/Documents/eclipse/userLibraries/processing-core
4242

4343

4444
# Add all jar files that are required for compiling your project to the local

src/gab/opencv/OpenCV.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@
3535
import gab.opencv.Line;
3636

3737
import java.awt.Rectangle;
38-
3938
import java.awt.image.BufferedImage;
4039
import java.awt.image.DataBufferInt;
4140
import java.nio.ByteBuffer;
4241
import java.nio.IntBuffer;
43-
42+
import java.io.File;
4443
import java.lang.reflect.Field;
4544
import java.net.URL;
46-
4745
import java.util.ArrayList;
4846
import java.util.Collections;
4947

@@ -62,9 +60,7 @@
6260
import org.opencv.calib3d.Calib3d;
6361
import org.opencv.core.CvException;
6462
import org.opencv.core.Core.MinMaxLocResult;
65-
6663
import org.opencv.video.BackgroundSubtractorMOG;
67-
6864
import org.opencv.objdetect.CascadeClassifier;
6965
import org.opencv.imgproc.Imgproc;
7066

@@ -354,14 +350,24 @@ private void initNative(){
354350
if(!nativeLoaded){
355351
int bitsJVM = PApplet.parseInt(System.getProperty("sun.arch.data.model"));
356352
String nativeLibPath = getLibPath() ;
353+
357354
if (PApplet.platform == PConstants.WINDOWS) { //platform Windows
358-
nativeLibPath = nativeLibPath + "windows" + bitsJVM;
355+
File path = new File(nativeLibPath + "windows" + bitsJVM);
356+
if (path.exists()) {
357+
nativeLibPath = nativeLibPath + "windows" + bitsJVM;
358+
}
359359
}
360360
if (PApplet.platform == PConstants.MACOSX) { //platform Mac
361-
nativeLibPath = nativeLibPath + "macosx" + bitsJVM;
361+
File path = new File(nativeLibPath + "macosx" + bitsJVM);
362+
if (path.exists()) {
363+
nativeLibPath = nativeLibPath + "macosx" + bitsJVM;
364+
}
362365
}
363366
if (PApplet.platform == PConstants.LINUX) { //platform Linux
364-
nativeLibPath = nativeLibPath + "linux" + bitsJVM;
367+
File path = new File(nativeLibPath + "linux" + bitsJVM);
368+
if (path.exists()) {
369+
nativeLibPath = nativeLibPath + "linux" + bitsJVM;
370+
}
365371
}
366372

367373
if((PApplet.platform == PConstants.MACOSX && bitsJVM == 64) || (PApplet.platform == PConstants.WINDOWS && bitsJVM == 32) || (PApplet.platform == PConstants.LINUX)){

0 commit comments

Comments
 (0)