opencv rectangle with dotted or dashed lines

后端 未结 4 697
不知归路
不知归路 2020-12-19 00:58

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

cv2.rectangle(img, (box[1], box[0]), (box[3], box[2]), (255,0,0), 4)

Th

4条回答
  •  星月不相逢
    2020-12-19 01:34

    • openCV is opensource library so you can find source code for drawing and modify it slightly
    • you can use LineIterator and get any style you want in a few lines of code

      void lineDot(OutputArray img, const Point& pt1, const Point& pt2, const Scalar& color, const vector& pattern){
          LineIterator it(img.getMat(), pt1, pt2, LINE_8); // LINE_AA is not supported here
          for(auto i=0; i

提交回复
热议问题