OpenCV related, get item from vector of cv:Point

Write your question here.

[code]
string path = "man.png";
Mat img = imread(path);
Mat matrix, imgWarp2;


std::vector<std::vector<cv::Point> > contours3 {{{1,2},{3,4},{5,6}}};

I need to get item from vector of CV::Point, but i can only output a pair.
Please advise
up
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Example program
#include <iostream>
#include <vector>

namespace cv {
    
struct Point {
    int x;
    int y;
};
   
}

int main()
{
    std::vector<std::vector<cv::Point> > contours3 {{{1,2},{3,4},{5,6}}};
    
    contours3[0]; // std::vector<cv:::Point>
    contours3[0][0]; // cv::Point
    int x = contours3[0][0].x; // int (cv::Point::value_type)
    
    std::cout << x << '\n';
}
Last edited on
solved, thank you
Last edited on
Topic archived. No new replies allowed.