Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

unfortunately, you can't do it directly, opencv only has solid lines for drawing

if you really need a dotted or stippled line, try something like this:

cv::Mat img = cv::imread("herring.jpeg",1); // bgr image
Point p1(20,20);                            // start & end points 
Point p2(80,50);
LineIterator it(img, p1, p2, 8);            // get a line iterator
for(int i = 0; i < it.count; i++,it++)
    if ( i%5!=0 ) {(*it)[0] = 200;}         // every 5'th pixel gets dropped, blue stipple line