data_preprocessing_autoencoder.py 文件源码

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

项目:AVSR-Deep-Speech 作者: pandeydivesh15 项目源码 文件源码
def crop_and_store(frame, mouth_coordinates, name):
    """
    Args:
        1. frame:               The frame which has to be cropped.
        2. mouth_coordinates:   The coordinates which help in deciding which region is to be cropped.
        3. name:                The path name to be used for storing the cropped image.
    """

    # Find bounding rectangle for mouth coordinates
    x, y, w, h = cv2.boundingRect(mouth_coordinates)

    mouth_roi = frame[y:y + h, x:x + w]

    h, w, channels = mouth_roi.shape
    # If the cropped region is very small, ignore this case.
    if h < 10 or w < 10:
        return

    resized = resize(mouth_roi, 32, 32)
    cv2.imwrite(name, resized)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号