rois.py 文件源码

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

项目:pysptools 作者: ctherien 项目源码 文件源码
def _post_to_mask(self, rois, id):
        for r in rois:
            if 'rec' in r:
                x1,y1,x2,y2 = r['rec']
                for x in range(self.mask.shape[0]):
                    for y in range(self.mask.shape[1]):
                        if (x >= x1 and x < x2) and (y >= y1 and y < y2):
                            self.mask[x,y] = id
            if 'poly' in r:
                import matplotlib.patches as patches
                poly1 = patches.Polygon(r['poly'], closed=True)
                for i in range(self.mask.shape[0]):
                    for j in range(self.mask.shape[1]):
                        if poly1.get_path().contains_point((i,j)) == True:
                            self.mask[i,j] = id
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号