Image to numpy does not fit into memory
The problem occurs when trying to load a big image into a numpy array. I know I have enough RAM but it will fail, I suspect the copy() here is a bad idea since we need to load the image in memory twice during the same function call.
def to_numpy(self, propagate_pixel_type=False):
"""
Export a pyotb object to numpy array
:param propagate_pixel_type: when set to True, the numpy array is created with the same pixel type as
the otbObject first output. Default is False.
:return: a numpy array
"""
# we make a copy to avoid some segfault if the reference to app is lost
array = self.app.ExportImage(self.output_param)['array'].copy()
Is this copy
really needed here ? How did you find yourself facing segfault ?
Can't we just let the user copy the numpy array later (outside of this function) if it is ever needed ?