在Internet上,我找到了将代码(bmp)转换成矩阵的代码。该错误表明bmp图片是无法识别的参数。
from scipy import *
import argparse
import os
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Convert an image into a matrix. The output is a binary file <img>.npy in the same directory as the input image.')
parser.add_argument('img',help="C:\\Users\\DELL\\PycharmProjects\\untitled.py\\baboon.bmp")
args = parser.parse_args("baboon.bmp")
img_path = args.img
img_array = misc.imread(img_path)
save(os.path.splitext(img_path)[0]+'-matrix', img_array)