I'm trying to read a file and save to a numpy matrix to display it, but I'm stuck on an error.
from matplotlib import pyplot as plt
import numpy as np
image = np.empty((1664, 512, 256), np.uint16)
reader = open('Datasets/burned_wood_with_tape_1664x512x256_12bit.raw', "rb").read()
image.data[:] = reader
plt.imshow(image)
And this returns:
Traceback (most recent call last):
File "[PATH]", line 8, in <module>
image.data[:] = reader
NotImplementedError: memoryview slice assignments are currently restricted to ndim = 1
Any ideas of what's causing this error?
Edit:
I am using this SO question to write my program: read and display raw image using python