PosePriorNetwork.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:hand3d 作者: lmb-freiburg 项目源码 文件源码
def _get_rot_mat(self, ux_b, uy_b, uz_b):
        """ Returns a rotation matrix from axis and (encoded) angle."""
        with tf.name_scope('get_rot_mat'):
            u_norm = tf.sqrt(tf.square(ux_b) + tf.square(uy_b) + tf.square(uz_b) + 1e-8)
            theta = u_norm

            # some tmp vars
            st_b = tf.sin(theta)
            ct_b = tf.cos(theta)
            one_ct_b = 1.0 - tf.cos(theta)

            st = st_b[:, 0]
            ct = ct_b[:, 0]
            one_ct = one_ct_b[:, 0]
            norm_fac = 1.0 / u_norm[:, 0]
            ux = ux_b[:, 0] * norm_fac
            uy = uy_b[:, 0] * norm_fac
            uz = uz_b[:, 0] * norm_fac

            trafo_matrix = self._stitch_mat_from_vecs([ct+ux*ux*one_ct, ux*uy*one_ct-uz*st, ux*uz*one_ct+uy*st,
                                                       uy*ux*one_ct+uz*st, ct+uy*uy*one_ct, uy*uz*one_ct-ux*st,
                                                       uz*ux*one_ct-uy*st, uz*uy*one_ct+ux*st, ct+uz*uz*one_ct])

            return trafo_matrix
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号