1、直线检测
HoughLines函数:保存到输出的是直线的极坐标公式参数
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 );
HoughLinesP:保存到输出的是直线的端点
HoughLinesP(
InputArray image,
OutputArray lines,
double rho, double theta,
int threshold,
double minLineLength = 0,
double maxLineGap = 0
);
#include #include#include#include
using namespacecv;using namespacestd;int main(int argc, char*argv[])
{
Mat dst, cdst, cdstP;const char* filename = "sudoku.png";
Mat src=imread(filename, IMREAD_GRAYSCALE);
Canny(src,dst,50,200,3);
cvtColor(dst,cdst,COLOR_GRAY2BGR);
cdstP=cdst.clone();
v