gpt4 book ai didi

ios - OpenCV findContours 崩溃

转载 作者:可可西里 更新时间:2023-11-01 05:06:33 25 4
gpt4 key购买 nike

我有这个代码:

mat.copyTo(tmpMat);
cvtColor(tmpMat, tmpMat, CV_BGR2GRAY);
cv::equalizeHist(tmpMat, tmpMat);
cv::Mat browMat = tmpMat(eyebrowRect);
std::vector<std::vector<Point> > contours;
cv::findContours(browMat, contours, cv::RETR_LIST, cv::CHAIN_APPROX_NONE);

但它因以下错误而崩溃:

OpenCV Error: Assertion failed (type == type0 || (CV_MAT_CN(type) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0)) in create, file /Users/robin/Projects/OpenCVForiPhone/opencv/opencv/modules/core/src/matrix.cpp, line 1249 terminate called throwing an exception

我认为我的 Mat 已经处于 1 channel 灰度,因为 cvtColor 调用......

我该如何解决这个问题?

最佳答案

代替:

std::vector<std::vector<Point> > contours;

你试过吗?

std::vector<std::vector<cv::Point> > contours;

关于ios - OpenCV findContours 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10823085/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com