left, top, right, bottom,矩形求点坐标,cv2.circle画圆?

left, top, right, bottom,
530, 836, 685, 885

矩形 求坐标

cv2.circle画圆

分别画出以下的点

左上 上中 右上
左中 中心 右中
左下 下中 右下

阅读 1.8k
1 个回答

image.png

import cv2
import numpy as np

img = np.ones((1000, 1000), np.uint8) * 255

left, top, right, bottom = 530, 836, 685, 885

cv2.rectangle(img, (left, top), (right, bottom), 0)

for y in range(top * 2, bottom * 2 + 1, bottom - top):
    for x in range(left * 2, right * 2 + 1, right - left):
        cv2.circle(img, (x, y), 8, 0, cv2.FILLED, cv2.LINE_AA, 1)

cv2.imshow('img', img)
cv2.waitKey()
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题