【发布时间】:2019-11-05 22:59:09
【问题描述】:
我是图像处理的新手,并试图了解投影。所以当我们有一个 3D 图像时,它只是一个 3D numpy 数组,我通过从 3D 数组中切出一个 2D 数组来查看它。为了进行正交投影,我只是简单地将沿一个轴的数组相加。这是我的代码:
import numpy as np
import matplotlib.pyplot as plt
#shape of the 'image' array is (256, 256, 176) so i am assuming there are 256 slices and row and column of each slice is 256x176
image = np.load('brain_ct.npy')
#when i sum along axis 0 or axis 1, the image shows up as blank with some warnings
#(Warning: converting a masked element to nan)
#only summing up along axis 2 works (not sure why is that)
collapsed = np.sum(image, axis=2)
plt.imshow(collapsed, cmap='gray')
我不确定为什么沿轴 0 和 1 求和不起作用。另外,我不确定轴 2 给我什么视图(上/下/侧)?最后,如果沿一个轴求和得出正交投影,我该如何进行倾斜和透视投影。是否有任何转换矩阵需要与图像坐标相乘?
谢谢大家。
【问题讨论】:
-
任何切片都可能是任何方向的有效图像。你有没有考虑过。显示一些要检查的图像?
-
是的,沿不同方向切片确实会产生图像,但沿轴 0 和轴 1 相加不会。我也有点困惑,无论是沿轴 0 求和显示 3D 立方体的顶视图还是前视图。
-
为什么你认为求和会给你一个有意义的形象?
-
我正在尝试对图像进行透视投影,所以我从平行投影开始,这就是为什么我沿一个轴求和
-
我不确定这是否有意义。您希望求和在投影方面完成什么?
标签: python image-processing transformation projection scikit-image