jNc
May 1, 2022, 9:55am
1
Hello there!
Can you please advise how to initialize How to initialize std::vector<std::vector<cv::Point> >
with data.
I have some contours in following view
[37, 3]
I just need to save it like std::vector<std::vector<cv::Point> > = {37,3};
Please advise
berak
May 1, 2022, 12:00pm
2
sorry, but like it is now, it’s unclear, what you have or what you need,
can you try again, please ?
what’s that ? looks like a single point to me
how did you acquire that ?
jNc
May 1, 2022, 12:17pm
3
string path2 = "woman.png";
Mat img2 = imread(path2);
Mat matrix2, imgWarp2;
float w2 = 100, h2 = 60;
Point2f src2[4] = { {1168.5, 147.5}, {1177.5, 147.5}, {1168.5, 160.5 }, {1177.5, 160.5} };
Point2f dst2[4] = { {0.0f,0.0f},{w,0.0f},{0.0f,h},{w2,h2} };
matrix2 = getPerspectiveTransform(src2, dst2);
warpPerspective(img2, imgWarp2, matrix2, Point(w2, h2));
jNc
May 1, 2022, 12:20pm
4
Basically I need to assign data below to vector of vectors, to use it
34 3
11 4
11 4
12 4
12 4
12 4
12 4
12 4
12 4
12 4
12 4
12 4
12 4
12 4
12 4
12 4
12 4
12 4
25 4
25 4
25 4
25 5
berak
May 1, 2022, 1:32pm
5
you can use initializer lists, like you used in your Points[4]
code above:
std::vector<std::vector<cv::Point> > contours3 {{{1,2},{3,4},{5,6}}};
jNc
May 2, 2022, 11:55am
6
tempContours = { {1165, 158}, {1168, 158}, {1165, 160 }, {1168, 160} } is there a way to assign it like this?
jNc
May 2, 2022, 1:54pm
7
berak:
::vector
second question: how can i compare items from vector below?
std::vector<std::vectorcv::Point > contours3 {{{1,2},{3,4},{5,6}}};
I need to compa1 to 3 or 4 to 6..
Big Thanks in Advance
berak
May 2, 2022, 2:18pm
8
jNc:
tempContours = { {1165, 158}, {1168, 158}, {1165, 160 }, {1168, 160} } is there a way to assign it like this?
no, that is only a single contour
jNc
May 2, 2022, 3:27pm
9
I can only output pair [1165, 158]… I need to get one item from lets say 1165.
How can i do it?
jNc
May 2, 2022, 7:56pm
11
up
I can only output pair [1165, 158]… I need to get one item from vector of cv:Points
How can i do it?