how can i do the following conversion

vector<vector> in c++ to numpy array in python

Thanks in advance for helping

how can i do the following conversion

vector<vector> in c++ to numpy array in python

Thanks in advance for helping

How is this an OpenCV problem? General C++/Python questions should be directed to an appropriate forum.

because I need to operate with cv::Point2D and the chances of ppl struggling with the same problem could be higher here. Let me know if u want me to delete the post!

that conversion is done automatically by the OpenCV Python bindings.

which specific OpenCV function are you having trouble with?

actually my problem is a bit different.

I am trying to compute the largest rectangle inside a polygon. The polygon is represented by a contour. I want to use the LIR python package to solve this (as a c++ implementation doing the same has bugs while I have validated the python package works). This is the package

I need to pass a numpy nd array of points represnting contoursâ€¦ For example like this [[[1,1], [2,3], [4,5], [6,7]]]

Im am rying to call it through PyArrayObject, PyArrayObject and PyObject_CallFunctionObjArgs mechanishmes where I have coded the generation of numpay array from the contour data structure by defining it as std::vector<std::vector<std::vector > >

The PyArrayObject seems to work but when I pass it to the lir function using PyObject_CallFunctionObjArgs it returns a null object (but no seg faults).

So wanted to ask here if there is a direct option within opencv to generate the PyArrayObject for contour default data structures

std::vector<std::vector<cv::Point > >