cv2.circle ()
时间: 2023-08-28 20:06:15 浏览: 83
The cv2.circle() function in OpenCV is used to draw a circle on an image. It takes the following parameters:
- img: The image on which the circle will be drawn.
- center: The center of the circle, represented as a tuple (x, y).
- radius: The radius of the circle in pixels.
- color: The color of the circle in BGR format, represented as a tuple (blue, green, red).
- thickness: The thickness of the circle outline in pixels. If it is negative, the circle will be filled with the specified color.
Example usage:
```
import cv2
# Load an image
img = cv2.imread('image.jpg')
# Draw a red circle with center (100, 100) and radius 50
cv2.circle(img, (100, 100), 50, (0, 0, 255), 2)
# Display the image
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
阅读全文