void HoughLines( InputArray image, OutputArray lines,
double rho, double theta, int threshold,
double srn = 0, double stn = 0,
double min_theta = 0, double max_theta = CV_PI );
/*
lines: lines[i][0]为第i条直线的rho,lines[i][1]表示第i条直线的theta
rho:像素精度,一般设置为1;
theta:角度精度,一般设置为CV_PI/180;
threshold:表示累计的像素达到多少才能形成直线;
*/
void HoughLinesP( InputArray image, OutputArray lines,
double rho, double theta, int threshold,
double minLineLength = 0, double maxLineGap = 0 );
/*
lines:lines[i]为Vec4i类型,若令L=lines[i],则Point(L[0],L[1])为第一个点坐标,Point(L[2],L[3])为第二个点坐标
rho、theta及threshold解释同上
minLineLength:最小的线段长度,感觉与threshold意思差不多
maxLineGap:两条线的间隔如果小于这个值为一条线
*/
具体实例如下: