nazirmohd2006 / javacv

Automatically exported from code.google.com/p/javacv
0 stars 0 forks source link

Could not find class x, referenced from method y #356

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I know there are some issuefixes but they didn't work. If you know another fix 
than post it please.

What steps will reproduce the problem?
1.IplImage
2.
3.

What is the expected output? What do you see instead?

Expected is a cropped image. I press a button for starting the .java-file and 
it just crashs: 

08-29 13:48:14.701: W/AudioPolicyManagerBase(796): getOutput() could not find 
output for stream 1, samplingRate 44100,format 1, channels 1, flags 4
08-29 13:48:14.701: E/AudioTrack(1211): Could not get audio output for stream 
type 1
08-29 13:48:14.701: E/SoundPool(1211): Error creating AudioTrack
08-29 13:48:14.721: D/dalvikvm(1621): GC_CONCURRENT freed 108K, 8% free 
2618K/2836K, paused 10ms+14ms, total 82ms
08-29 13:48:14.721: I/dalvikvm(1621): Could not find method 
com.googlecode.javacv.cpp.opencv_highgui.cvLoadImage, referenced from method 
com.example.berechnungen.GetSpielbrett.<init>
08-29 13:48:14.721: W/dalvikvm(1621): VFY: unable to resolve static method 
4662: Lcom/googlecode/javacv/cpp/opencv_highgui;.cvLoadImage 
(Ljava/lang/String;I)Lcom/googlecode/javacv/cpp/opencv_core$IplImage;
08-29 13:48:14.721: D/dalvikvm(1621): VFY: replacing opcode 0x71 at 0x0029
08-29 13:48:14.721: I/dalvikvm(1621): Could not find method 
javax.imageio.ImageIO.read, referenced from method 
com.example.berechnungen.GetSpielbrett.cutten
08-29 13:48:14.721: W/dalvikvm(1621): VFY: unable to resolve static method 
4895: Ljavax/imageio/ImageIO;.read 
(Ljava/io/InputStream;)Ljava/awt/image/BufferedImage;
08-29 13:48:14.732: D/dalvikvm(1621): VFY: replacing opcode 0x71 at 0x000e
08-29 13:48:14.732: I/dalvikvm(1621): Could not find method 
com.googlecode.javacv.cpp.opencv_core$IplImage.width, referenced from method 
com.example.berechnungen.GetSpielbrett.finden
08-29 13:48:14.732: W/dalvikvm(1621): VFY: unable to resolve virtual method 
4654: Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.width ()I
08-29 13:48:14.732: D/dalvikvm(1621): VFY: replacing opcode 0x74 at 0x0000
08-29 13:48:14.741: I/dalvikvm(1621): Could not find method 
javax.imageio.ImageIO.read, referenced from method 
com.example.berechnungen.GetSpielbrett.readImage
08-29 13:48:14.741: W/dalvikvm(1621): VFY: unable to resolve static method 
4894: Ljavax/imageio/ImageIO;.read 
(Ljava/io/File;)Ljava/awt/image/BufferedImage;
08-29 13:48:14.741: D/dalvikvm(1621): VFY: replacing opcode 0x71 at 0x0006
08-29 13:48:14.741: W/dalvikvm(1621): VFY: unable to find class referenced in 
signature (Ljava/awt/image/BufferedImage;)
08-29 13:48:14.741: W/dalvikvm(1621): VFY: unable to find class referenced in 
signature (Ljava/awt/image/BufferedImage;)
08-29 13:48:14.751: E/dalvikvm(1621): Could not find class 
'java.awt.geom.AffineTransform', referenced from method 
com.example.berechnungen.GetSpielbrett.rotateMyImage
08-29 13:48:14.751: W/dalvikvm(1621): VFY: unable to resolve new-instance 663 
(Ljava/awt/geom/AffineTransform;) in Lcom/example/berechnungen/GetSpielbrett;
08-29 13:48:14.751: D/dalvikvm(1621): VFY: replacing opcode 0x22 at 0x0001
08-29 13:48:14.751: W/dalvikvm(1621): VFY: unable to find class referenced in 
signature (Ljava/awt/Image;)
08-29 13:48:14.751: I/dalvikvm(1621): Could not find method 
java.awt.Image.getWidth, referenced from method 
com.example.berechnungen.GetSpielbrett.scaleImage
08-29 13:48:14.751: W/dalvikvm(1621): VFY: unable to resolve virtual method 
4672: Ljava/awt/Image;.getWidth (Ljava/awt/image/ImageObserver;)I
08-29 13:48:14.751: D/dalvikvm(1621): VFY: replacing opcode 0x6e at 0x0007
08-29 13:48:14.751: W/dalvikvm(1621): VFY: unable to find class referenced in 
signature (Ljava/awt/image/BufferedImage;)
08-29 13:48:14.751: I/dalvikvm(1621): Could not find method 
javax.imageio.ImageIO.write, referenced from method 
com.example.berechnungen.GetSpielbrett.writeImage
08-29 13:48:14.751: W/dalvikvm(1621): VFY: unable to resolve static method 
4896: Ljavax/imageio/ImageIO;.write 
(Ljava/awt/image/RenderedImage;Ljava/lang/String;Ljava/io/File;)Z
08-29 13:48:14.751: D/dalvikvm(1621): VFY: replacing opcode 0x71 at 0x0006
08-29 13:48:14.751: D/dalvikvm(1621): DexOpt: unable to opt direct call 0x1226 
at 0x5e in Lcom/example/berechnungen/GetSpielbrett;.finden
08-29 13:48:14.751: D/dalvikvm(1621): DexOpt: unable to opt direct call 0x122a 
at 0x79 in Lcom/example/berechnungen/GetSpielbrett;.finden
08-29 13:48:14.761: D/dalvikvm(1621): DexOpt: unable to opt direct call 0x1241 
at 0x03 in Lcom/example/berechnungen/GetSpielbrett;.rotateMyImage
08-29 13:48:14.761: D/dalvikvm(1621): DexOpt: unable to opt direct call 0x1243 
at 0x17 in Lcom/example/berechnungen/GetSpielbrett;.rotateMyImage
08-29 13:48:14.761: D/dalvikvm(1621): DexOpt: unable to opt direct call 0x1243 
at 0x49 in Lcom/example/berechnungen/GetSpielbrett;.scaleImage
08-29 13:48:14.761: D/AndroidRuntime(1621): Shutting down VM
08-29 13:48:14.761: W/dalvikvm(1621): threadid=1: thread exiting with uncaught 
exception (group=0xb4e18908)
08-29 13:48:14.771: E/AndroidRuntime(1621): FATAL EXCEPTION: main
08-29 13:48:14.771: E/AndroidRuntime(1621): java.lang.NoClassDefFoundError: 
com.googlecode.javacv.cpp.opencv_highgui
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
com.example.berechnungen.GetSpielbrett.<init>(GetSpielbrett.java:61)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
com.example.app_testen.SecondActivity$1.onClick(SecondActivity.java:30)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
android.view.View.performClick(View.java:4202)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
android.view.View$PerformClick.run(View.java:17340)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
android.os.Handler.handleCallback(Handler.java:725)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
android.os.Handler.dispatchMessage(Handler.java:92)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
android.os.Looper.loop(Looper.java:137)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
android.app.ActivityThread.main(ActivityThread.java:5039)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
java.lang.reflect.Method.invokeNative(Native Method)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
java.lang.reflect.Method.invoke(Method.java:511)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-29 13:48:14.771: E/AndroidRuntime(1621):     at 
dalvik.system.NativeStart.main(Native Method)
08-29 13:48:14.791: W/ActivityManager(1211):   Force finishing activity 
com.example.app_testen/.SecondActivity
08-29 13:48:14.801: W/WindowManager(1211): Failure taking screenshot for 
(246x437) to layer 21015
08-29 13:48:14.911: W/Trace(1211): Unexpected value from nativeGetEnabledTags: 0
08-29 13:48:14.911: W/Trace(1211): Unexpected value from nativeGetEnabledTags: 0
08-29 13:48:14.921: W/Trace(1211): Unexpected value from nativeGetEnabledTags: 0
08-29 13:48:14.931: W/Trace(1211): Unexpected value from nativeGetEnabledTags: 0
08-29 13:48:14.952: W/Trace(1211): Unexpected value from nativeGetEnabledTags: 0
08-29 13:48:14.952: W/Trace(1211): Unexpected value from nativeGetEnabledTags: 0
08-29 13:48:15.011: W/Trace(1211): Unexpected value from nativeGetEnabledTags: 0
08-29 13:48:15.041: W/Trace(1211): Unexpected value from nativeGetEnabledTags: 0

What version of the product are you using? On what operating system?
Im using the version 2.4.6 with windows 8 64 bit. 

Please provide any additional information below.

I have this library:

D:\OpenCV-2.4.6-android-sdk\sdk\java\bin\opencv library - 2.4.6.jar
D:\javacv-bin\javacpp.jar
D:\javacv-bin\javacv.jar
D:\javacv-bin\javacv-android-arm.jar
D:\javacv-bin\javacv-linux-x86.jar
D:\javacv-bin\javacv-linux-x86_64.jar
D:\javacv-bin\javacv-macosx-x86_64.jar
D:\javacv-bin\javacv-windows-x86.jar
D:\javacv-bin\javacv-windows-x86_64.jar

Allready created a extra /lib folder for the library but still does not work.

Original issue reported on code.google.com by buchheim...@gmail.com on 29 Aug 2013 at 2:02

GoogleCodeExporter commented 8 years ago
How did you build JavaCV?

Original comment by samuel.a...@gmail.com on 31 Aug 2013 at 7:05

GoogleCodeExporter commented 8 years ago
I used this files from you download section: javacv-bin and javacv-cppjars

I deleted my project and I followed your instruction 
now(http://code.google.com/p/javacv/). This is my library now:

bild1(also added the javacpp.jar and javacv.jar)

This is my program which I try to execute:

import static com.googlecode.javacv.cpp.opencv_core.cvCopy;
import static com.googlecode.javacv.cpp.opencv_core.cvLine;
import static com.googlecode.javacv.cpp.opencv_core.cvPoint;
import static com.googlecode.javacv.cpp.opencv_core.cvRect;
import static com.googlecode.javacv.cpp.opencv_core.cvResetImageROI;
import static com.googlecode.javacv.cpp.opencv_core.cvSetImageROI;
import static com.googlecode.javacv.cpp.opencv_highgui.CV_LOAD_IMAGE_GRAYSCALE;
import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImage;
import static com.googlecode.javacv.cpp.opencv_highgui.cvSaveImage;
import static com.googlecode.javacv.cpp.opencv_imgproc.CV_GRAY2BGR;
import static com.googlecode.javacv.cpp.opencv_imgproc.cvCvtColor;

import java.io.IOException;
import com.googlecode.javacv.ObjectFinder;
import com.googlecode.javacv.cpp.opencv_core.CvScalar;
import com.googlecode.javacv.cpp.opencv_core.IplImage;

public class GetSpielbrett {

    static int tmp = 0;

    static String hauptdatei = "IMAG0232";

    static String objectFilename = "assets/sblinksoben.png";
    static String datei = "sblinksoben";
    static String objectFilename1 = "assets/sbrechtsunten.png";
    static String datei1 = "sbrechtsunten";

    static String objectFilename3 = "assets/sbobenrechts.jpg";
    static String datei3 = "sbrechtsoben";
    static String sceneFilename = "" + hauptdatei
            + ".PNG";
    static String sceneFilename1 = "spielbrett-gedreht.png";

public static void bilderladen()
    {
        object = cvLoadImage(objectFilename,
                CV_LOAD_IMAGE_GRAYSCALE);
        object1 = cvLoadImage(objectFilename1,
                CV_LOAD_IMAGE_GRAYSCALE);       
        object3 = cvLoadImage(objectFilename3,
                CV_LOAD_IMAGE_GRAYSCALE);
        image = cvLoadImage(sceneFilename, CV_LOAD_IMAGE_GRAYSCALE);
        imageShow = cvLoadImage(sceneFilename);
        sceneFilename = "" + hauptdatei
                + ".PNG";
        image = cvLoadImage(sceneFilename, CV_LOAD_IMAGE_GRAYSCALE);
        imageShow = cvLoadImage(sceneFilename);
    }
}

Here is my MainActivitiy:

public class MainActivity extends Activity {

    GetSpielbrett sander = new GetSpielbrett();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button btnActivity = (Button)findViewById(R.id.button1);
        btnActivity.setOnClickListener(new View.OnClickListener()
        {
                @Override
                public void onClick(View v) {
                       sander.bilderladen();
                    }
        }); 
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}

And I get this error message:
09-02 07:52:35.862: D/dalvikvm(1739): GC_CONCURRENT freed 188K, 11% free 
2626K/2928K, paused 16ms+14ms, total 76ms
09-02 07:52:36.132: D/dalvikvm(1739): GC_CONCURRENT freed 319K, 14% free 
2753K/3184K, paused 10ms+38ms, total 85ms
09-02 07:52:36.163: W/dalvikvm(1739): Exception 
Ljava/lang/UnsatisfiedLinkError; thrown while initializing 
Lcom/googlecode/javacv/cpp/opencv_core;
09-02 07:52:36.163: W/dalvikvm(1739): Exception 
Ljava/lang/ExceptionInInitializerError; thrown while initializing 
Lcom/googlecode/javacv/cpp/opencv_imgproc;
09-02 07:52:36.163: W/dalvikvm(1739): Exception 
Ljava/lang/ExceptionInInitializerError; thrown while initializing 
Lcom/googlecode/javacv/cpp/opencv_highgui;
09-02 07:52:36.163: D/AndroidRuntime(1739): Shutting down VM
09-02 07:52:36.163: W/dalvikvm(1739): threadid=1: thread exiting with uncaught 
exception (group=0xb4da4908)
09-02 07:52:36.182: E/AndroidRuntime(1739): FATAL EXCEPTION: main
09-02 07:52:36.182: E/AndroidRuntime(1739): 
java.lang.ExceptionInInitializerError
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.example.appseln.GetSpielbrett.bilderladen(GetSpielbrett.java:153)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.example.appseln.MainActivity$1.onClick(MainActivity.java:24)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
android.view.View.performClick(View.java:4202)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
android.view.View$PerformClick.run(View.java:17340)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
android.os.Handler.handleCallback(Handler.java:725)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
android.os.Handler.dispatchMessage(Handler.java:92)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
android.os.Looper.loop(Looper.java:137)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
android.app.ActivityThread.main(ActivityThread.java:5039)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
java.lang.reflect.Method.invokeNative(Native Method)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
java.lang.reflect.Method.invoke(Method.java:511)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
dalvik.system.NativeStart.main(Native Method)
09-02 07:52:36.182: E/AndroidRuntime(1739): Caused by: 
java.lang.ExceptionInInitializerError
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
java.lang.Class.classForName(Native Method)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
java.lang.Class.forName(Class.java:217)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.googlecode.javacpp.Loader.load(Loader.java:453)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:85)
09-02 07:52:36.182: E/AndroidRuntime(1739):     ... 13 more
09-02 07:52:36.182: E/AndroidRuntime(1739): Caused by: 
java.lang.ExceptionInInitializerError
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
java.lang.Class.classForName(Native Method)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
java.lang.Class.forName(Class.java:217)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.googlecode.javacpp.Loader.load(Loader.java:453)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:97)
09-02 07:52:36.182: E/AndroidRuntime(1739):     ... 17 more
09-02 07:52:36.182: E/AndroidRuntime(1739): Caused by: 
java.lang.UnsatisfiedLinkError: Couldn't load jniopencv_core from loader 
dalvik.system.PathClassLoader[dexPath=/data/app/com.example.appseln-1.apk,librar
yPath=/data/app-lib/com.example.appseln-1]: findLibrary returned null
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
java.lang.Runtime.loadLibrary(Runtime.java:365)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
java.lang.System.loadLibrary(System.java:535)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.googlecode.javacpp.Loader.load(Loader.java:489)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.googlecode.javacpp.Loader.load(Loader.java:431)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:136)
09-02 07:52:36.182: E/AndroidRuntime(1739):     ... 21 more
09-02 07:52:36.182: E/AndroidRuntime(1739): Caused by: 
java.lang.UnsatisfiedLinkError: Couldn't load opencv_core from loader 
dalvik.system.PathClassLoader[dexPath=/data/app/com.example.appseln-1.apk,librar
yPath=/data/app-lib/com.example.appseln-1]: findLibrary returned null
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
java.lang.Runtime.loadLibrary(Runtime.java:365)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
java.lang.System.loadLibrary(System.java:535)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
09-02 07:52:36.182: E/AndroidRuntime(1739):     at 
com.googlecode.javacpp.Loader.load(Loader.java:481)
09-02 07:52:36.182: E/AndroidRuntime(1739):     ... 23 more

I hope its good enough for helping me. Thanks in advance.

Original comment by buchheim...@gmail.com on 2 Sep 2013 at 8:04

Attachments:

GoogleCodeExporter commented 8 years ago
The precompiled binaries probably won't work with OpenCV 2.4.6. You should try 
2.4.5 as instructed in the README.txt file.

Original comment by samuel.a...@gmail.com on 2 Sep 2013 at 8:16

GoogleCodeExporter commented 8 years ago
I used the library from your downloadsection. They should be from 2.4.5 or not? 
So I don't know what I made totally wrong.(I know there is something wrong but 
I don't find where I did wrong ;))

Original comment by buchheim...@gmail.com on 2 Sep 2013 at 8:33

GoogleCodeExporter commented 8 years ago
I tried it with 2.3.1 and it's exact the same error.

Original comment by buchheim...@gmail.com on 2 Sep 2013 at 9:34

GoogleCodeExporter commented 8 years ago
Any other solution?

Original comment by buchheim...@gmail.com on 3 Sep 2013 at 7:09

GoogleCodeExporter commented 8 years ago
Have you tried with opencv-2.4.5-android-arm.jar as per the README.txt file ?

Original comment by samuel.a...@gmail.com on 4 Sep 2013 at 1:09

GoogleCodeExporter commented 8 years ago
Yes I did. I didn't even tried it with 2.4.6. Only with 2.4.5. But to be honest 
I don't really understand this README.txt. You mean this README.txt right?

Original comment by buchheim...@gmail.com on 4 Sep 2013 at 6:31

Attachments:

GoogleCodeExporter commented 8 years ago
Ok, so did you make sure that your Android device has an ARMv7 CPU?

Original comment by samuel.a...@gmail.com on 4 Sep 2013 at 6:33

GoogleCodeExporter commented 8 years ago
I tried it with the emulator and with the new HTC ONE.

Original comment by buchheim...@gmail.com on 4 Sep 2013 at 6:53

GoogleCodeExporter commented 8 years ago
What does that mean when I don't have this CPU. It would't run with it?

Original comment by buchheim...@gmail.com on 4 Sep 2013 at 6:55

GoogleCodeExporter commented 8 years ago
Well then you libraries are obviously not getting installed on your device. 
Have you tried to recreate your project? Android is very buggy, so ideally you 
should also try to remove and reinstall *everything*. 

Original comment by samuel.a...@gmail.com on 4 Sep 2013 at 6:55

GoogleCodeExporter commented 8 years ago
Yes, that's what "The binaries for Android were compiled for ARMv7 processors" 
means.

Original comment by samuel.a...@gmail.com on 4 Sep 2013 at 6:56

GoogleCodeExporter commented 8 years ago
Is there a list which devices have ARMv7 precessors?

Original comment by buchheim...@gmail.com on 4 Sep 2013 at 6:59

GoogleCodeExporter commented 8 years ago
Anyways I gonna reinstall everthing and I will write the result. Firstly thanks.

Original comment by buchheim...@gmail.com on 4 Sep 2013 at 7:13

GoogleCodeExporter commented 8 years ago
Here's a good list:
http://en.wikipedia.org/wiki/Comparison_of_Android_devices
The emulator and HTC ONE have an ARMv7, so your problem is most likely Android 
not building and installing your app properly. This is usually fixed by 
recreating, uninstalling, and reinstalling various things related with the SDK, 
your project, and your device...

Original comment by samuel.a...@gmail.com on 4 Sep 2013 at 7:22

GoogleCodeExporter commented 8 years ago
Finally this function runs. But there is another problem. I just splitted my 
project in many functions to see where the problem is. Here is the code which 
makes problems now:

public void sucher() throws InterruptedException
    {

        array = finden(object, image, imageShow, datei);
        tmp++;
        array3 = finden(object3, image, imageShow, datei3);
        tmp++;
        array1 = finden(object1, image, imageShow, datei1);     

    }

public static int[] finden(IplImage object, IplImage image,
            IplImage imageShow, String datei) throws InterruptedException {

        IplImage objectColor = IplImage.create(object.width(), object.height(),
                8, 3);
        cvCvtColor(object, objectColor, CV_GRAY2BGR);
        IplImage correspond = IplImage.create(image.width(), object.height()
                + image.height(), 8, 1);
        cvSetImageROI(correspond, cvRect(0, 0, object.width(), object.height()));

        cvCopy(object, correspond);
        cvSetImageROI(
                correspond,
                cvRect(0, object.height(), correspond.width(),
                        correspond.height()));
        cvCopy(image, correspond);
        cvResetImageROI(correspond);
        ObjectFinder.Settings settings = new ObjectFinder.Settings();
        settings.setObjectImage(object);
        settings.setUseFLANN(true);
        settings.setRansacReprojThreshold(5);
        ObjectFinder finder = new ObjectFinder(settings);

        long start = System.currentTimeMillis();
        double[] dst_corners = finder.find(image);
        System.out.println("Finding time = "
                + (System.currentTimeMillis() - start) + " ms");

        int[] array = new int[2];
        array[1] = 100000000;

        array[0] = 100000000;

        if (dst_corners != null) {
            for (int i = 0; i < 4; i++) {
                int j = (i + 1) % 4;
                int x1 = (int) Math.round(dst_corners[2 * i]);
                int y1 = (int) Math.round(dst_corners[2 * i + 1]);
                int x2 = (int) Math.round(dst_corners[2 * j]);
                int y2 = (int) Math.round(dst_corners[2 * j + 1]);
                cvLine(correspond, cvPoint(x1, y1 + object.height()),
                        cvPoint(x2, y2 + object.height()), CvScalar.GREEN, 1,
                        8, 0);
                cvLine(imageShow, cvPoint(x1, y1), cvPoint(x2, y2),
                        CvScalar.GREEN, 5, 8, 0);
                // System.out.println("x1 :" + x1 + " y1 :" + y1);

                if (tmp == 0 && i == 0) {
                    array[0] = x1;
                    array[1] = y1;
                    System.out.println("OBENLINKS: Koordinate x1: " + array[0]
                            + " Koordinate y1: " + array[1]);

                }
                if (tmp == 1 && i == 1) {
                    array[0] = x1;
                    array[1] = y1;
                    System.out.println("OBENRECHTS: Koordinate x1: " + array[0]
                            + " Koordinate y1: " + array[1]);
                }

                if (tmp == 2 && i == 2) {
                    array[0] = x1;
                    array[1] = y1;
                    System.out.println("UNTENRECHTS: Koordinate x1: "
                            + array[0] + " Koordinate y1: " + array[1]);
                    tmp = 0;
                }

            }

        }

        cvSaveImage("" + datei
                + "-gefunden.jpg", imageShow);

        return array;

    }

Now I get this error: 
09-04 11:52:38.894: D/AndroidRuntime(547): Shutting down VM
09-04 11:52:38.894: W/dalvikvm(547): threadid=1: thread exiting with uncaught 
exception (group=0x409961f8)
09-04 11:52:38.913: E/AndroidRuntime(547): FATAL EXCEPTION: main
09-04 11:52:38.913: E/AndroidRuntime(547): java.lang.RuntimeException: Unable 
to start activity 
ComponentInfo{com.example.appseln2/com.example.appseln2.MainActivity}: 
java.lang.NullPointerException
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
android.app.ActivityThread.access$600(ActivityThread.java:122)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
android.os.Handler.dispatchMessage(Handler.java:99)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
android.os.Looper.loop(Looper.java:137)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
android.app.ActivityThread.main(ActivityThread.java:4340)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
java.lang.reflect.Method.invokeNative(Native Method)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
java.lang.reflect.Method.invoke(Method.java:511)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
dalvik.system.NativeStart.main(Native Method)
09-04 11:52:38.913: E/AndroidRuntime(547): Caused by: 
java.lang.NullPointerException
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
com.example.appseln2.GetSpielbrett.finden(GetSpielbrett.java:258)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
com.example.appseln2.GetSpielbrett.sucher(GetSpielbrett.java:172)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
com.example.appseln2.MainActivity.onCreate(MainActivity.java:26)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
android.app.Activity.performCreate(Activity.java:4465)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-04 11:52:38.913: E/AndroidRuntime(547):  at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
09-04 11:52:38.913: E/AndroidRuntime(547):  ... 11 more

Original comment by buchheim...@gmail.com on 4 Sep 2013 at 11:58

GoogleCodeExporter commented 8 years ago
Good to hear it's working!

As for the NullPointerException, well, you obviously have a NULL pointer 
somewhere. Look around ActivityThread.java:1955 and fix it!

And please post your questions on the mailing list next time if possible, thank 
you!

Original comment by samuel.a...@gmail.com on 15 Sep 2013 at 4:14