prosenjit
prosenjit

Reputation: 865

opencv polygon with dotted or dashed lines

I have a line of code here that uses the python binding for opencv:

cv2.polylines(mask, [pts],True, ignore_mask_color)

This draws a blue polygon on image mask.

But is there a way the lines of the polygon can be stylized? Not too much. Just dotted, or dashed, that's it really.

Upvotes: 1

Views: 5867

Answers (1)

Ébe Isaac
Ébe Isaac

Reputation: 12351

In addition to color you can use the thickness annd lineType arguments in cv2.polylines method. Refer the OpenCV docs for cv2.polylines for more detail.

Unfortunately, the only options you can get for lineType in here would be

  • 8 (or omitted) - 8-connected line.
  • 4 - 4-connected line.
  • CV_AA - antialiased line.

Not sure why OpenCV hasn't got a direct way to implement this yet. However, this post might help you achieve what you require.

Upvotes: 2

Related Questions