chx_generic_functions.py 文件源码

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

项目:chxanalys 作者: yugangzhang 项目源码 文件源码
def create_polygon_mask(  image, xcorners, ycorners   ):
    '''
    Give image and x/y coners to create a polygon mask    
    image: 2d array
    xcorners, list, points of x coners
    ycorners, list, points of y coners
    Return:
    the polygon mask: 2d array, the polygon pixels with values 1 and others with 0

    Example:


    '''
    from skimage.draw import line_aa, line, polygon, circle    
    imy, imx = image.shape 
    bst_mask = np.zeros_like( image , dtype = bool)   
    rr, cc = polygon( ycorners,xcorners)
    bst_mask[rr,cc] =1    
    #full_mask= ~bst_mask    
    return bst_mask
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号