Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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:

codeBeneath

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

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:

codeBeneath

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, const*, int)+103 [0x7e7ed304]
at cv::_OutputArray::create(int, int const, 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)

(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