opencv_python 如何让中间点一直在左边?

不同box
如何保证这点黄色点 一直在左边中间线
如图所示:

import cv2
import numpy as np

image = np.zeros([2500,2500,3],np.uint8)

box = ([[1273,890],
[1277,814],
[1381,819],
[1378,895],])

# box = ([[1293,820],
# [1400,806],
# [1410,884],
# [1303,898]])


# box = ([[880,979],
#  [888,963],
#  [901,970],
#  [892,986]])


# box = ([[886,977],
#  [904,977],
#  [904,998],
#  [886,998]])

# box = ([[1288,962],
#  [1380,958],
#  [1382,991],
#  [1290,995]])

# box = ([[879,954],
#  [892,954],
#  [892,972],
#  [879,972]])


cv2.line(image,box[0],box[1],(0,0,255),2)

cv2.line(image,box[1],box[2],(0,255,0),2)

cv2.line(image,box[0],box[3],(255,0,0),2)

cv2.line(image,box[2],box[3],(100,100,100),2)

xx = int((box[0][0]+box[1][0])/2)
yy = int((box[0][1]+box[1][1])/2)
cv2.circle(image,  (int(xx), int(yy)),4 ,(0, 255, 255), 4)
回复
阅读 293
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏