文章目录
cv2.drawMarker()函数说明
参数说明
markerType示例
利用鼠标回调函数交互式画点
例1,简单的例子
例2,删除功能
这里所谓画点的意思是指在单一像素点上画一个标记符,而不是画小圆点。使用的函数是cv2.drawMarker(img, position, color, ...)
关于鼠标回调函数的说明可以参考:opencv-python的鼠标交互操作
cv2.drawMarker()函数说明
参数说明
导入cv2后,通过help(cv2.drawMarker)可以看到函数的帮助文档如下:
drawMarker(...)
drawMarker(img, position, color[, markerType[, markerSize[, thickness[, line_type]]]]) -> img
. @brief Draws a marker on a predefined position in an image.
.
. The function cv::drawMarker draws a marker on a given position in the image. For the moment several
. marker types are supported, see #MarkerTypes for more information.
.
. @param img Image.
. @param position The point where the crosshair is positioned.
. @param color Line color.
. @param markerType The specific type of marker you want to use, see #MarkerTypes
. @param thickness Line thickness.
. @param line_type Type of the line, See #LineTypes
. @param markerSize The length of the marker axis [default = 20 pixels]
其中三个必选参数:img, position, color,其他参数是可选。三个必选参数说明如下:
img:底图,uint8类型的ndarray,
position:坐标,是一个包含两个数字的tuple(必需是tuple),表示(x, y)
color:颜色,是一个包含三个数字的tuple或list,表示(b, g, r)
其他参数说明如下:
markerType:点的类型。取值0-6,有相应的宏定义与之对应,具体的可参考下面的一个表。
markerSize:点的大小。大于0的整数,必需是整数。实际输入<=0的数字也可,