【发布时间】:2020-03-09 10:00:51
【问题描述】:
我想在同一个图上绘制不同形状的不同图像的直方图。 首先,我想获得最大的形状并计算较小形状和最大形状之间的增强因子,最后通过它进行归一化。
但它给了我很多变化。
例如,如果 a 具有 (100,100,1) 图像形状和 (25,25,1) 图像形状,则因子为 16,因为第一个具有比第二个多 16 倍的像素。 (4*4)
代码是
import scipy.ndimage as scim
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure(figsize = (12,8))
band = np.random.uniform(0,1, size = (100,100,1))
ax = fig.add_subplot(2, 2, 1) ## a voir comment modifier en fct du nb de canaux
x = np.linspace(band.min(), band.max(), 50)
y = scim.histogram(band, band.min(), band.max(), 50)
ax.plot(x, y)
band = np.random.uniform(0,1, size = (25,25,1))
ax = fig.add_subplot(2, 2, 1) ## a voir comment modifier en fct du nb de canaux
x = np.linspace(band.min(), band.max(), 50)
y = scim.histogram(band, band.min(), band.max(), 50)
ax.plot(x, y*16) #here i multiply by 16 to get the same size
plt.show()
两个直方图相差太大。 我怎样才能得到比这更现实的东西?
【问题讨论】:
标签: python python-3.x numpy matplotlib histogram