utils.py 文件源码

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

项目:Deep-Leafsnap 作者: sujithv28 项目源码 文件源码
def rotate(image, angle):
    (h, w) = image.shape[:2]
    (cX, cY) = (w // 2, h // 2)
    M = cv2.getRotationMatrix2D((cX, cY), -angle, 1.0)
    cos = np.abs(M[0, 0])
    sin = np.abs(M[0, 1])
    nW = int((h * sin) + (w * cos))
    nH = int((h * cos) + (w * sin))
    M[0, 2] += (nW / 2) - cX
    M[1, 2] += (nH / 2) - cY
    return cv2.warpAffine(image, M, (nW, nH))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号