I am going to compare two Mat variable. But "Unhandled exception..." keep came out. I have no idea why this happened.
LineIterator it(thresholed, Point(0, 80), Point(800, 80), 8);
vector<Vec3b> buf;
Mat aa = cv::Mat::zeros(640, 1, CV_8UC3);
Mat buf4;
for (int i = 0; i < it.count; i++)
{
buf4.push_back(Vec3b(*it));
it++;
}
cerr << aa.rows << endl; // 640
cerr << aa.cols << endl; //1
cerr << buf4.rows << endl; //640
cerr << buf4.cols << endl; //1
cv::Mat diff;
cv::compare(aa, buf4, diff, cv::CMP_EQ);
int nz = cv::countNonZero(diff);
> cerr << buf4.rows << endl; //640
I've got 801
> int nz = cv::countNonZero(diff);
that function expects a single channel matrix