Ask Your Question

Maciek's profile - activity

2016-04-09 04:42:26 -0600 received badge  Supporter (source)
2016-04-02 12:12:23 -0600 commented question Error while using OpenCV absdiff on Android

I'm doing an Android app with use of Visual studio and Xamarin and I'm using Opencv Android SDK

2016-04-02 10:03:53 -0600 received badge  Editor (source)
2016-04-02 07:13:52 -0600 asked a question Error while using OpenCV absdiff on Android

I'm trying to use absdiff function in order to implement basic motion detection on android. My code looks following:

public Mat OnCameraFrame(CameraBridgeViewBase.ICvCameraViewFrame inputFrame)
 {

        Mat frame = inputFrame.Gray();
        if (firstFrame == null)
        {
            firstFrame = frame;
        }
        else
        {
            Mat temp = new Mat();                
            Core.Absdiff(firstFrame, frame, temp);
            Imgproc.Threshold(temp, temp, 25, 255, Imgproc.ThreshBinary);
            return temp;
        }
        return frame;
    }

But in line where Absdiff function is executed I get an error like:

at cv::Mat::create(int, int const*, int)+103 [0x7e7ed304]
   at cv::_OutputArray::create(int, int const*, int, int, bool, int) const+1064 [0x7e801af1]
   =================================================================
   Got a SIGSEGV while executing native code. This usually indicates
   a fatal error in the mono runtime or one of the native libraries 
   used by your application.
   =================================================================
   Fatal signal 11 (SIGSEGV) at 0x77a482e1 (code=2), thread 8967 (Thread-2162)

I'd be grateful for any kind of help, because I'm totally out of ideas. Sorry for the bad formatting, but I don't get it. Greets, Maciek