How to plot log normalized image using imshow () (matplotlib)? [closed]

試著忘記壹切 提交于 2019-12-05 22:44:26

Does this work?

from matplotlib import colors, cm, pyplot as plt

norm = colors.LogNorm(image.mean() + 0.5 * image.std(), image.max(), clip='True')
plt.imshow(image, cmap=cm.gray, norm=norm, origin="lower")

This creates a special colormap that ranges from image.mean() + 0.5 * image.std() to image.max() using a logarithmic scale. More general information is here: colors and specifically: LogNorm

The origin='lower' means that the [0,0] element (the 'origin') of the array is shown in the lower left part of the figure. Normally the origin of an array is in the upper left.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!