使用cv2.getRotationMatrix2D得到矩陣自主進行空間位置變換

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!!!
    b=np.mat(create_rotate_mat[:,2])
    temp_track_boxs[index][:,0:2]= np.array(track_boxs_mat*a+b)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章