Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory issue #29

Open
overfrequency opened this issue Feb 21, 2017 · 1 comment
Open

Memory issue #29

overfrequency opened this issue Feb 21, 2017 · 1 comment

Comments

@overfrequency
Copy link

overfrequency commented Feb 21, 2017

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.

@matejak
Copy link
Owner

matejak commented Feb 27, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants