如何实现图像的坐标关键点问题?

import cv2
import numpy as np

img = np.zeros([1000, 1000, 3], np.uint8)



A={(286,191),(476,203)}    
B={(217,348),(527,667),(186,653),(513,349)}

# A={(328,275),(406,282)}    
# B={(260,555),(513,349),(217,348),(475,565)}


# A={(71,203),(68,117)}        
# B={(164,82),(164,268),(316,109),(313,251)}

# A={(206,602),(139,532)}    
# B={(284,403),(357,463),(295,609),(168,457)}

# A={(729,707),(718,592)}    
# B={(644,581),(641,721),(528,596),(527,696)}

# A={(568,258),(637,296)}    
# B={(470,403),(481,279),(526,461),(626,419)}

# A={(442,591),(340,584)}    
# B={(288,534),(489,544),(432,417),(357,417)}

# A={(340,338),(438,338)}    
# B={(320,399),(451,393),(348,495),(449,490)}

# A={(336,487),(395,419)}    
# B={(382,565),(524,544),(463,449),(479,611)}

# A={(148,578),(92,618)}    
# B={(27,503),(88,454),(148,515),(38,595)}

# A={(250,129),(528,112)}    
# B={(162,207),(605,196),(534,530),(268,535)}

# A={(161,581),(159,206)}    
# B={(269,736),(550,542),(558,262),(301,116)}

# A={(624,314),(631,484)}    
# B={(558,262),(550,542),(291,240),(291,528)}

# A={(509,642),(620,537)}    
# B={(425,605),(506,387),(403,470),(599,463)}

# A={(299,129),(231,157)}    
# B={(205,279),(403,470),(387,139),(506,387)}

# A={(70,19),(25,41)}    
# B={(66,125),(17,88),(114,31),(120,88)}

# A={(714,31),(768,90)}    
# B={(648,22),(774,159),(696,179),(623,92)}

# A={(712,659),(669,690)}    
# B={(762,662),(785,731),(660,751),(718,795)}

# A={(149,79),(100,133)}    
# B={(14,65),(36,164),(147,32),(81,11)}

# A={(8,635),(12,545)}    
# B={(55,520),(144,528),(145,670),(60,687)}

# A={(164,704),(222,700)}    
# B={(159,792),(252,746),(227,795),(126,744)}

# A={(550,741),(549,699)}    
# B={(426,777),(504,679),(505,771),(427,680)}

# A={(634,390),(701,414)}    
# B={(570,490),(633,531),(575,407),(705,470)}

# A={(579,584),(525,593)}    
# B={(533,733),(517,662),(600,652),(599,723)}

# A={(613,72),(113,76)}    
# B={(108,747),(52,234),(599,723),(763,203)}


# A={(582,247),(592,134)}    
# B={(491,315),(359,255),(350,113),(480,68)}



aa = list(A)


YanJingZuo_X = aa[0][0]
YanJingZuo_Y = aa[0][1]
# print(YanJingZuo_X)
# print(YanJingZuo_Y)

YanJingYou_X = aa[1][0]
YanJingYou_Y = aa[1][1]




bb = list(B)
bb.sort()
bb1_x = bb[0][0]
bb1_y = bb[0][1]
bb2_x = bb[1][0]
bb2_y = bb[1][1]
bb3_x = bb[2][0]
bb3_y = bb[2][1]
bb4_x = bb[3][0]
bb4_y = bb[3][1]



PaiXuNEW = (bb1_x,bb1_y),(bb2_x,bb2_y),(bb3_x,bb3_y),(bb4_x,bb4_y)


PaiXuNEW2 = list(PaiXuNEW)



cv2.circle(img,  aa[0],1 ,(255, 0, 255), 4)
cv2.circle(img,  aa[1],1 ,(255, 0, 255), 4)
cv2.putText(img,str("ZuoYan"),aa[0], cv2.FONT_HERSHEY_SIMPLEX , 0.6, (0,0,255),1)
cv2.putText(img,str("YouYan"),aa[1], cv2.FONT_HERSHEY_SIMPLEX , 0.6, (0,0,255),1)

cv2.circle(img,  PaiXuNEW2[0],1 ,(0, 0, 255), 4)
cv2.putText(img,str("ZuoJiao"),PaiXuNEW2[0], cv2.FONT_HERSHEY_SIMPLEX , 0.6, (0,0,255),1)

cv2.circle(img,  PaiXuNEW2[1],1 ,(0, 255, 0), 4)
cv2.putText(img,str("ZuoShou"),PaiXuNEW2[1], cv2.FONT_HERSHEY_SIMPLEX , 0.6, (0,0,255),1)

cv2.circle(img,  PaiXuNEW2[2],1 ,(0, 255, 0), 4)
cv2.putText(img,str("YouShou"),PaiXuNEW2[2], cv2.FONT_HERSHEY_SIMPLEX , 0.6, (0,0,255),1)

cv2.circle(img,  PaiXuNEW2[3],1 ,(0, 0, 255), 4)
cv2.putText(img,str("YouJiao"),PaiXuNEW2[3], cv2.FONT_HERSHEY_SIMPLEX , 0.6, (0,0,255),1)


cv2.imshow('ahong',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

方向不同

所有的A B
都要符合
左眼 右眼
左手 右手
左脚 右脚

A是
眼睛

B是四肢

但是排序不一定是固定的
但是结果是一目了然的 关系是固定的

每一张图片中都包含这6个关键点的信息
注释的A B 就是不同图片中 6个关键点

回复
阅读 701
1 个回答

不考虑左右手交叉,这还不简单吗,那就是左手x坐标一定比右手x坐标小并且左手y坐标比脚的y坐标大
相当于B数据中左手是x坐标较小y坐标较大的那个,右手是x坐标较大y较大的那个

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