imreg_dft icon indicating copy to clipboard operation
imreg_dft copied to clipboard

Memory issue

Open overfrequency opened this issue 8 years ago • 1 comments

I have an array of images of size 1010x1010. I would like to register all of the images in this array onto the first image. When I run the following code my 8GB of memory gets full:

import numpy as np
import imreg_dft as ird

def register(im1,im2):
  result = ird.similarity(im1, im2, numiter=1)
  assert "timg" in result
  return result['timg']

im1 = img_array[:,:,0] # first image in the array

for i in xrange(1, num_images):
 img_array[:, :, i] = register(im1, img_array[:,:,i])

Do you have any idea what could be the problem? Thanks!

Edit: Images are float and the pixel values are not necessarily within 0-255 range.

overfrequency avatar Feb 21 '17 09:02 overfrequency

The problem with imreg_dft is that it is not particularly memory efficient. The memory problem may be mitigated in the future. However, if you don't use the fftw package to do the Fourier transform, I suggest that you install it and see whether the memory usage decreases. On a side note, try to use the ird command-line tool - you feed it one pair of images at time and you are unlikely to worry about memory issues. It supports .mat format, so you can use your float-number images.

matejak avatar Feb 27 '17 17:02 matejak