Writing vector in OpenCV
15,084
Solution 1
vector<Vec4i> line;
line.push_back(Vec4i(1,2,3,4));
line.push_back(Vec4i(5,6,7,8));
Solution 2
see 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;
now you know !
Author by
user2148843
Updated on June 04, 2022Comments
-
user2148843 almost 2 years
How do you write a vector in OpenCV? Using HoughlinesP, the lines are of type
Vector<Vec4i>
and holds values [x1,y1,x2,y2]. How do I make my own vector? I triedvector<Vec4i> line;
line[0] = [1,2,3,4];
and it doesn't work with the error 'expected an identifier. Please advice, thank you.
-
user2148843 about 11 yearswhat if I want to write it into a particular array say line[1]?
-
berak about 11 yearsyou mean:
vector<Vec4i> line(100); /*line has 100 Vec4i now*/ line[1] = Vec4i(6,5,4,3);
? for more on vectors, have a look at cplusplus.com/reference -
HDJEMAI over 8 yearsthe link opencv.willowgarage.com/documentation/cpp/… is not working