iOS - Xcode - OpenCV - findContours error

findContours from OpenCV
causes the following error:


2017-09-22 16:50:05.396700+0200 OpenCVLiveCamera[7827:3041522] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles

2017-09-22 16:50:05.397011+0200 OpenCVLiveCamera[7827:3041522] [MC] Reading from public effective user settings.

OpenCV Error: Assertion failed (mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0)) in create, file /Volumes/build-storage/build/master_iOS-mac/opencv/modules/core/src/matrix.cpp, line 2601 libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Volumes/build-storage/build/master_iOS-mac/opencv/modules/core/src/matrix.cpp:2601: error: (-215) mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0) in function create


code:

void getContours(cv::Mat &srcImage)
{
    cv::Mat dstImage = srcImage;
    // Convert to gray
    cvtColor( srcImage, srcImage, CV_BGR2GRAY );
    // Threshold
    threshold(srcImage, srcImage, 192.0, 255.0, cv::THRESH_BINARY_INV);
    // Find Contours to find chains of consecutive edge pixels
    std::vector<std::vector<Point> > contours;
    findContours(srcImage, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
    // Draw contours on image
    // ....
}


Please help. Thank you.




Solved!

by changing Point to cv:Point in

std::vector<std::vector<cv:Point> > contours;
iOS - Xcode - OpenCV - findContours error
 
 
Q