Ask Your Question

Revision history [back]

OPENCV POLYLINE

how to draw polyline? actually poly function contain (&Mat,Pts,npts etc...)

how to set pts and npts values? i tried but error:cv mat to cv arr and then i don't know about the these arguments finally i got pixel position in image but how to connect and draw polyline? here i have attached example code but i can't understand and idon,t know about how to set arguments in list

example code:: void polylines(cv::Mat& img, const std::list<std::listcv::point2i>& polylines) { for (auto& polyline : polylines) { auto current = polyline.begin(); auto next = std::next(current, 1); for (; next != polyline.end(); current++, next++) { cv::line(img, *current, *next, cv::Scalar(255)); } } }

click to hide/show revision 2
No.2 Revision

updated 2017-01-27 05:33:14 -0600

berak gravatar image

OPENCV POLYLINE

how to draw polyline? actually poly function contain (&Mat,Pts,npts etc...)

how to set pts and npts values? i tried but error:cv mat to cv arr and then i don't know about the these arguments finally i got pixel position in image but how to connect and draw polyline? here i have attached example code but i can't understand and idon,t know about how to set arguments in list

example code:: code::

void polylines(cv::Mat& img, const std::list<std::listcv::point2i>& std::list<std::listcv::Point2i>& polylines)
{
 for (auto& polyline : polylines)
 {
 auto current = polyline.begin();
 auto next = std::next(current, 1);
 for (; next != polyline.end(); current++, next++)
 {
 cv::line(img, *current, *next, cv::Scalar(255));
        }
    }
}
}