有没有一种方法可以将作为二进制字符串加载的图像转换为大小为 (im_height, im_width, 3) 的 numpy 数组?像这样的东西:
# read image as binary string
with open(img_path, "rb") as image_file:
image_string = image_file.read()
# convert image string to numpy
image_np = convert_binary_string_to_numpy(image_string)
Run Code Online (Sandbox Code Playgroud)
那个转换函数会是什么样子?我正在处理解密,因此我需要处理二进制字符串。谢谢!