Opencv circle函数 画圆两种方式的不同效果

 cv2.LINE_AA 反走样线可以有效消除锯齿现象

import cv2
import matplotlib.pyplot as plt
import numpy as np
from queue import PriorityQueue


def main():
    img = np.zeros((400, 400), np.uint8)
    img2 = np.zeros((400, 400), np.uint8)
    img3 = np.zeros((400, 400), np.uint8)
    cv2.circle(img, (150, 150), 100, 255, -1)
    cv2.circle(img2, (150, 150), 50, 255, 100)
    cv2.circle(img3, (150, 150), 50, 255, 100, cv2.LINE_AA)
    cv2.imshow("circle", img)
    cv2.imshow("circle2", img2)
    cv2.imshow("circle3", img3)
    cv2.waitKey(0)


if __name__ == "__main__":
    main()

函数解释:

C++ :

void cv::circle     (     InputOutputArray      img,
        Point      center,
        int      radius,
        const Scalar &      color,
        int      thickness = 1,
        int      lineType = LINE_8,
        int      shift = 0
    )         
Python:
    img    =    cv.circle(    img, center, radius, color[, thickness[, lineType[, shift]]]    )

Draws a circle.

The function cv::circle draws a simple or filled circle with a given center and radius.

Parameters

imgImage where the circle is drawn.
centerCenter of the circle.
radiusRadius of the circle.
colorCircle color.
thicknessThickness of the circle outline, if positive. Negative values, like FILLED, mean that a filled circle is to be drawn.
lineTypeType of the circle boundary. See LineTypes
shiftNumber of fractional bits in the coordinates of the center and in the radius value.

效果图:

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值