I've got this code:
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);
but it crashes with this error:
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
I think my Mat is already in 1-channel gray-scale because of cvtColor call...
How can I fix this?
Instead of:
std::vector<std::vector<Point> > contours;
have you tried?
std::vector<std::vector<cv::Point> > contours;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With