meraj
meraj

Reputation: 243

How to handle large images in matlab without running out of memory?

I am creating mosaic of two images based on the region matches between them using sift descriptors. The problem is when the created mosaic's size gets too large matlab runs out of memory. Is there some way of stitching the images without actually loading the complete images in memory. If not how do other gigapixel image generation techniques work or the panorama apps.

Upvotes: 7

Views: 1290

Answers (3)

peakxu
peakxu

Reputation: 6675

You can potentially use distributed arrays in the parallel computing toolbox

Upvotes: 0

Jacob
Jacob

Reputation: 34621

  1. Determine the size of the final mosaic prior to stitching (easy to compute with the size of your input images and the homography).
  2. Write a blank mosaic to file (not in any specific format but a sequence of bytes just as in memory)
  3. I'm assuming you're inverse mapping the pixels from the original images to the mosaic. So, just write to file when you're trying to store the intensity of the pixel in your mosaic.

Upvotes: 2

Jonas
Jonas

Reputation: 74940

There are a few ways you can save memory:

  1. You should use integer data types, such as uint8 for your data.
  2. If you're stitching, you can only keep the regions of interest in memory, such as the potential overlap regions.
  3. If none of the other works, you can spatially downsample the images using imresample, and work on the resulting smaller images.

Upvotes: 1

Related Questions