39 #include <opencv2/imgproc.hpp>
50 template <
class Po
intType>
52 const std::vector<PointType> &points,
53 const cv::Scalar & color,
54 const std::string & label =
"")
56 if (points.size() < 2) {
59 PointType minimum = PointType(image.cols, image.rows);
60 PointType maximum = PointType(0, 0);
61 for (
int i = 0; i < (int)points.size(); ++i) {
62 PointType current = points.at(i);
63 if (current.x < minimum.x)
64 minimum.x = current.x;
65 if (current.x > maximum.x)
66 maximum.x = current.x;
67 if (current.y < minimum.y)
68 minimum.y = current.y;
69 if (current.y > maximum.y)
70 maximum.y = current.y;
73 cv::Point((
int)minimum.x, (
int)minimum.y),
74 cv::Point((
int)maximum.x, (
int)minimum.y),
77 cv::Point((
int)maximum.x, (
int)minimum.y),
78 cv::Point((
int)maximum.x, (
int)maximum.y),
81 cv::Point((
int)maximum.x, (
int)maximum.y),
82 cv::Point((
int)minimum.x, (
int)maximum.y),
85 cv::Point((
int)minimum.x, (
int)maximum.y),
86 cv::Point((
int)minimum.x, (
int)minimum.y),
90 image, label, cv::Point((
int)minimum.x + 1, (
int)minimum.y + 2), 0, 0.5, CV_RGB(255, 255, 0));
100 template <
class Po
intType>
102 const std::vector<PointType> &points,
103 const cv::Scalar & color,
106 for (
unsigned i = 1; i < points.size(); ++i)
108 cv::Point((
int)points[i - 1].x, (
int)points[i - 1].y),
109 cv::Point((
int)points[i].x, (
int)points[i].y),
113 cv::Point((
int)points[points.size() - 1].x, (
int)points[points.size() - 1].y),
114 cv::Point((
int)points[0].x, (
int)points[0].y),
126 const cv::Scalar &color = CV_RGB(0, 255, 0));
134 const std::vector<cv::Point> &contour,
135 const cv::Scalar & color = CV_RGB(255, 0, 0));
144 const std::vector<cv::Point> &contour,
146 const cv::Scalar & color = CV_RGB(255, 0, 0));
153 const std::vector<cv::Point> &contour,
154 const cv::Scalar & color = CV_RGB(255, 0, 0));
161 template <
class Po
intType>
163 const std::vector<PointType> &points,
164 const cv::Scalar & color,
167 for (
unsigned i = 0; i < points.size(); ++i)
168 cv::circle(image, cv::Point((
int)points[i].x, (
int)points[i].y), radius, color);
179 const cv::RotatedRect &ellipse,
180 const cv::Scalar & color,
193 cv::Mat & hide_texture,
195 double gl_modelview[16],
210 double gl_modelview[16],
This file defines library export definitions, version numbers and build information.
This file implements a camera used for projecting points and computing homographies.
This file implements a parametrized line.
This file implements generic utility functions and a serialization interface.
Simple Camera class for calculating distortions, orientation or projections with pre-calibrated camer...
void ALVAR_EXPORT BuildHideTexture(cv::Mat &image, cv::Mat &hide_texture, Camera *cam, double gl_modelview[16], PointDouble topleft, PointDouble botright)
This function is used to construct a texture image which is needed to hide a marker from the original...
void ALVAR_EXPORT DrawLine(cv::Mat &image, const Line line, const cv::Scalar &color=CV_RGB(0, 255, 0))
Draws a line.
void ALVAR_EXPORT DrawCVEllipse(cv::Mat &image, const cv::RotatedRect &ellipse, const cv::Scalar &color, bool fill=false, double par=0)
Draws OpenCV ellipse.
void DrawBB(cv::Mat &image, const std::vector< PointType > &points, const cv::Scalar &color, const std::string &label="")
Draws the bounding box of a connected component (Blob).
ALVAR_EXPORT Point< cv::Point2d > PointDouble
The default double point type.
void ALVAR_EXPORT DrawCircles(cv::Mat &image, const std::vector< cv::Point > &contour, int radius, const cv::Scalar &color=CV_RGB(255, 0, 0))
Draws circles to the contour points that are obtained by Labeling class.
void ALVAR_EXPORT DrawTexture(cv::Mat &image, cv::Mat &texture, Camera *cam, double gl_modelview[16], PointDouble topleft, PointDouble botright)
Draws the texture generated by BuildHideTexture to given video frame. For better performance,...
void ALVAR_EXPORT DrawPoints(cv::Mat &image, const std::vector< cv::Point > &contour, const cv::Scalar &color=CV_RGB(255, 0, 0))
Draws points of the contour that is obtained by Labeling class.
void DrawLines(cv::Mat &image, const std::vector< PointType > &points, const cv::Scalar &color, bool loop=true)
Draws lines between consecutive points stored in vector (polyline).
Struct representing a line. The line is parametrized by its center and direction vector.