我是图像处理和尝试理解投影的新手。因此,当我们拥有3D图像时,它只是3D numpy数组,我通过将2D数组从3D数组中切出来查看它。为了进行正交投影,我简单地沿一个轴求和阵列。这是我这样做的代码:
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号轴(顶部/底部/侧面)在给我什么?最后,如果沿一个轴求和给出正交投影,我该如何进行倾斜和透视投影。我必须将图像坐标乘以任何变换矩阵吗?
谢谢大家。