python mahotas.imread 将 2d 图像读取为 3d

标签 python image-processing mahotas

我有一张由我的另一个代码保存的图像。该图像是普通的 JPG 文件。我用imsave保存了它。

现在当我在另一个代码中读取它时,它似乎是 3d :S

图像是here

读取它的简单代码是这样的:

import mahotas

img = mahotas.imread('d:/normal.jpg')
print img.shape, img.dtype

最佳答案

尝试将 jpg 读取为灰度,如下所示:

mahotas.imread('d:/normal.jpg', as_grey = True)

关于python mahotas.imread 将 2d 图像读取为 3d,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11278672/

相关文章:

Python - 如何将字符串从二进制转换为整数列表?

numpy - 为什么 cv2.calcOpticalFlowFarneback 在简单的合成示例上失败?

python - 如何使用Python计算图像上的彩色像素区域?

python - 如何反转 sklearn.OneHotEncoder 变换以恢复原始数据?

python - Pandas 比较列表的列

python - opencv python中的渐变蒙版混合

python-2.7 - 将 mahotas 安装到 python 2.7 时出错

python mahotas : Applying threshold filter and saving image as pgn

python - 在 Python 中将键添加到字典或将值附加到列表是否更快?

video - 用opencv进行视频处理