Error while using OpenCV absdiff on Android

asked 2016-04-02 06:26:16 -0600

Maciek gravatar image

updated 2016-04-02 10:03:53 -0600

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

edit retag flag offensive close merge delete

Comments

xamarin ? mono ? what the hell are you doing ?

berak gravatar imageberak ( 2016-04-02 11:48:03 -0600 )edit

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

Maciek gravatar imageMaciek ( 2016-04-02 12:12:23 -0600 )edit

Hello, you solved the problem?

juparmer gravatar imagejuparmer ( 2016-07-13 09:16:51 -0600 )edit

@juparmer, please don't post answers, if you don't have any ..

berak gravatar imageberak ( 2016-07-13 09:59:51 -0600 )edit

Sorry, just i want the answer.

juparmer gravatar imagejuparmer ( 2016-07-13 10:18:13 -0600 )edit