我想在同一图形上绘制不具有相同形状的不同图像的直方图。 首先,我想得到最大的形状,然后计算较小形状和最大形状之间的增大因子,以最终对其进行归一化。
但这给了我很多变化。
例如,如果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()
2个直方图过于不同。 我怎么能得到比这更现实的东西?