def convert16to8(self, smooth = False):
if smooth:
matout = self.smooth
else:
matout = self.image
p = np.percentile(matout, 98)
lowp = np.percentile(matout, 1)
matout -= lowp
if p == 0:
p = np.max(matout)
#print lowp, p, np.max(matout)
matout[matout < 0] = 0
matout[matout > p] = p
#pylab.imshow(matout/p*255, 'gray')
#pylab.show()
return np.array(matout/p*255, np.uint8)
评论列表
文章目录