如何在OpenCV中编写矢量?使用HoughlinesP,行类型为Vector<Vec4i>
,保存值为[x1,y1,x2,y2]。我怎么得到自己的向量?我试着
vector<Vec4i> line;
line[0] = [1,2,3,4];
,它不起作用,错误'期望一个标识符。请指教,谢谢。
vector<Vec4i> line;
line.push_back(Vec4i(1,2,3,4));
line.push_back(Vec4i(5,6,7,8));
参见dis: http://opencv.willowgarage.com/documentation/cpp/basic_structures.html#vec。
typedef Vec<uchar, 2> Vec2b;
typedef Vec<uchar, 3> Vec3b;
typedef Vec<uchar, 4> Vec4b;
typedef Vec<short, 2> Vec2s;
typedef Vec<short, 3> Vec3s;
typedef Vec<short, 4> Vec4s;
typedef Vec<int, 2> Vec2i;
typedef Vec<int, 3> Vec3i;
typedef Vec<int, 4> Vec4i;
typedef Vec<float, 2> Vec2f;
typedef Vec<float, 3> Vec3f;
typedef Vec<float, 4> Vec4f;
typedef Vec<float, 6> Vec6f;
typedef Vec<double, 2> Vec2d;
typedef Vec<double, 3> Vec3d;
typedef Vec<double, 4> Vec4d;
typedef Vec<double, 6> Vec6d;
现在你知道了!