我正在使用 opencv 和 Eclipse 进行图像处理。
vector<Vec2f> lines;
HoughLines(dst, lines, 1, CV_PI/180, 100, 0, 0 );
for( size_t i = 0; i < lines.size(); i++ )
{
float rho = lines[i][0], theta = lines[i][1];
Point pt1, pt2;
double a = cos(theta), b = sin(theta);
double x0 = a*rho, y0 = b*rho;
pt1.x = cvRound(x0 + 1000*(-b));
pt1.y = cvRound(y0 + 1000*(a));
pt2.x = cvRound(x0 - 1000*(-b));
pt2.y = cvRound(y0 - 1000*(a));
line( cdst, pt1, pt2, Scalar(0,0,255), 3, CV_AA);
}
谁能解释这段代码是如何定义这些点的。我们正在使用
y=(-cos(theta)/sin(theta))x + r/(sin(theta))
rho=xo*cos(theta) + yo*sin(theta)
我无法理解为什么要在行中进行 1000 的乘法
pt1.x = cvRound(x0 + 1000*(-b));
请尝试用简单的术语来解释这一点。提前致谢