create_rotate_mat=cv2.getRotationMatrix2D((dst.shape[1]/2,dst.shape[0]/2),rotate_angle,1)#rotate_angle unit is degree
for index in range(len(temp_track_boxs)):#the shape of temp_track_boxs:m*4*2
track_boxs_mat=np.mat(temp_track_boxs[index][:,0:2])
a=np.mat(create_rotate_mat[:,0:2]).T#must transpose!!! for (xa)^T
b=np.mat(create_rotate_mat[:,2])
temp_track_boxs[index][:,0:2]= np.array(track_boxs_mat*a+b)
其实矩阵变换运算的一般形式的y=ax+b
有时候想提高计算效率,多维度的进行计算可以将进行转置方式的计算。如y^T=(ax+b)^T,y^T=x^T*a^T+b^T

2964

被折叠的 条评论
为什么被折叠?



