(img, bbox, landmark, alpha)
return (face, landmark_)
given a face with bbox and landmark, rotate with alpha
        and return rotated face with bbox, landmark (absolute position)
given a face with bbox and landmark, rotate with alpha
        and return rotated face with bbox, landmark (absolute position)
given a face with bbox and landmark rotate with alpha and return rotated face with bbox landmark ( absolute position )
def rotate(img, bbox, landmark, alpha):
    """
        given a face with bbox and landmark, rotate with alpha
        and return rotated face with bbox, landmark (absolute position)
    """
    center = ((bbox.left+bbox.right)/2, (bbox.top+bbox.bottom)/2)
    rot_mat = cv2.getRotationMatrix2D(center, alpha, 1)
    img_rotated_by_alpha = cv2.warpAffine(img, rot_mat, img.shape)
    landmark_ = np.asarray([(rot_mat[0][0]*x+rot_mat[0][1]*y+rot_mat[0][2],
                 rot_mat[1][0]*x+rot_mat[1][1]*y+rot_mat[1][2]) for (x, y) in landmark])
    face = img_rotated_by_alpha[bbox.top:bbox.bottom+1,bbox.left:bbox.right+1]
    return (face, landmark_)
def rotate ( img , bbox , landmark , alpha ) : center = ( ( bbox . left + bbox . right ) / 2 , ( bbox . top + bbox . bottom ) / 2 ) rot_mat = cv2 . getRotationMatrix2D ( center , alpha , 1 ) img_rotated_by_alpha = cv2 . warpAffine ( img , rot_mat , img . shape ) landmark_ = np . asarray ( [ ( rot_mat [ 0 ] [ 0 ] * x + rot_mat [ 0 ] [ 1 ] * y + rot_mat [ 0 ] [ 2 ] , rot_mat [ 1 ] [ 0 ] * x + rot_mat [ 1 ] [ 1 ] * y + rot_mat [ 1 ] [ 2 ] ) for ( x , y ) in landmark ] ) face = img_rotated_by_alpha [ bbox . top : bbox . bottom + 1 , bbox . left : bbox . right + 1 ] return ( face , landmark_ )