bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.57k stars 1.58k forks source link

JavaCV error java.lang.NullPointerException for Mat.address() #1047

Closed AdityaPrakash23 closed 6 years ago

AdityaPrakash23 commented 6 years ago

Hello There! I am working on an Native Android App that uses JavaCV run on a DragonBoard820 running Android API 23. It uses JAVACV library for Android that I manually setup to read video file as Frame object then convert them to Mat object. That Mat object is passed to the native code as an argument where the program takes the frame and generates a grayscale of the Mat object.Also the native code sends whether the conversion was successful or not. This grayscale Mat object is then recorded using OpenCVFrameRecorder() after converting it back to Frame object. The Java code is below

import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.TextView;

import org.bytedeco.javacpp.opencv_core;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.FrameGrabber;
import org.bytedeco.javacv.FrameRecorder;
import org.bytedeco.javacv.OpenCVFrameConverter;
import org.bytedeco.javacv.OpenCVFrameRecorder;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.videoio.VideoCapture;

public class MainActivity extends AppCompatActivity {

    Mat inImage,outImage;
    opencv_core.Mat mat,mat2;
    int state = 0;
    Frame outFrame = null;
    Frame vFrame = null;
    FrameGrabber videoGrabber;
    FrameRecorder videoRecorder;
    // Used to load the 'native-lib' library on application startup.
    static {
        System.loadLibrary("native-lib");
        System.loadLibrary("opencv_java3");
    }

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

        TextView tv = (TextView) findViewById(R.id.sample_text);
        tv.setText(R.string.msg);

        VideoCapture videoCapture = new VideoCapture();
        videoCapture.open(Environment.getExternalStorageDirectory().toString() + "/MVI_3572.AVI");
        if(!videoCapture.isOpened()){Log.d("Status Check : ","VideoCapture Doesn't Work!!!!");}

        inImage = new Mat(480,640, CvType.CV_8UC4);
        outImage = new Mat(480,640, CvType.CV_8UC1);
        mat = new opencv_core.Mat(new opencv_core.Size(640,480),CvType.CV_8UC4);
        mat2 = new opencv_core.Mat(new opencv_core.Size(640,480),CvType.CV_8UC1);

        videoGrabber = new FFmpegFrameGrabber(Environment.getExternalStorageDirectory().toString() + "/aimer.mp4");
        videoGrabber.setFormat("mp4");
        videoGrabber.setFrameRate(20);
        videoGrabber.setImageWidth(640);
        videoGrabber.setImageHeight(480);
        int x = videoGrabber.getVideoCodec();

        videoRecorder = new OpenCVFrameRecorder(Environment.getExternalStorageDirectory().getPath()+"/output.mp4",640,480);
        videoRecorder.setVideoCodec(x);
        videoRecorder.setFrameRate(20);
        videoRecorder.setImageHeight(480);
        videoRecorder.setImageWidth(640);

        //TextView tv = (TextView) findViewById(R.id.sample_text);
        tv.setText(tv.getText()+"\nonPreExecute!!!!!");

        OpenCVFrameConverter.ToMat converterToMat = new OpenCVFrameConverter.ToMat();

        try
        {
            videoGrabber.start();
            Log.d("Status Check : ","Video Grabber started");
        } catch (Exception e){
            Log.e("Status Check :", "Failed to start grabber" + e);
        }

        try {
            videoRecorder.start();
        } catch (FrameRecorder.Exception e) {
            e.printStackTrace();
        }

        do {
            try {
                vFrame = videoGrabber.grabFrame();
                if (vFrame != null) {
                    mat = converterToMat.convert(vFrame);
                    //if (mat != null) {
                    Log.d("Status Check :", "Working...");
                    inImage = new org.opencv.core.Mat(mat.address());

                    state = processStateFromJNI(inImage.getNativeObjAddr(), outImage.getNativeObjAddr());

                    if (state == 1) {
                        Log.d("Status Check :", "Starting process...");
                        mat2 = new opencv_core.Mat() { { address = outImage.getNativeObjAddr(); } };
                        Log.d("Status Check :", "Got mat2...");
                        outFrame = converterToMat.convert(mat2);
                        if(outFrame != null){
                            Log.d("Status Check :", "Starting to record video...");
                            videoRecorder.record(outFrame);
                            Log.d("Status Check :", "\n Process completed!!!");
                        }
                    } else if (state == 0) {
                        Log.d("Status Check :", "\n Process not completed!!!");
                    }
                    //}
                }
            } catch (Exception e) {
                Log.e("Status Check :", "video grabFrame failed: " + e);
            }
        } while(vFrame != null);

        //TextView tv = (TextView) findViewById(R.id.sample_text);
        tv.setText(tv.getText()+"\nonPostExecute!!!!!");

        try
        {
            videoGrabber.stop();
            videoRecorder.stop();
        }catch (Exception e) {
            Log.e("Status Check :", "failed to stop video grabber", e);
        }

        Log.d("Status Check", "Ended video processing...");

        if (state == 1) {
            tv.setText(tv.getText() + "\n Process completed!!!");
        } else if (state == 0) {
            tv.setText(tv.getText() + "\n Process Error!!!");
        }
    }

    public native int processStateFromJNI(long matAddrRgba, long matAddrGray);
}

The native program is

#include <jni.h>
#include <string>
#include <stdexcept>

#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/objdetect.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/video.hpp>
#include <opencv2/videoio.hpp>

#include <android/log.h>

#define LOG_TAG "FaceDetection/DetectionBasedTracker"
#define LOGD(...) (__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))

using namespace cv;
using namespace std;

int toGray(Mat img, Mat& gray);

extern "C" JNIEXPORT jint

JNICALL
Java_com_example_iq3_computervisionapp_MainActivity_processStateFromJNI(
        JNIEnv *env,
        jobject /*this*/, jlong addrRgba, jlong addrGray ) {
    Mat& mRgb = *(Mat*)addrRgba;
    Mat& mGray = *(Mat*)addrGray;

    LOGD("Before starting...");

    int conv;
    jint retVal;
    conv = toGray(mRgb,mGray);
    retVal = (jint)conv;
    return retVal;
}

int toGray(Mat img, Mat& gray){

    cvtColor(img,gray,CV_RGBA2GRAY);
    if(gray.rows == img.rows && gray.cols == img.cols){
        return 1;
    }
    else{
        return 0;
    }
}

When I am trying to run the program I am getting these messages in my run window 1.

$ adb shell am start -n "com.example.iq3.computervisionapp/com.example.iq3.computervisionapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 4512 on device unknown-msm8996_for_arm64-277010101101700108
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_dependencies_apk.apk@classes.dex) because non-0 exit status
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_slice_0_apk.apk@classes.dex) because non-0 exit status
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_slice_1_apk.apk@classes.dex) because non-0 exit status
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_slice_2_apk.apk@classes.dex) because non-0 exit status
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_slice_3_apk.apk@classes.dex) because non-0 exit status
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_slice_4_apk.apk@classes.dex) because non-0 exit status
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_slice_5_apk.apk@classes.dex) because non-0 exit status
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_slice_6_apk.apk@classes.dex) because non-0 exit status
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_slice_7_apk.apk@classes.dex) because non-0 exit status
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_slice_8_apk.apk@classes.dex) because non-0 exit status
W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=kryo --instruction-set-features=default --dex-file=/data/app/com.example.iq3.computervisionapp-2/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.iq3.computervisionapp-2@split_lib_slice_9_apk.apk@classes.dex) because non-0 exit status
I/InstantRun: starting instant run server: is main process
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
V/BoostFramework: mAcquireFunc method = public int com.qualcomm.qti.Performance.perfLockAcquire(int,int[])
                  mReleaseFunc method = public int com.qualcomm.qti.Performance.perfLockRelease()
                  mAcquireTouchFunc method = public int com.qualcomm.qti.Performance.perfLockAcquireTouch(android.view.MotionEvent,android.util.DisplayMetrics,int,int[])
                  mIOPStart method = public int com.qualcomm.qti.Performance.perfIOPrefetchStart(int,java.lang.String)
                  mIOPStop method = public int com.qualcomm.qti.Performance.perfIOPrefetchStop()
V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@cf4c540
                  BoostFramework() : mPerf = com.qualcomm.qti.Performance@7d1ac79
I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
       Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
D/Status Check :: VideoCapture Doesn't Work!!!!
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniopencv_core.so: unused DT entry: type 0xf arg 0x8b046
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniavutil.so: unused DT entry: type 0xf arg 0x1c68c
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniswresample.so: unused DT entry: type 0xf arg 0x3184
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniavcodec.so: unused DT entry: type 0xf arg 0x1c3fc
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniavformat.so: unused DT entry: type 0xf arg 0x190a1
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniswscale.so: unused DT entry: type 0xf arg 0x4197
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjnipostproc.so: unused DT entry: type 0xf arg 0x2c13
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniavfilter.so: unused DT entry: type 0xf arg 0xaa79
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniavdevice.so: unused DT entry: type 0xf arg 0x4a85
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniopencv_imgproc.so: unused DT entry: type 0xf arg 0x435b8
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniopencv_imgcodecs.so: unused DT entry: type 0xf arg 0x594e
W/linker: /data/app/com.example.iq3.computervisionapp-2/lib/arm64/libjniopencv_videoio.so: unused DT entry: type 0xf arg 0x3993
D/Status Check :: Video Grabber started
D/Status Check :: Working...
D/FaceDetection/DetectionBasedTracker: Before starting...
D/Status Check :: Starting process...
D/Status Check :: Got mat2...
D/Status Check :: Starting to record video...
                   Process completed!!!

2.

D/Status Check :: Working...
D/FaceDetection/DetectionBasedTracker: Before starting...
D/Status Check :: Starting process...
D/Status Check :: Got mat2...
                  Starting to record video...
                   Process completed!!!
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
E/Status Check :: video grabFrame failed: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.bytedeco.javacpp.opencv_core$Mat.address()' on a null object reference
D/Status Check :: Working...
D/FaceDetection/DetectionBasedTracker: Before starting...
D/Status Check :: Starting process...
                  Got mat2...
                  Starting to record video...
                   Process completed!!!

3.

D/Status Check :: Working...
D/FaceDetection/DetectionBasedTracker: Before starting...
D/Status Check ::  Process not completed!!!
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x958deec2e8c338 in tid 5023 (FinalizerDaemon)
D/Status Check :: Working...
D/FaceDetection/DetectionBasedTracker: Before starting...
D/Status Check :: Starting process...
                  Got mat2...
D/Status Check :: Starting to record video...
                   Process completed!!!
D/Status Check :: Working...
D/FaceDetection/DetectionBasedTracker: Before starting...
D/Status Check :: Starting process...
                  Got mat2...
                  Starting to record video...
D/Status Check ::  Process completed!!!
D/Status Check :: Working...
D/FaceDetection/DetectionBasedTracker: Before starting...
D/Status Check :: Starting process...
Application terminated.

My main issue is when I am trying to run the app, after some time my app just crashes after giving the error message 3. I believe this happens because of the multiple occurances of error message 2. I haven't been able to solve this issue. What should I do?

saudet commented 6 years ago

If you're not interested in audio frames, try to call grabImage() instead of grabFrame().

AdityaPrakash23 commented 6 years ago

I tried but there is no grabImage() function for FFmpegFrameGrabber() object. I tried grab() too but still get the same error messages and the program crashes.

saudet commented 6 years ago

You'll need to use a recent version of JavaCV for that, and the latest release is 1.4.2, so please use that version.

AdityaPrakash23 commented 6 years ago

I am using the recent version of JavaCV 1.4.2. I followed the manual setup guide for IntelliJ IDEA as Android Studio based on that. Is there any issue with my setup?

saudet commented 6 years ago

Yes, you said this method doesn't exist: http://bytedeco.org/javacv/apidocs/org/bytedeco/javacv/FFmpegFrameGrabber.html#grabImage--

AdityaPrakash23 commented 6 years ago

Thanks, I changed the declaration for the videoGrabber variable at I didn't get the NullPointerException. But my program still crashes giving the message at the end

01-01 07:14:08.991 5050-5050/com.example.iq3.computervisionapp A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x1fc in tid 5050 (mputervisionapp)
01-01 07:14:08.992 5050-5059/com.example.iq3.computervisionapp A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x958deec25cbe58 in tid 5059 (FinalizerDaemon)
01-01 07:14:08.992 5050-5059/com.example.iq3.computervisionapp I/libc: Another thread contacted debuggerd first; not contacting debuggerd.

Any suggestions to solve this problem will be awesome! Thanks!

saudet commented 6 years ago

This is probably just memory corruption. Make sure you're allocating all native memory properly and not deallocate prematurely.

saudet commented 6 years ago

For example, converterToMat might get deallocated before we're done with it. Just to be safe, move the reference to a field, like you're already doing with the rest.

AdityaPrakash23 commented 6 years ago

I am new to Android itself so please could you elaborate what I should be doing in my code?

saudet commented 6 years ago

You have Mat inImage,outImage; up there, put all the other variable declarations there too.

AdityaPrakash23 commented 6 years ago

I put all the variable declarations up with Mat inImage,outImage; and have initialized all variables except the videoGrabber and videoRecorder(initializing in the onCreate() method). Now I am still getting the Fatal Signal message.

D/Status Check :: Working...
D/FaceDetection/DetectionBasedTracker: Before starting...
D/Status Check :: Starting process...
                  Got mat2...
                  Starting to record video...
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xbd5124f840 in tid 8396 (FinalizerDaemon)
D/Status Check ::  Process completed!!!
D/Status Check :: Working...

What else can I do?

saudet commented 6 years ago

First find the line that fails.

AdityaPrakash23 commented 6 years ago

After some digging I was able to get the tombstone for crashes using adb logcat to get the complete crash report. The messages that I got were

  1. Out of Physical Memory
    01-01 07:27:02.530 15514 15514 D Status Check ::  Process completed!!!
    01-01 07:27:02.534 15514 15514 D Status Check :: Working...
    01-01 07:27:02.534 15514 15514 D FaceDetection/DetectionBasedTracker: Before starting...
    01-01 07:27:02.535 15514 15514 D Status Check :: Starting process...
    01-01 07:27:03.333   848   938 W XTCC-5.1.0.10: [WifiScanner] WiFi scan result : [9] AP's
    01-01 07:27:03.542 15514 15514 D AndroidRuntime: Shutting down VM
    01-01 07:27:03.544 15514 15514 E AndroidRuntime: FATAL EXCEPTION: main
    01-01 07:27:03.544 15514 15514 E AndroidRuntime: Process: com.example.iq3.computervisionapp, PID: 15514
    01-01 07:27:03.544 15514 15514 E AndroidRuntime: java.lang.OutOfMemoryError: Physical memory usage is too high: physicalBytes (512M) > maxPhysicalBytes (512M)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at org.bytedeco.javacpp.Pointer.deallocator(Pointer.java:588)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at org.bytedeco.javacpp.Pointer.init(Pointer.java:124)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at org.bytedeco.javacpp.opencv_core$Mat.allocate(Native Method)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at org.bytedeco.javacpp.opencv_core$Mat.<init>(opencv_core.java:19261)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at com.example.iq3.computervisionapp.MainActivity$1.<init>(MainActivity.java:96)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at com.example.iq3.computervisionapp.MainActivity.onCreate(MainActivity.java:96)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:6292)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at android.app.ActivityThread.access$900(ActivityThread.java:150)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:102)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:5417)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    01-01 07:27:03.544 15514 15514 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    01-01 07:27:03.554  1111  1811 W ActivityManager:   Force finishing activity com.example.iq3.computervisionapp/.MainActivity
  2. The Fatal Signal
    01-01 07:27:09.543 15514 15524 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x958deec7b0be58 in tid 15524 (FinalizerDaemon)
    01-01 07:27:09.650  6439  6439 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    01-01 07:27:09.650  6439  6439 F DEBUG   : Build fingerprint: 'Android/msm8996/msm8996:6.0.1/APQ8096_M_V22/robin01051129:userdebug/test-keys'
    01-01 07:27:09.650  6439  6439 F DEBUG   : Revision: '0'
    01-01 07:27:09.650  6439  6439 F DEBUG   : ABI: 'arm64'
    01-01 07:27:09.650  6439  6439 F DEBUG   : pid: 15514, tid: 15524, name: FinalizerDaemon  >>> com.example.iq3.computervisionapp <<<
    01-01 07:27:09.651  6439  6439 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x958deec7b0be58
    01-01 07:27:09.673  6439  6439 F DEBUG   :     x0   0000007fb1a470c0  x1   0000007fa45401f8  x2   9832b1ade46b9789  x3   0000007fb1a41120
    01-01 07:27:09.674  6439  6439 F DEBUG   :     x4   0000000000000001  x5   000000009d9b8913  x6   0000000000000000  x7   0000000000000000
    01-01 07:27:09.674  6439  6439 F DEBUG   :     x8   0000000000000000  x9   9832b1ade46b9789  x10  0000000000000001  x11  c1958d6f235cbc48
    01-01 07:27:09.674  6439  6439 F DEBUG   :     x12  aaaaaaaaaaaaaaaa  x13  aaaaaaaaaaaaaaab  x14  aaaaaaaaaaaaaa6a  x15  0000000000000000
    01-01 07:27:09.674  6439  6439 F DEBUG   :     x16  0000000000000000  x17  0000000000000001  x18  00000000000002fd  x19  0000007fa4540210
    01-01 07:27:09.674  6439  6439 F DEBUG   :     x20  0000000000000000  x21  0000007fae880180  x22  0000007fa4540000  x23  0000007fb1a41000
    01-01 07:27:09.674  6439  6439 F DEBUG   :     x24  0000007fa4540208  x25  0000000000000001  x26  0000000000000000  x27  0000007fb1a30000
    01-01 07:27:09.675  6439  6439 F DEBUG   :     x28  0000007fae67a8e0  x29  0000007fad601390  x30  0000000000000000
    01-01 07:27:09.675  6439  6439 F DEBUG   :     sp   0000007fad601390  pc   0000007fb19d0eb8  pstate 00000000a0000000
    01-01 07:27:09.690  6439  6439 F DEBUG   : 
    01-01 07:27:09.690  6439  6439 F DEBUG   : backtrace:
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #00 pc 0000000000078eb8  /system/lib64/libc.so (arena_dalloc_bin_locked_impl.isra.30+396)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #01 pc 00000000000982f4  /system/lib64/libc.so (je_tcache_bin_flush_small+436)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #02 pc 0000000000091f18  /system/lib64/libc.so (je_free+904)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #03 pc 000000000001bb14  /system/lib64/libc.so (free+20)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #04 pc 0000000000127da8  /system/lib64/libart.so (art_quick_generic_jni_trampoline+152)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #05 pc 000000000011e418  /system/lib64/libart.so (art_quick_invoke_static_stub+600)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #06 pc 000000000012e0c4  /system/lib64/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+344)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #07 pc 00000000004ce740  /system/lib64/libart.so (artInterpreterToCompiledCodeBridge+212)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #08 pc 00000000002a8e30  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+480)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #09 pc 00000000000dd448  /system/lib64/libart.so (_ZN3art11interpreter15ExecuteGotoImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_+22200)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #10 pc 0000000000286840  /system/lib64/libart.so (_ZN3art11interpreter30EnterInterpreterFromEntryPointEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameE+96)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #11 pc 000000000053b250  /system/lib64/libart.so (artQuickToInterpreterBridge+632)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #12 pc 0000000000127ee4  /system/lib64/libart.so (art_quick_to_interpreter_bridge+100)
    01-01 07:27:09.691  6439  6439 F DEBUG   :     #13 pc 0000000002260ad4  /system/framework/arm64/boot.oat (offset 0x1f0b000)
    01-01 07:27:10.435  1111 15714 W ActivityManager: Process com.example.iq3.computervisionapp has crashed too many times: killing!
    01-01 07:27:10.435  1111 15714 W ActivityManager:   Force finishing activity com.example.iq3.computervisionapp/.MainActivity
    01-01 07:27:10.435  6439  6439 F DEBUG   : 
    01-01 07:27:10.435  6439  6439 F DEBUG   : Tombstone written to: /data/tombstones/tombstone_02
    01-01 07:27:10.436  6439  6439 E DEBUG   : AM write failed: Broken pipe
    01-01 07:27:10.436  1111  1156 I BootReceiver: Copying /data/tombstones/tombstone_02 to DropBox (SYSTEM_TOMBSTONE)
    01-01 07:27:10.437  1111 15714 I ActivityManager: Killing 15514:com.example.iq3.computervisionapp/u0a83 (adj 9): crash
    01-01 07:27:10.441  6439  6439 E         : ptrace detach from 15524 failed: No such process
    01-01 07:27:10.441  6439  6439 E         : debuggerd committing suicide to free the zombie!
    01-01 07:27:10.513 15717 15717 I         : debuggerd: starting

    I am still unable to find the line responsible for this mess. Please help if possible.

saudet commented 6 years ago

Ah, you'll need to increase memory available to your application.

saudet commented 6 years ago

Use the android:largeHeap=true attribute as documented use: https://developer.android.com/guide/topics/manifest/application-element

AdityaPrakash23 commented 6 years ago

Thanks for the suggestion. I tried that and the exceeding physical memory doesn't come now. After running the app for 5-7 times I am getting this similar message in adb logcat

01-01 01:20:18.433  4015  4015 D Status Check :: Got mat2...
01-01 01:20:18.434  4015  4015 D Status Check :: Starting to record video...
01-01 01:20:18.441  4015  4024 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xa9622e5040 in tid 4024 (FinalizerDaemon)
01-01 01:20:18.443  4015  4015 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 4015 (mputervisionapp)
01-01 01:20:18.443  4015  4015 I libc    : Another thread contacted debuggerd first; not contacting debuggerd.
01-01 01:20:18.547   698   698 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-01 01:20:18.547   698   698 F DEBUG   : Build fingerprint: 'Android/msm8996/msm8996:6.0.1/APQ8096_M_V22/robin01051129:userdebug/test-keys'
01-01 01:20:18.547   698   698 F DEBUG   : Revision: '0'
01-01 01:20:18.548   698   698 F DEBUG   : ABI: 'arm64'
01-01 01:20:18.551   698   698 F DEBUG   : pid: 4015, tid: 4024, name: FinalizerDaemon  >>> com.example.iq3.computervisionapp <<<
01-01 01:20:18.554   698   698 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xa9622e5040
01-01 01:20:18.577   698   698 F DEBUG   :     x0   0000000000000000  x1   0000007f6fb81398  x2   000000000000007f  x3   0000000006000000
01-01 01:20:18.578   698   698 F DEBUG   :     x4   0010000000000000  x5   0000000000000005  x6   0000000000000003  x7   0000007f6fb813a8
01-01 01:20:18.578   698   698 F DEBUG   :     x8   0000000000000005  x9   0000000000001380  x10  0000000000000034  x11  000000a9622e5020
01-01 01:20:18.578   698   698 F DEBUG   :     x12  0000000000000080  x13  00000000002aaaab  x14  000000001a000034  x15  0000000000000034
01-01 01:20:18.578   698   698 F DEBUG   :     x16  0000000000000034  x17  0000000000000001  x18  0000000000000006  x19  000000014f283af8
01-01 01:20:18.578   698   698 F DEBUG   :     x20  000000006fb813a8  x21  0000007f7a0c0180  x22  0000007f6fb80000  x23  0000007f7d26f120
01-01 01:20:18.578   698   698 F DEBUG   :     x24  0000007f6fb813a8  x25  0010007f6fb813a8  x26  0000000000000000  x27  0000007f7d25e000
01-01 01:20:18.578   698   698 F DEBUG   :     x28  0000007f7957c8e0  x29  0000007f78e41390  x30  0000000000000000
01-01 01:20:18.579   698   698 F DEBUG   :     sp   0000007f78e41390  pc   0000007f7d1fef40  pstate 0000000080000000
01-01 01:20:18.595   698   698 F DEBUG   : 
01-01 01:20:18.595   698   698 F DEBUG   : backtrace:
01-01 01:20:18.595   698   698 F DEBUG   :     #00 pc 0000000000078f40  /system/lib64/libc.so (arena_dalloc_bin_locked_impl.isra.30+532)
01-01 01:20:18.595   698   698 F DEBUG   :     #01 pc 00000000000982f4  /system/lib64/libc.so (je_tcache_bin_flush_small+436)
01-01 01:20:18.595   698   698 F DEBUG   :     #02 pc 0000000000091f18  /system/lib64/libc.so (je_free+904)
01-01 01:20:18.595   698   698 F DEBUG   :     #03 pc 000000000001bb14  /system/lib64/libc.so (free+20)
01-01 01:20:18.596   698   698 F DEBUG   :     #04 pc 0000000000127da8  /system/lib64/libart.so (art_quick_generic_jni_trampoline+152)
01-01 01:20:18.596   698   698 F DEBUG   :     #05 pc 000000000011e418  /system/lib64/libart.so (art_quick_invoke_static_stub+600)
01-01 01:20:18.596   698   698 F DEBUG   :     #06 pc 000000000012e0c4  /system/lib64/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+344)
01-01 01:20:18.596   698   698 F DEBUG   :     #07 pc 00000000004ce740  /system/lib64/libart.so (artInterpreterToCompiledCodeBridge+212)
01-01 01:20:18.596   698   698 F DEBUG   :     #08 pc 00000000002a8e30  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+480)
01-01 01:20:18.596   698   698 F DEBUG   :     #09 pc 00000000000dd448  /system/lib64/libart.so (_ZN3art11interpreter15ExecuteGotoImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_+22200)
01-01 01:20:18.596   698   698 F DEBUG   :     #10 pc 0000000000286840  /system/lib64/libart.so (_ZN3art11interpreter30EnterInterpreterFromEntryPointEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameE+96)
01-01 01:20:18.596   698   698 F DEBUG   :     #11 pc 000000000053b250  /system/lib64/libart.so (artQuickToInterpreterBridge+632)
01-01 01:20:18.597   698   698 F DEBUG   :     #12 pc 0000000000127ee4  /system/lib64/libart.so (art_quick_to_interpreter_bridge+100)
01-01 01:20:18.597   698   698 F DEBUG   :     #13 pc 0000000002260ad4  /system/framework/arm64/boot.oat (offset 0x1f0b000)
01-01 01:20:18.936  1088  4063 W ActivityManager:   Force finishing activity com.example.iq3.computervisionapp/.MainActivity
01-01 01:20:18.937   698   698 F DEBUG   : 
01-01 01:20:18.937   698   698 F DEBUG   : Tombstone written to: /data/tombstones/tombstone_02
01-01 01:20:18.937   698   698 E DEBUG   : AM write failed: Broken pipe
01-01 01:20:18.937  1088  1164 I BootReceiver: Copying /data/tombstones/tombstone_02 to DropBox (SYSTEM_TOMBSTONE)
01-01 01:20:19.144   723   723 I Zygote  : Process 4015 exited due to signal (11)
01-01 01:20:19.238  1088  4063 I WindowManager: Screenshot max retries 4 of Token{5db8f5e ActivityRecord{7a08099 u0 com.example.iq3.computervisionapp/.MainActivity t8 f}} appWin=Window{6742c36 u0 Starting com.example.iq3.computervisionapp} drawState=4
01-01 01:20:19.239  1088  4063 W ActivityManager: Exception thrown during pause
01-01 01:20:19.239  1088  4063 W ActivityManager: android.os.DeadObjectException
01-01 01:20:19.239  1088  4063 W ActivityManager:       at android.os.BinderProxy.transactNative(Native Method)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at android.os.BinderProxy.transact(Binder.java:503)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:727)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:883)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2935)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2791)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2788)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:12123)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:12019)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12708)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:12215)
01-01 01:20:19.239  1088  4063 W ActivityManager:       at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
01-01 01:20:19.242  1088  1088 W art     : Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12654 waiters=0 for 280ms
01-01 01:20:19.245  1088  1878 I ActivityManager: Process com.example.iq3.computervisionapp (pid 4015) has died
01-01 01:20:19.264  1860  1860 D Launcher: Broadcasting Home Idle Screen Intent ...

The fatal signal message has always come up after the Starting to record video... log message. So I believe the line that is causing this error is videoRecorder.record(outFrame); command. If you have some other argument please share and suggest what to do.

AdityaPrakash23 commented 6 years ago

Should I change my FrameRecorder to FFmpegFrameRecorder since I am using FFmpegFrameGrabber?

saudet commented 6 years ago

That doesn't matter. It's probably memory used by outFrame getting deallocated prematurely: Make sure that doesn't happen.

saudet commented 6 years ago
System.loadLibrary("opencv_java3");

That's not a good idea either. You shouldn't load multiple versions of OpenCV at the same time.

AdityaPrakash23 commented 6 years ago

Any suggestions for controlling deallocation of outFrame?

saudet commented 6 years ago

First try not loading 2 versions of OpenCV.

AdityaPrakash23 commented 6 years ago

I removed the System.loadLibrary("opencv_java3"); . I ran the program again and the fatal signal always comes at Staring to record video or Process Completed!!! statements. And each time I get the Fatal Signal 11 statement along with some other statements like

A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4b0 in tid 10021 (mputervisionapp)
A/art: art/runtime/fault_handler.cc:117] Check failed: !initialized_ 

and

A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xa9622d9c40 in tid 10329 (FinalizerDaemon)
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 10320 (mputervisionapp)
I/libc: Another thread contacted debuggerd first; not contacting debuggerd.

What should I take from this and how to solve this?Also when I run my app, the Android Profiler shows that the Memory Usage almost reaches 1GB just before crashing. Could that be the reason that outFrame gets deallocated and the app crashes?

saudet commented 6 years ago

Did you also remove libopencv_java3.so from your project just to make sure it's not getting loaded?

saudet commented 6 years ago

If memory increases at each iteration, then it sounds like you have a memory leak. Make sure to release any objects you don't need after each iteration.