updating samples to load JNI lib with correct suffix

pull/590/head
Andrey Pavlenko 12 years ago
parent 5321da92cb
commit 29b763dc60
  1. 4
      samples/java/ant/src/SimpleSample.java
  2. 4
      samples/java/eclipse/HelloCV/src/Main.java
  3. 5
      samples/java/sbt/src/main/scala/Main.scala

@ -1,12 +1,14 @@
import org.opencv.core.Core;
import org.opencv.core.Mat; import org.opencv.core.Mat;
import org.opencv.core.CvType; import org.opencv.core.CvType;
import org.opencv.core.Scalar; import org.opencv.core.Scalar;
class SimpleSample { class SimpleSample {
static{ System.loadLibrary("opencv_java244"); } static{ System.loadLibrary("opencv_java" + Core.VERSION_SUFFIX); }
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("Welcome to OpenCV " + Core.VERSION);
Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0)); Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0));
System.out.println("OpenCV Mat: " + m); System.out.println("OpenCV Mat: " + m);
Mat mr1 = m.row(1); Mat mr1 = m.row(1);

@ -1,10 +1,12 @@
import org.opencv.core.Core;
import org.opencv.core.CvType; import org.opencv.core.CvType;
import org.opencv.core.Mat; import org.opencv.core.Mat;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
System.loadLibrary("opencv_java244"); System.out.println("Welcome to OpenCV " + Core.VERSION);
System.loadLibrary("opencv_java" + Core.VERSION_SUFFIX);
Mat m = Mat.eye(3, 3, CvType.CV_8UC1); Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
System.out.println("m = " + m.dump()); System.out.println("m = " + m.dump());
} }

@ -8,11 +8,14 @@
* You're invited to submit your own examples, in any JVM language of * You're invited to submit your own examples, in any JVM language of
* your choosing so long as you can get them to build. * your choosing so long as you can get them to build.
*/ */
import org.opencv.core.Core
object Main extends App { object Main extends App {
// We must load the native library before using any OpenCV functions. // We must load the native library before using any OpenCV functions.
// You must load this library _exactly once_ per Java invocation. // You must load this library _exactly once_ per Java invocation.
// If you load it more than once, you will get a java.lang.UnsatisfiedLinkError. // If you load it more than once, you will get a java.lang.UnsatisfiedLinkError.
System.loadLibrary("opencv_java") System.loadLibrary("opencv_java" + Core.VERSION_SUFFIX)
ScalaCorrespondenceMatchingDemo.run() ScalaCorrespondenceMatchingDemo.run()
ScalaDetectFaceDemo.run() ScalaDetectFaceDemo.run()

Loading…
Cancel
Save