Пример #1
0
def projectaxes(frame, camera):

    #axis_factor = camera.axis_factor

    c0 = np.float32([[0, 0, 0]])

    a1 = np.float32([[3, 0, 0]])  #* axis_factor  # x
    a2 = np.float32([[0, 3, 0]])  #* axis_factor  # y
    a3 = np.float32([[0, 0, 3]])  #* axis_factor  # z

    ap1, j = cv2.projectPoints(a1, camera.rotation, camera.translation,
                               camera.intrinsics, np.float64([0, 0, 0, 0]))

    ap2, j = cv2.projectPoints(a2, camera.rotation, camera.translation,
                               camera.intrinsics, np.float64([0, 0, 0, 0]))

    ap3, j = cv2.projectPoints(a3, camera.rotation, camera.translation,
                               camera.intrinsics, np.float64([0, 0, 0, 0]))

    cp0, j = cv2.projectPoints(c0, camera.rotation, camera.translation,
                               camera.intrinsics, np.float64([0, 0, 0, 0]))

    drawaxis(frame, tuple(cp0.ravel().astype(int)),
             tuple(ap1.ravel().astype(int)), tuple(ap2.ravel().astype(int)),
             tuple(ap3.ravel().astype(int)))
Пример #2
0
    def __creategroundplane(self):

        print ''
        print 'Creating world plane for ' + self.id

        a = np.float32([[[0, 0, 0]]])

        for jj in xrange(0, 100, 1):
            for ii in xrange(0, 100, 1):
                    b = np.float32([[[ii - 50, jj - 50, 0]]])
                    a = np.r_[a, b]

        self.plane = a[1:10001]
Пример #3
0
    def __creategroundplane(self):

        print ''
        print 'Creating world plane for ' + self.id

        a = np.float32([[[0, 0, 0]]])

        for jj in xrange(0, 100, 1):
            for ii in xrange(0, 100, 1):
                b = np.float32([[[ii - 50, jj - 50, 0]]])
                a = np.r_[a, b]

        self.plane = a[1:10001]
Пример #4
0
def projectaxes(frame, camera):

    #axis_factor = camera.axis_factor

    c0 = np.float32([[0, 0, 0]])

    a1 = np.float32([[3, 0, 0]])  #* axis_factor  # x
    a2 = np.float32([[0, 3, 0]])  #* axis_factor  # y
    a3 = np.float32([[0, 0, 3]])  #* axis_factor  # z

    ap1, j = cv2.projectPoints(
        a1,
        camera.rotation,
        camera.translation,
        camera.intrinsics,
        np.float64([0, 0, 0, 0])
    )

    ap2, j = cv2.projectPoints(
        a2,
        camera.rotation,
        camera.translation,
        camera.intrinsics,
        np.float64([0, 0, 0, 0])
    )

    ap3, j = cv2.projectPoints(
        a3,
        camera.rotation,
        camera.translation,
        camera.intrinsics,
        np.float64([0, 0, 0, 0])
    )

    cp0, j = cv2.projectPoints(
        c0,
        camera.rotation,
        camera.translation,
        camera.intrinsics,
        np.float64([0, 0, 0, 0])
    )

    drawaxis(
        frame,
        tuple(cp0.ravel().astype(int)),
        tuple(ap1.ravel().astype(int)),
        tuple(ap2.ravel().astype(int)),
        tuple(ap3.ravel().astype(int))
    )