Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OutputArrayOfArrays is a wrapper class, I suggest you to take a look in the OpenCV Styling Guide and also check the source code of functions that use this wrapper because at first may can be tricky but at the end is really good. Take into account that wrapper have complexity O(1), so they are nice to be used, but not mandatory.

Also, some users are experiencing problem using them, like here.

If you are writing code for yourself and not something that will be pushed in the official OpenCV repository, I think that you can avoid the use of wrapper classes. I personally only use InputArray and OutputArray, when I've array I use simply the std::vector. That's because, if you want to write template function it will be more intuitive.

In your case, I personally do the following:

template<typename T>
void function( std::vector<std::vector<cv::Point_<T>>>& _contours)

So in that case, you can use the kind of point that you want, floating, int or double points coordinates, without care about the re-implementation.

OutputArrayOfArrays is a wrapper class, I suggest you to take a look in the OpenCV Styling Guide and also check the source code of functions that use this wrapper because at first may can be tricky but at the end is really good. Take into account that wrapper have complexity O(1), so they are nice to be used, but not mandatory.

Also, some users are experiencing problem using them, like here.

If you are writing code for yourself and not something that will be pushed in the official OpenCV repository, I think that you can avoid the use of wrapper classes. I personally only use InputArray and OutputArray, while when I've array I use simply the std::vector. That's because, if you want to write template function it will be more intuitive.

In your case, I personally do the following:

template<typename T>
void function( std::vector<std::vector<cv::Point_<T>>>& _contours)

So in that case, you can use the kind of point that you want, floating, int or double points coordinates, without care about the re-implementation.