I want to analyse a 3d array by creating np.zeros and fill it in. However I cannot allocate the array due to memory error. Here is the code:
The previous code basically creates an array and label it. The array has 200 images with 900*900 pixels.
label, num = ndimage.label(array, structure=struct)
The error occurs in this line:
new_img = np.zeros((200, 900, 900), dtype='uint8')
which gives error:
Traceback (most recent call last):
File "C:/Users/Yifan/PycharmProjects/X-ray process/pore_analysis_batch2.py", line 14, in <module>
new_img = np.zeros((200, 900, 900), dtype='uint8')
numpy.core._exceptions.MemoryError: Unable to allocate 154. MiB for an array with shape (200, 900, 900) and data type uint8
I've changed the memory limits in windows settings and the 154MiB seems to be too small to cause a memory error. I'm new to python and this error get me stuck for a while, please help me guys!