python opencv cv2.rectangle() 绘制矩形框(可实心)

def rectangle(img, pt1, pt2, color, thickness=None, lineType=None, shift=None): # real signature unknown; restored from __doc__
    """
    rectangle(img, pt1, pt2, color[, thickness[, lineType[, shift]]]) -> img
    .   @brief Draws a simple, thick, or filled up-right rectangle. 
    	绘制一个简单的、具有厚度的,或者实心的直角矩形
    .   
    .   The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners
    .   are pt1 and pt2.
    	函数cv :: rectangle绘制一个矩形轮廓或一个填充的矩形,其两个相对角为pt1和pt2。
    .   
    .   @param img Image. 图片
    .   @param pt1 Vertex of the rectangle. 矩形的顶点
    .   @param pt2 Vertex of the rectangle opposite to pt1 . 与pt1相反的矩形的顶点
    .   @param color Rectangle color or brightness (grayscale image). 矩形颜色或亮度(灰度图像)
    .   @param thickness Thickness of lines that make up the rectangle. Negative values, like #FILLED,
    .   mean that the function has to draw a filled rectangle.
    		组成矩形的线的粗细。 负值(如#FILLED)表示该函数必须绘制一个填充的矩形。
    .   @param lineType Type of the line. See #LineTypes 线的类型。 请参阅#LineTypes
    .   @param shift Number of fractional bits in the point coordinates. 点坐标中的小数位数。
    
    
    
    rectangle(img, rec, color[, thickness[, lineType[, shift]]]) -> img
    .   @overload
    .   
    .   use `rec` parameter as alternative specification of the drawn rectangle: `r.tl() and
    .   r.br()-Point(1,1)` are opposite corners
    	使用`rec`参数作为绘制矩形的替代规范:`r.tl()和= r.br()-Point(1,1)`位于对角
    """
    pass

示例:

# D·C 191119:绘制识别目标的矩形框
cv2.rectangle(image, c1, c2, bbox_color, bbox_thick)
# D·C 191119:绘制装载文字的矩形实心框
cv2.rectangle(image, c1, (c1[0] + t_size[0], c1[1] - t_size[1] - 3), bbox_color, thickness=-1)  # filled

你可能感兴趣的:(Opencv)