![](/img/trans.png)
[英]How to draw a circle whenever a circle is found by my webcam using OpenCV?
[英]How to draw multi-color segmented circle using OpenCV?
使用如下所示的 OpenCV 繪制多色分段圓的最佳方法是什么?
我發現,它可以是:
使用cv.ellipse
你可以很容易地繪制線段:
from matplotlib import pyplot as plt
import cv2
import numpy as np
import random
ANGLE_DELTA = 360 // 8
img = np.zeros((700, 700, 3), np.uint8)
img[::] = 255
for size in range(300, 0, -100):
for angle in range(0, 360, ANGLE_DELTA):
r = random.randint(0, 256)
g = random.randint(0, 256)
b = random.randint(0, 256)
cv2.ellipse(img, (350, 350), (size, size), 0, angle, angle + ANGLE_DELTA, (r, g, b), cv2.FILLED)
plt.gcf().set_size_inches((8, 8))
plt.imshow(img)
plt.show()
給
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.