小编Bra*_*n J的帖子

如何并排绘制图像和图形?

我试图plt.fig()在 Python 中使用其各自的直方图以相等的比例并排绘制图像,但我没有得到所需的输出。相反,我将直方图重叠到图像上。

知道为什么会这样吗?

import pylab as plt
import matplotlib.image as mpimg
import numpy as np


img = np.uint8(mpimg.imread('motherT.png'))
im2 = np.uint8(mpimg.imread('waldo.png'))
# convert to grayscale
# do for individual channels R, G, B, A for nongrayscale images

img = np.uint8((0.2126* img[:,:,0]) + \
        np.uint8(0.7152 * img[:,:,1]) +\
             np.uint8(0.0722 * img[:,:,2]))

im2 = np.uint8((0.2126* img[:,:,0]) + \
        np.uint8(0.7152 * img[:,:,1]) +\
             np.uint8(0.0722 * img[:,:,2]))

# show old and new image
# show original image
fig = …
Run Code Online (Sandbox Code Playgroud)

python matplotlib histogram fig

2
推荐指数
1
解决办法
5678
查看次数

标签 统计

fig ×1

histogram ×1

matplotlib ×1

python ×1