OpenCV error: Assertions failed on iOS

asked 2017-08-06 12:06:57 -0600

fi12 gravatar image

I'm trying to find the largest blob in an image and classify it according to a linked plist file. I'm using the latest version of OpenCV for iOS, and I've looked at several related questions, but none so far relate to iOS.

I'm getting this error:

OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in batchDistance, file /Volumes/build-storage/build/master_iOS-mac/opencv/modules/core/src/stat.cpp, line 3934

libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Volumes/build-storage/build/master_iOS-mac/opencv/modules/core/src/stat.cpp:3934: error: (-215) type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U) in function batchDistance

when I run this:

- (IBAction)CaptureButton:(id)sender
  {
       // Find the biggest blob.
       int biggestBlobIndex = 0;
       for (int i = 0, biggestBlobArea = 0; i < detectedBlobs.size(); i++)
       {
          Blob &detectedBlob = detectedBlobs[i];
          int blobArea = detectedBlob.getWidth() * detectedBlob.getHeight();
          if (blobArea > biggestBlobArea)
          {
              biggestBlobIndex = i;
              biggestBlobArea = blobArea;
          }
       }

       Blob &biggestBlob = detectedBlobs[biggestBlobIndex];

       // Classify the blob.
       blobClassifier->classify(biggestBlob);
  }

What's the issue here?

edit retag flag offensive close merge delete