| 1716 | } |
| 1717 | |
| 1718 | void arrowedLine(Mat& img, Point pt1, Point pt2, const Scalar& color, |
| 1719 | int thickness, int line_type, int shift, double tipLength) |
| 1720 | { |
| 1721 | const double tipSize = norm(pt1-pt2)*tipLength;// Factor to normalize the size of the tip depending on the length of the arrow |
| 1722 | |
| 1723 | line(img, pt1, pt2, color, thickness, line_type, shift); |
| 1724 | |
| 1725 | const double angle = atan2( (double) pt1.y - pt2.y, (double) pt1.x - pt2.x ); |
| 1726 | |
| 1727 | Point p(cvRound(pt2.x + tipSize * cos(angle + CV_PI / 4)), |
| 1728 | cvRound(pt2.y + tipSize * sin(angle + CV_PI / 4))); |
| 1729 | line(img, p, pt2, color, thickness, line_type, shift); |
| 1730 | |
| 1731 | p.x = cvRound(pt2.x + tipSize * cos(angle - CV_PI / 4)); |
| 1732 | p.y = cvRound(pt2.y + tipSize * sin(angle - CV_PI / 4)); |
| 1733 | line(img, p, pt2, color, thickness, line_type, shift); |
| 1734 | |
| 1735 | } |
| 1736 | |
| 1737 | void rectangle( Mat& img, Point pt1, Point pt2, |
| 1738 | const Scalar& color, int thickness, |