gui.py 文件源码

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

项目:spikefuel 作者: duguyue100 项目源码 文件源码
def create_border(frame, height, width, color):
    """Add constant border for the frame.

    The original frame will be displayed at the center of the monitor

    Parameters
    ----------
    frame : OpenCV Mat
        the original frame of image or video
    height : int
        height of the monitor
    width : int
        width of the monitor
    color : list
        the color of the border

    Returns
    -------
    new_frame : OpenCV Mat
        border added OpenCV Mat
    """
    vert = height/2-frame.shape[0]/2
    hor = width/2-frame.shape[1]/2

    new_frame = cv2.copyMakeBorder(src=frame, top=vert, bottom=vert, left=hor,
                                   right=hor, borderType=cv2.BORDER_CONSTANT,
                                   value=color)

    return new_frame
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号