我想在图像中某些物体的质心周围绘制一个红色圆圈(图像中的物体是一些昆虫,因此圆圈有助于人类在视觉上检测昆虫);我已经有了质心(吼叫),但不知道如何在python / opencv中做到这一点;
array([[ 265., 751.],
[ 383., 681.],
[ 386., 889.],
[ 434., 490.],
[ 446., 444.],
[ 450., 451.],
[ 539., 1365.],
[ 571., 1365.],
[ 630., 645.],
[ 721., 1365.],
[ 767., 70.],
[ 767., 82.],
[ 767., 636.]])
有谁知道怎么做我想要的?
答案 0 :(得分:2)
答案 1 :(得分:0)
绘制圆圈:
cv2.circle(img, center, radius, color, thickness1, lineType, shift)
**Parameters:**
img (CvArr) – Image where the circle is drawn
center (CvPoint) – Center of the circle
radius (int) – Radius of the circle
color (CvScalar) – Circle color
thickness (int) – Thickness of the circle outline if positive, otherwise this indicates that a filled circle is to be drawn
lineType (int) – Type of the circle boundary, see Line description
shift (int) – Number of fractional bits in the center coordinates and radius value
例如:
cv2.circle(loaded_cv2_img, (100, 100), 20, (255, 0, 0), 5)