Why can't I pass
Point src[1][4] = {
{
Point(border,border), Point(border,h-border), Point(w-border,h-border), Point(w-border,h-border)
}
};
as
polylines(frame, src, ns, 1, true, CV_RGB(255,255,255), 2);
where
polylines has prototype
void polylines(Mat& img, const Point** pts, const int* npts, int ncontours, bool isClosed, const Scalar& color, int thickness=1, int lineType=8, int shift=0 )
UPDATE
Okay, okay, I remembered this stuff :)
Point[1][4] can't be converted to Point** this way.
Have a look at this question: Converting multidimensional arrays to pointers in c++
The actual solution here is to use STL container instead of C-style array, e.g. std::vector:
typedef std::vector<Point> Shape;
std::vector<Shape> myShapes;
...
and pass it by const reference instead of const pointer:
void polylines(Mat& img, const std::vector<Shape>& shapes, ...)
Also note that src, ns, pts, etc. aren't very lucky names for your variables. Try to choose more meaningful names... if not for your own sake, then do it for the sake of future readers of that code :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With