def getweight(self, mask_mat=None):
#gray_mask = cv2.cvtColor(mask_mat, cv2.COLOR_BGR2GRAY)
gray_mask=mask_mat
ret, bin_mask = cv2.threshold(gray_mask,1,1,0)
_, contours, _ = cv2.findContours(bin_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
weights = np.zeros_like(bin_mask, dtype=np.float)
weights = cv2.drawContours(weights, contours, -1, (1), 5)
weights = cv2.GaussianBlur(weights, (41,41), 1000)
weights = np.multiply(weights,10)+0.6
return weights
Dataset_writer_segmentation.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录