目录
标记函数void cv::drawMarker
void cv::drawMarker ( InputOutputArray img, //输入输出图片
Point position, //标记的点
const Scalar & color, //颜色
int markerType = MARKER_CROSS,
int markerSize = 20,
int thickness = 1,
int line_type = 8
)
关于标记类型,有如下几种:
画圆(实心、空心)、画点void cv::circle
The function cv::circle draws a simple or filled circle with a given center and radius.
cv::circle绘制具有给定圆心和半径的简单圆或填充圆。
void cv::circle ( InputOutputArray img, //输入输出图片
Point center, //圆心,或点的位置
int radius, //半径
const Scalar & color, //颜色
int thickness = 1, //圆轮廓的厚度(正值),为负值则填充圆
int lineType = LINE_8,
int shift = 0
)
画线void cv::line
//参数与circle大致相同
void cv::line ( InputOutputArray img,
Point pt1,
Point pt2,
const Scalar & color,
int thickness = 1,
int lineType = LINE_8,
int shift = 0
)
画自定义旋转矩形、多边形等(用画直线实现)
auto vertices = armor.SurfaceVertices(); //旋转矩形的四个点的向量
auto num_vertices = vertices.size(); //四个点
for (std::size_t i = 0; i < num_vertices; ++i) { //遍历连线
cv::line(output, vertices[i], vertices[(i + 1) % num_vertices], kGREEN);
}
轮廓函数void cv::drawContours
void cv::drawContours ( InputOutputArray image, //输入输出图像
InputArrayOfArrays contours, //输入轮廓数组
int contourIdx, //画的轮廓的索引。为负则绘制全部
const Scalar & color, //颜色
int thickness = 1, //线的厚度,为负则填充
int lineType = LINE_8,
InputArray hierarchy = noArray(),
int maxLevel = INT_MAX,
Point offset = Point()
)
//例程
cv::drawContours(output, contours_, -1, kRED);
输出文字void cv::putText
void cv::putText ( InputOutputArray img, //输入输出图片
const String & text, //字符串
Point org, //左上角点的位置
int fontFace, //字体
double fontScale, //字体大小
Scalar color, //颜色
int thickness = 1,
int lineType = LINE_8,
bool bottomLeftOrigin = false
)
//例程:
cv::putText(output, label, cv::Point(0, v_pos), kCV_FONT, 1.0, kGREEN);
更多很多函数待补充
画矩形、椭圆等