我有以下代码:
'
[...]cvCvtColor(subtraction, grayBuffer, CV_BGR2GRAY);
cvThreshold(grayBuffer, grayBuffer, 127, 255, CV_THRESH_BINARY);
cvFindContours(grayBuffer, mem, contours, Loader.sizeof(CvContour.class) , CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0));
//cvFitLine(Mat(contours[0]),lines,2,0,0.01,0.01);
cvFitLine(contours, CV_DIST_L2, 2, 0.01, 0.01, line);
int lefty = (int)((int)(-line[2]*line[1]/line[0])+line[3]);
int righty = (int) ((int)((grayBuffer.width()-line[2])*line[1]/line[0])+line[3]);
line(grayBuffer.width()-1,0,righty,lefty); [...]´
这给了我一个致命的错误。
有人知道如何使用fitLine吗?
谢谢 :)