Skip to content Skip to sidebar Skip to footer

Exit Code 139 When Performing Image Subtraction

I am performing an image subtraction using python. I have images in the form of numpy arrays. The size of the list that carrying all images is 1000. Each numpy array in the list is

Solution 1:

You might be running out of memory: you have 1000 images x 360 pixels x 640 pixels x 3 bands x 8 bits = about 691 MB...

Code 139 is listed here as "attempt to access a virtual address which is not in your address space", which would support a memory allocation error, which could happen easily if you are on 32-bit system with low amount of RAM, and other things are already in memory.

You might refactor your code so that it's not necessary to hold a list of images in memory, for instance, only hold the last image in memory, then perform the subtraction and overwrite it with the current image.

You could test this by replacing your function with:

a = []
for i in range(1000):
    a.append(numpy.ones((360,640,3), dtype=numpy.int))

and seeing if that runs without running out of memory.


Solution 2:

I had a similar problem with opencv-python==3.1.0. I was having:

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

error all of a sudden after many successful calls of cv2.seamlessClone.

For me, the solution was to upgrade to opencv-python==3.4.10.37


Post a Comment for "Exit Code 139 When Performing Image Subtraction"