findContours
导致以下错误:
2017-09-22 16:50:05.396700 + 0200 OpenCVLiveCamera [7827:3041522] [MC] systemgroup.com.apple.configurationprofiles路径的系统组容器是/ private / var / containers / Shared / SystemGroup / systemgroup。 com.apple.configurationprofiles
2017-09-22 16:50:05.397011 + 0200 OpenCVLiveCamera [7827:3041522] [MC]从公共有效用户设置中读取。
OpenCV错误:断言失败(mtype == type0 ||(CV_MAT_CN(mtype)== CV_MAT_CN(type0)&&((1<<<<<<<<<<<<< )& fixedDepthMask)!= 0))在create,file / Volumes / build-storage / build / master_iOS-mac / opencv / modules / core / src / matrix.cpp,第2601行 libc ++ abi.dylib:以cv类型的未捕获异常终止::异常:/ Volumes/build-storage/build/master_iOS-mac/opencv/modules/core/src/matrix.cpp:2601:错误:( - 215 )mtype == type0 || (CV_MAT_CN(mtype)== CV_MAT_CN(type0)&&((1<<<<< type0)& fixedDepthMask)!= 0)in function create
代码:
void getContours(cv::Mat &srcImage){
cv::Mat dstImage = srcImage;
// Convert it 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
//....
}
请帮忙。 谢谢
答案 0 :(得分:1)
通过将Point更改为cv:Point in
来解决 std::vector<std::vector<cv:Point> > contours;
答案 1 :(得分:0)
findContours
更改输入图像,使其无法显示。尝试
threshImg = srcImg.clone()
findContours(threshImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);