(self, dpt, cube, com, rot, joints3D, pad_value=0)
return new_dpt, new_joints3D, rot
Rotate hand virtually in the image plane by a given angle
        :param dpt: cropped depth image with different CoM
        :param cube: metric cube of size (sx,sy,sz)
        :param com: original center of mass, in image coordinates (x,y,z)
        :param rot: rotation angle in deg
        :param joints3D: original joint coordinates, in 3D coordinates (x,y,z)
        :param pad_value: value of padding
        :return: adjusted image, new 3D joint coordinates, rotation angle in XXX
Rotate hand virtually in the image plane by a given angle
        :param dpt: cropped depth image with different CoM
        :param cube: metric cube of size (sx,sy,sz)
        :param com: original center of mass, in image coordinates (x,y,z)
        :param rot: rotation angle in deg
        :param joints3D: original joint coordinates, in 3D coordinates (x,y,z)
        :param pad_value: value of padding
        :return: adjusted image, new 3D joint coordinates, rotation angle in XXX
Rotate hand virtually in the image plane by a given angle : param dpt : cropped depth image with different CoM : param cube : metric cube of size ( sx sy sz ) : param com : original center of mass in image coordinates ( x y z ) : param rot : rotation angle in deg : param joints3D : original joint coordinates in 3D coordinates ( x y z ) : param pad_value : value of padding : return : adjusted image new 3D joint coordinates rotation angle in XXX
def rotateHand(self, dpt, cube, com, rot, joints3D, pad_value=0):
        """
        Rotate hand virtually in the image plane by a given angle
        :param dpt: cropped depth image with different CoM
        :param cube: metric cube of size (sx,sy,sz)
        :param com: original center of mass, in image coordinates (x,y,z)
        :param rot: rotation angle in deg
        :param joints3D: original joint coordinates, in 3D coordinates (x,y,z)
        :param pad_value: value of padding
        :return: adjusted image, new 3D joint coordinates, rotation angle in XXX
        """

        # if rot is 0, nothing to do
        if numpy.allclose(rot, 0.):
            return dpt, joints3D, rot

        rot = numpy.mod(rot, 360)

        M = cv2.getRotationMatrix2D((dpt.shape[1]//2, dpt.shape[0]//2), -rot, 1)
        if self.resizeMethod == self.RESIZE_CV2_NN:
            flags = cv2.INTER_NEAREST
        elif self.resizeMethod == self.RESIZE_CV2_LINEAR:
            flags = cv2.INTER_LINEAR
        else:
            raise NotImplementedError
        new_dpt = cv2.warpAffine(dpt, M, (dpt.shape[1], dpt.shape[0]), flags=flags,
                                 borderMode=cv2.BORDER_CONSTANT, borderValue=pad_value)

        com3D = self.importer.jointImgTo3D(com)
        joint_2D = self.importer.joints3DToImg(joints3D + com3D)
        data_2D = numpy.zeros_like(joint_2D)
        for k in xrange(data_2D.shape[0]):
            data_2D[k] = rotatePoint2D(joint_2D[k], com[0:2], rot)
        new_joints3D = (self.importer.jointsImgTo3D(data_2D) - com3D)

        return new_dpt, new_joints3D, rot
def rotateHand ( self , dpt , cube , com , rot , joints3D , pad_value = 0 ) : # if rot is 0, nothing to do if numpy . allclose ( rot , 0. ) : return dpt , joints3D , rot rot = numpy . mod ( rot , 360 ) M = cv2 . getRotationMatrix2D ( ( dpt . shape [ 1 ] // 2 , dpt . shape [ 0 ] // 2 ) , - rot , 1 ) if self . resizeMethod == self . RESIZE_CV2_NN : flags = cv2 . INTER_NEAREST elif self . resizeMethod == self . RESIZE_CV2_LINEAR : flags = cv2 . INTER_LINEAR else : raise NotImplementedError new_dpt = cv2 . warpAffine ( dpt , M , ( dpt . shape [ 1 ] , dpt . shape [ 0 ] ) , flags = flags , borderMode = cv2 . BORDER_CONSTANT , borderValue = pad_value ) com3D = self . importer . jointImgTo3D ( com ) joint_2D = self . importer . joints3DToImg ( joints3D + com3D ) data_2D = numpy . zeros_like ( joint_2D ) for k in xrange ( data_2D . shape [ 0 ] ) : data_2D [ k ] = rotatePoint2D ( joint_2D [ k ] , com [ 0 : 2 ] , rot ) new_joints3D = ( self . importer . jointsImgTo3D ( data_2D ) - com3D ) return new_dpt , new_joints3D , rot