opencv rectangle with dotted or dashed lines

后端 未结 4 699
不知归路
不知归路 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:22

    Try something like this:

    cv::Point P1, P2;
    
    P1.y = 50;
    P2.y = 50;
    
    int dot_gap = 50;
    int dot_width = 50;
    
    for( int i=0 ; i < in_img.cols; (i = i+d_width) ) {
    
        P1.x = i;
        P2.x = i + dot_width;
        cv::line(in_img, P1, P2, cv::Scalar(0, 255, 255), 2, cv::LINE_8);
    }
    

提交回复
热议问题