filters3d_plgs.py 文件源码

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

项目:imagepy 作者: Image-Py 项目源码 文件源码
def run(self, ips, snap, img, para = None):
        imgs = ips.imgs
        gradient = np.zeros(imgs.shape, dtype=np.float32)
        gradient += ndimg.sobel(imgs, axis=0, output=np.float32)**2
        gradient += ndimg.sobel(imgs, axis=1, output=np.float32)**2
        gradient += ndimg.sobel(imgs, axis=2, output=np.float32)**2
        gradient **= 0.5

        msk = np.zeros(imgs.shape, dtype=np.uint8)
        msk[imgs>para['thr2']] = 1
        msk[imgs<para['thr1']] = 2

        #rst = watershed(gradient, msk)
        rst = watershed(gradient, msk.astype(np.uint16))
        imgs[:] = (rst==1)*255
        ips.lut = self.buflut
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号