我正在使用 C++ 学习 opencv。我在 hough line transform 的代码中遇到了 Vector 。谁能解释一下 Vec4i 存储什么以及 4i 是什么意思。 代码片段:-
vector<Vec4i> lines;
HoughLinesP(dst, lines, 1, CV_PI/180, 50, 50, 10 );
for( size_t i = 0; i < lines.size(); i++ )
{
Vec4i l = lines[i];
line( cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0,0,255), 3, CV_AA);
}
最佳答案
看看 OpenCV Basic Structures .
Vec4i 是一种用于表示具有 4 个维度的 vector 的结构,每个值都是一个 int
如果您查看 HoughLinesP() documentation在这种特殊情况下,您会看到每个维度是什么:
lines – Output vector of lines. Each line is represented by a 4-element vector (x_1, y_1, x_2, y_2) , where (x_1,y_1) and (x_2, y_2) are the ending points of each detected line segment.
简而言之,每一行都是一个Vec4i,前两个元素是该行的起点(x1,y1),后两个是该行的终点(x2,y2)
关于c++ - opencv中的Vec4i是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44422591/