Python 如何从OpenCV点访问X和Y坐标?

Python 如何从OpenCV点访问X和Y坐标?,python,class,opencv,Python,Class,Opencv,因此,我使用OpenCV进行姿势估计。该函数返回用于在视频片段上绘制线框骨架的对象数组: #SKELETON DRAWING if points[idFrom] and points[idTo]: if i == 1: print(type(point[idFrom])) #glUniform1f(xM, float(point[idFrom][0]/width))

因此,我使用OpenCV进行姿势估计。该函数返回用于在视频片段上绘制线框骨架的对象数组:

 #SKELETON DRAWING
        if points[idFrom] and points[idTo]:

            if i == 1:
                print(type(point[idFrom]))
                #glUniform1f(xM, float(point[idFrom][0]/width))
                #glUniform1f(yM, float(point[idFrom][1]/height))
            else:
                cv.line(frame, points[idFrom], points[idTo], (0, 255, 0), 3)
                cv.ellipse(frame, points[idFrom], (3, 3), 0, 0, 360, (0, 0, 255), cv.FILLED)
                cv.ellipse(frame, points[idTo], (3, 3), 0, 0, 360, (0, 0, 255), cv.FILLED)
我需要得到骨架上点的x和y坐标,我不知道怎么做。 这些要点显然是一个错误。 我尝试使用点[idFrom][0],它给了我以下错误:打印(类型(点[idFrom][0])) TypeError:“int”对象不可下标

以下是创建点的方式:

 points = []
    for i in range(len(BODY_PARTS)):
        # Slice heatmap of corresponging body's part.
        heatMap = out[0, i, :, :]

        # Originally, we try to find all the local maximums. To simplify a sample
        # we just find a global one. However only a single pose at the same time
        # could be detected this way.
        _, conf, _, point = cv.minMaxLoc(heatMap)
        x = (frameWidth * point[0]) / out.shape[3]
        y = (frameHeight * point[1]) / out.shape[2]
        # Add a point if it's confidence is higher than threshold.
        points.append((int(x), int(y)) if conf > thr else None)

    i = 0

我不知道你在哪里尝试使用线条
类型(点[idFrom][0])
,但是你应该使用
点[0][0]
作为x坐标,使用
点[0][1]
作为y坐标。不,不工作:打印(点[idFrom][0])类型错误:“int”对象不可下标请注意,你应该使用
点,非