( S, h, w )
return M
Convert polygon segmentation to binary mask.
         :param   S (float array)   : polygon segmentation mask
         :param   h (int)           : target mask height
         :param   w (int)           : target mask width
         :return: M (bool 2D array) : binary mask
Convert polygon segmentation to binary mask.
         :param   S (float array)   : polygon segmentation mask
         :param   h (int)           : target mask height
         :param   w (int)           : target mask width
         :return: M (bool 2D array) : binary mask
Convert polygon segmentation to binary mask . : param S ( float array ) : polygon segmentation mask : param h ( int ) : target mask height : param w ( int ) : target mask width : return : M ( bool 2D array ) : binary mask
def segToMask( S, h, w ):
         """
         Convert polygon segmentation to binary mask.
         :param   S (float array)   : polygon segmentation mask
         :param   h (int)           : target mask height
         :param   w (int)           : target mask width
         :return: M (bool 2D array) : binary mask
         """
         M = np.zeros((h,w), dtype=np.bool)
         for s in S:
             N = len(s)
             rr, cc = polygon(np.array(s[1:N:2]), np.array(s[0:N:2])) # (y, x)
             M[rr, cc] = 1
         return M
def segToMask ( S , h , w ) : M = np . zeros ( ( h , w ) , dtype = np . bool ) for s in S : N = len ( s ) rr , cc = polygon ( np . array ( s [ 1 : N : 2 ] ) , np . array ( s [ 0 : N : 2 ] ) ) # (y, x) M [ rr , cc ] = 1 return M