Hello, I try the fitline with this coding as I understand that the Input vector of 2D or 3D points, stored in std::vector<> or Mat. The contours is already in vector 2D form yet I still get the error.
Unhandled exception at 0x00007ff93cada1c8 in momentcontour.exe: Microsoft C++ exception: cv::Exception at memory location 0x00f9d7b0..
Any point that I'm missing?
vector< vector<point> > contours; vector<moments> mu(contours.size() ); for( int i = 0; i < contours.size(); i++ ) { mu[i] = moments( contours[i], false ); TOTALM00 = TOTALM00 + mu[i].m00; } Vec4f line; cv::fitLine(contours,line,CV_DIST_L2,0,0.01,0.01); //HU Moments