【问题标题】:How to plot a 3D histogram of RGB image in python如何在python中绘制RGB图像的3D直方图
【发布时间】:2013-03-09 14:06:36
【问题描述】:

我想绘制我的 RGB 图像的 3D 直方图。 以下是我的代码:

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
from scipy.misc import imread
import pylab

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
img1 = imread('image.jpg')
img_reshaped = img1.reshape(img1.shape[0] * img1.shape[1], img1.shape[2])

hist, edges = np.histogramdd(img_reshaped, bins=(100, 100, 100))

请告诉我如何绘制我得到的hist 直方图。

【问题讨论】:

    标签: python matplotlib histogram


    【解决方案1】:

    您是否看过 matplotlib 库中的 3d 直方图示例?

    见:http://matplotlib.org/examples/mplot3d/hist3d_demo.html

    【讨论】:

    • 是的,但我无法将他们的 2d 直方图扩展到我的 3d。
    • 您想象中的人物会是什么样子?您实际上是在要求一个 4D 图形——您是在想象某种动画还是某种 3D 绘图堆栈?
    • 是的,我实际上是在寻找 4D 人物。但我将分离 RGB 通道并仅将其绘制为 2D。
    猜你喜欢
    • 1970-01-01
    • 2018-06-02
    • 1970-01-01
    • 2016-07-22
    • 2012-04-22
    • 2019-07-01
    • 2020-12-02
    • 2023-04-07
    • 2018-02-05
    相关资源
    最近更新 更多